Documentation ¶
Index ¶
- Constants
- func ColumnName(field StructField) string
- func EqColumnName(name string) func(StructField) bool
- func EqFieldName(name string) func(StructField) bool
- func FirstLookup(tag reflect.StructTag, names ...string) (string, bool)
- func FirstNotEmpty(strs ...string) string
- func ForeignKey(field StructField) []string
- func IsColumnField(field StructField) bool
- func IsForeignKeyField(field StructField) bool
- func IsIgnoredField(field StructField) bool
- func IsManyToOneField(field StructField) bool
- func IsOneToManyField(field StructField) bool
- func IsPrimaryKeyField(field StructField) bool
- func IsViewStruct(strct Struct) bool
- func OmitEmpty(field StructField) bool
- func ReferenceKey(field StructField) []string
- func TableName(strct Struct) string
- type ColumnSpec
- type ForeignKeySpec
- type Struct
- type StructField
- type TableSpec
- type Type
- type TypeAlternator
Constants ¶
View Source
const ( TagGoen = "goen" TagTable = "table" TagView = "view" TagPrimaryKey = "primary_key" TagColumn = "column" TagForeignKey = "foreign_key" TagIgnore = "ignore" )
Variables ¶
This section is empty.
Functions ¶
func ColumnName ¶
func ColumnName(field StructField) string
func EqColumnName ¶
func EqColumnName(name string) func(StructField) bool
func EqFieldName ¶
func EqFieldName(name string) func(StructField) bool
func FirstNotEmpty ¶
func ForeignKey ¶
func ForeignKey(field StructField) []string
func IsColumnField ¶
func IsColumnField(field StructField) bool
func IsForeignKeyField ¶
func IsForeignKeyField(field StructField) bool
func IsIgnoredField ¶
func IsIgnoredField(field StructField) bool
func IsManyToOneField ¶
func IsManyToOneField(field StructField) bool
func IsOneToManyField ¶
func IsOneToManyField(field StructField) bool
func IsPrimaryKeyField ¶
func IsPrimaryKeyField(field StructField) bool
func IsViewStruct ¶
func OmitEmpty ¶
func OmitEmpty(field StructField) bool
func ReferenceKey ¶
func ReferenceKey(field StructField) []string
Types ¶
type ColumnSpec ¶
type ColumnSpec string
struct tag example:
`primary_key:""` `primary_key:"col"` `primary_key:"col,omitempty"` `primary_key:",omitempty"` `primary_key:","` `column:""` `column:"col"` `column:"col,omitempty"` `column:",omitempty"` `column:","`
func (ColumnSpec) Name ¶
func (s ColumnSpec) Name() string
func (ColumnSpec) OmitEmpty ¶
func (s ColumnSpec) OmitEmpty() bool
type ForeignKeySpec ¶
type ForeignKeySpec string
struct tag example:
`foreign_key:"col1,col2"` => foreign key (col1, col2) references another(col1, col2) `foreign_key:"col1,col2:col3"` => foreign key (col1, col2) references another(col1, col3)
func (ForeignKeySpec) ChildKey ¶
func (s ForeignKeySpec) ChildKey() []string
ChildKey is the column or set of columns in the child table that are constrained by the foreign key constraint and which hold the REFERENCES clause.
func (ForeignKeySpec) ParentKey ¶
func (s ForeignKeySpec) ParentKey() []string
ParentKey is the column or set of columns in the parent table that the foreign key constraint refers to.
type Struct ¶
type Struct interface { Name() string Fields() []StructField Value() interface{} }
Struct represents go struct type info.
func NewStructFromAST ¶
func NewStructFromReflect ¶
type StructField ¶
type StructField interface { Name() string Type() Type Tag() reflect.StructTag Value() interface{} }
StructField represents go struct field info.
func FieldByFunc ¶
func FieldByFunc(fields []StructField, fn func(StructField) bool) (StructField, bool)
func FieldsByFunc ¶
func FieldsByFunc(fields []StructField, fn func(StructField) bool) (filtered []StructField)
type Type ¶
type Type interface { fmt.Stringer Name() string // original package path. // like github.com/kamichidu/goen, reflect or empty. PkgPath() string Kind() reflect.Kind Elem() Type NewStruct() Struct Value() interface{} }
Type represents go type info.
type TypeAlternator ¶
Click to show internal directories.
Click to hide internal directories.