Documentation ¶
Index ¶
- Constants
- func BitIn(index int, bitset uint) uint
- func BitNotIn(index int, bitset uint) uint
- func ByteIn(b byte, bs ...byte) int
- func CharIn(b byte, s string) int
- func GenDAO(dalgen *DalgenConfig, schema *TableSchema)
- func GenDataObject(dalgen *DalgenConfig, schema *TableSchema)
- func GetBindvarList(stmt sqlparser.Statement) []string
- func GetTableSchema(db *sqlx.DB, tableName string) string
- func IndexN(str, sep string, n int) (index int)
- func IndexNonSpace(s string) int
- func IsAllCharsIn(s, encoding string) bool
- func IsLetter(b byte) bool
- func IsLower(b byte) bool
- func IsSpace(b byte) bool
- func IsSpaceQuote(b byte) bool
- func IsUpper(b byte) bool
- func JoinPairs(pairs map[string]string, eq, sep string) string
- func LastIndexByte(s string, b byte) int
- func LastIndexN(str, sep string, n int) (index int)
- func LastIndexNonSpace(s string) int
- func MergeSpace(s string, trim bool) string
- func MidIndex(s string, sep byte) int
- func MultipleLineOperate(s, delim string, operate func(line, delim string) string) string
- func RemoveSpace(s string) string
- func RuneIn(ru rune, rs ...rune) int
- func Separate(s string, sep byte) (string, string)
- func SortedNumberIn(n int, nums ...int) int
- func SplitAndTrim(s, sep string) []string
- func StringIn(str string, strs []string) int
- func ToAbridge(str string) string
- func ToCamel(s string) string
- func ToGoType(name string) (t string)
- func ToLower(b byte) byte
- func ToLowerAbridge(str string) (s string)
- func ToLowerString(b byte) string
- func ToSnake(s string) string
- func ToUpper(b byte) byte
- func ToUpperString(b byte) string
- func TrimAfter(s, delimiter string) string
- func TrimAndToLower(str string) string
- func TrimAndToUpper(str string) string
- func TrimBefore(s, delimiter string) string
- func TrimFirstN(s, delim string, n int) string
- func TrimLastN(s, delim string, n int) string
- func TrimQuote(str string) (string, bool)
- func TrimWrap(str, left, right string, strict bool) (string, bool)
- func WriteStringsToBuffer(buffer *bytes.Buffer, strings []string, sep string)
- type Coloum
- type DalgenConfig
- type FieldSchema
- type Func
- type OpParam
- type OpParams
- type Operation
- type Param
- type TableSchema
- type TemplateDAO
- type TemplateDO
- type TemplateField
Constants ¶
const ( RESULT_TYPE_DEFAULT = "" RESULT_TYPE_STRUCT = "struct" RESULT_TYPE_MAP = "map" RESULT_TYPE_INT = "int" RESULT_TYPE_STRING = "string" )
const ( RESULT_SET_DEFAULT = "" RESULT_SET_ONE = "single" RESULT_SET_LIST = "list" RESULT_SET_MAP = "map" )
const ( PARAM_TYPE_INT32LIST = "[]int32" PARAM_TYPE_UINT32LIST = "[]uint32" PARAM_TYPE_INT64LIST = "[]int64" PARAM_TYPE_UINT64LIST = "[]uint64" PARAM_TYPE_STRINGLIST = "[]string" )
Variables ¶
This section is empty.
Functions ¶
func BitNotIn ¶
BitNotIn test whether the bit at index is set to 0, if true, return 1 << index, else 0
func GenDAO ¶
func GenDAO(dalgen *DalgenConfig, schema *TableSchema)
func GenDataObject ¶
func GenDataObject(dalgen *DalgenConfig, schema *TableSchema)
func GetBindvarList ¶
GetBindvars returns a map of the bind vars referenced in the statement. TODO(sougou); This function gets called again from vtgate/planbuilder. Ideally, this should be done only once.
func IndexNonSpace ¶
IndexNonSpace find index of first non-space character, if not exist, -1 was returned
func IsAllCharsIn ¶
IsAllCharsIn check whether all chars of string is in encoding string
func IsSpaceQuote ¶
IsSpaceQuote return wehter a byte is space or quote characters
func LastIndexByte ¶
func LastIndexN ¶
LastIndexN find last index of n-th sep string
func LastIndexNonSpace ¶
LastIndexNonSpace find index of last non-space character, if not exist, -1 was returned
func MergeSpace ¶
MergeSpace merge multiple space to one, trim determine whether remove space at prefix and suffix
func MultipleLineOperate ¶
func RemoveSpace ¶
RemoveSpace remove all space characters from string by unibyte.IsSpace
func Separate ¶
Separate string by separator, the separator must in the middle of string, not first and last
func SortedNumberIn ¶
SortedNumberIn search index of number in sorted numbers with ascending order
func SplitAndTrim ¶
TrimSplit split string and return trim space string
func ToAbridge ¶
ToAbridge extract first letter and all upper case letter from string as it's abridge case
func ToCamel ¶
ToCamel string, xx_yy to XxYy, xx__yy to Xx_Yy xx _yy to Xx Yy, the rule is that a lower case letter after '_' will combine to a upper case letter
func ToLowerAbridge ¶
ToLowerAbridge extract first letter and all upper case letter from string as it's abridge case, and convert it to lower case
func ToLowerString ¶
ToLowerString convert a byte to lower case string
func ToUpperString ¶
ToUpperString convert a byte to upper case string
func TrimAndToLower ¶
TrimAndToLower return the trim and lower format of a string
func TrimAndToUpper ¶
TrimAndToUpper return the trim and upper format of a string
func TrimBefore ¶
func TrimFirstN ¶
Types ¶
type DalgenConfig ¶
type DalgenConfig struct { FilePath string // 表名 TableName string `xml:"sqlname,attr"` // 列 Cols []Coloum `xml:"column"` // 操作 Ops []Operation `xml:"operation"` }
func NewDalgenConfig ¶
func NewDalgenConfig(configFile, xmlFileName string) (dalgen *DalgenConfig, err error)
type FieldSchema ¶
type TableSchema ¶
type TableSchema struct { Name string `db:"Table"` // 表名 Comment string `db:"Create Table"` // 字段信息 Fields []FieldSchema }
func NewTableSchema ¶
func NewTableSchema(db *sqlx.DB, dalgen *DalgenConfig) (*TableSchema, error)
func (*TableSchema) GetFieldSchema ¶
func (t *TableSchema) GetFieldSchema(fldName string) (fld *FieldSchema)
type TemplateDAO ¶
type TemplateDO ¶
type TemplateDO struct { Name string Fields []TemplateField }
type TemplateField ¶
Id int32 `db:"id"`