names

package
v0.0.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LintGonicMapper = GonicMapper{
	"API":   true,
	"ASCII": true,
	"CPU":   true,
	"CSS":   true,
	"DNS":   true,
	"EOF":   true,
	"GUID":  true,
	"HTML":  true,
	"HTTP":  true,
	"HTTPS": true,
	"ID":    true,
	"IP":    true,
	"JSON":  true,
	"LHS":   true,
	"QPS":   true,
	"RAM":   true,
	"RHS":   true,
	"RPC":   true,
	"SLA":   true,
	"SMTP":  true,
	"SSH":   true,
	"TLS":   true,
	"TTL":   true,
	"UI":    true,
	"UID":   true,
	"UUID":  true,
	"URI":   true,
	"URL":   true,
	"UTF8":  true,
	"VM":    true,
	"XML":   true,
	"XSRF":  true,
	"XSS":   true,
}

LintGonicMapper is A GonicMapper that contains a list of common initialisms taken from golang/lint

Functions

func GetTableName

func GetTableName(v reflect.Value) string

GetTableName 对象转表名称

func LowerFirstChar

func LowerFirstChar(str string) string

func LowerFirstCharWithGonic added in v0.0.29

func LowerFirstCharWithGonic(str string) string

func ToObjName

func ToObjName(name string) string

ToObjName 对象名称转字段名称

func ToTableName

func ToTableName(name string) string

ToTableName 对象名称转表名,成员名称转字段名称

func UpperFirstChar

func UpperFirstChar(str string) string

func UpperFirstCharWithGonic added in v0.0.29

func UpperFirstCharWithGonic(str string) string

Types

type GonicMapper

type GonicMapper map[string]bool

GonicMapper implements IMapper. It will consider initialisms when mapping names. E.g. id -> ID, user -> User and to table names: UserID -> user_id, MyUID -> my_uid

func (GonicMapper) Obj2Table

func (mapper GonicMapper) Obj2Table(name string) string

func (GonicMapper) Table2Obj

func (mapper GonicMapper) Table2Obj(name string) string

type Mapper

type Mapper interface {
	Obj2Table(string) string
	Table2Obj(string) string
}

Mapper represents a name convertation between struct's fields name and table's column name

type TableName

type TableName interface {
	TableName() string
}

TableName table name interface to define customerize table name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL