Documentation ¶
Index ¶
- Constants
- func CamelCased(s string) string
- func ColumnName(s string) string
- func EntityName(s string) string
- func File(filename string) (*os.File, error)
- func FmtAndSave(unformatted []byte, filename string) (bool, error)
- func HasUpper(s string) bool
- func IsLower(c byte) bool
- func IsUpper(c byte) bool
- func Join(schema, table string) string
- func JoinF(schema, table string) string
- func LowerFirst(s string) string
- func PackageName(s string) string
- func Quoted(fullName string, escape bool) string
- func ReplaceSuffix(in, suffix, replace string) string
- func Sanitize(s string) string
- func Schemas(tables []string) (schemas []string)
- func Singular(s string) string
- func Split(s string) (string, string)
- func ToLower(c byte) byte
- func ToUpper(c byte) byte
- func Underscore(s string) string
- type Annotation
- type Index
- type Set
Constants ¶
View Source
const ( // Id is camelCased Id Id = "Id" // Ids is camelCased Ids Ids = "Ids" // ID is golang ID ID = "ID" // IDs is golang IDs IDs = "IDs" // Rel if suffix for Relation Rel = "Rel" )
View Source
const ( // PublicSchema is a default postgresql schema PublicSchema = "public" // DefaultPackage is a default package name DefaultPackage = "model" // DefaultAlias is a default alias for model DefaultAlias = "t" )
Variables ¶
This section is empty.
Functions ¶
func CamelCased ¶
CamelCased converts string to camelCase from https://github.com/uptrace/bun/blob/master/internal/underscore.go#L37
func ColumnName ¶
ColumnName gets string usable as struct field name
func FmtAndSave ¶
FmtAndSave formats go code and saves file if formatting failed it still saves file but return error also
func ReplaceSuffix ¶
ReplaceSuffix replaces substring on the end of string
func Underscore ¶
Underscore converts string to under_scored from https://github.com/uptrace/bun/blob/master/internal/underscore.go#L19
Types ¶
type Annotation ¶
type Annotation struct {
// contains filtered or unexported fields
}
Annotation is a simple helper used to build tags for structs
func (*Annotation) AddTag ¶
func (a *Annotation) AddTag(name string, value string) *Annotation
AddTag ads a tag if not exists, appends a value otherwise
func (*Annotation) Len ¶
func (a *Annotation) Len() int
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index stores unique strings
Click to show internal directories.
Click to hide internal directories.