File: README.md

package info (click to toggle)
golang-github-serenize-snaker 0.0~git20170425.0.1c7f653-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 72 kB
  • ctags: 11
  • sloc: makefile: 2
file content (25 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# snaker

[![Build Status](https://travis-ci.org/serenize/snaker.svg?branch=master)](https://travis-ci.org/serenize/snaker)
[![GoDoc](https://godoc.org/github.com/serenize/snaker?status.svg)](https://godoc.org/github.com/serenize/snaker)

This is a small utility to convert camel cased strings to snake case and back, except some defined words.

## QBS Usage

To replace the original toSnake and back algorithms for [https://github.com/coocood/qbs](https://github.com/coocood/qbs)
you can easily use snaker:

Import snaker
```go
import (
  github.com/coocood/qbs
  github.com/serenize/snaker
)
```

Register the snaker methods to qbs
```go
qbs.ColumnNameToFieldName = snaker.SnakeToCamel
qbs.FieldNameToColumnName = snaker.CamelToSnake
```