Documentation ¶
Index ¶
- Constants
- type Columns
- type FieldMapper
- func (m *FieldMapper) Columns(entity interface{}) (*Columns, *Columns)
- func (m *FieldMapper) ColumnsForType(typ reflect.Type) []string
- func (m *FieldMapper) Keys(entity interface{}) (*Values, error)
- func (m *FieldMapper) KeysForType(typ reflect.Type) []string
- func (m *FieldMapper) TraversalsByName(t reflect.Type, names []string) ([][]int, []bool)
- func (m *FieldMapper) TraversalsByNameFunc(t reflect.Type, names []string, fn func(int, []int, bool) error) error
- type Generator
- func (g *Generator) Delete(table string, keys *Columns) (string, []interface{})
- func (g *Generator) Insert(table string, entity interface{}) (string, []interface{})
- func (g *Generator) Select(table string, entity interface{}, keys *Columns) (string, []interface{})
- func (g *Generator) Update(table string, entity interface{}, names []string) (string, []interface{})
- type Values
- type Zeroer
Constants ¶
View Source
const Tag = "db"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldMapper ¶
func DefaultFieldMapper ¶
func DefaultFieldMapper() *FieldMapper
func NewFieldMapper ¶
func NewFieldMapper() *FieldMapper
func (*FieldMapper) Columns ¶
func (m *FieldMapper) Columns(entity interface{}) (*Columns, *Columns)
func (*FieldMapper) ColumnsForType ¶
func (m *FieldMapper) ColumnsForType(typ reflect.Type) []string
func (*FieldMapper) Keys ¶
func (m *FieldMapper) Keys(entity interface{}) (*Values, error)
func (*FieldMapper) KeysForType ¶
func (m *FieldMapper) KeysForType(typ reflect.Type) []string
func (*FieldMapper) TraversalsByName ¶ added in v1.1.0
TraversalsByName returns a slice of int slices which represent the struct traversals for each mapped name and a slice of bools which indicates whether each such traversal is omit-empty. Panics if t is not a struct or Indirectable to a struct. Returns empty int slice for each name not found.
func (*FieldMapper) TraversalsByNameFunc ¶ added in v1.1.0
func (m *FieldMapper) TraversalsByNameFunc(t reflect.Type, names []string, fn func(int, []int, bool) error) error
TraversalsByNameFunc traverses the mapped names and calls fn with the index of each name and the struct traversal represented by that name. Panics if t is not a struct or Indirectable to a struct. Returns the first error returned by fn or nil.
Click to show internal directories.
Click to hide internal directories.