Documentation ¶
Overview ¶
Package column extracts database column information from Go struct fields.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index []int
Index is used to efficiently find the value for a database column in the associated field within a structure. In most cases an index is a single integer, which represents the index of the relevant field in the structure. In the case of fields in embedded structs, a field index consists of more than one integer.
func (Index) Append ¶
Append a number to an existing index to create a new index. The original index ix is unchanged.
If ix is nil, then Append returns an index with a single index value.
type Info ¶
type Info struct { Field reflect.StructField Index Index Path Path PrimaryKey bool AutoIncrement bool Version bool JSON bool EmptyNull bool }
Info contains information about a database column that has been extracted from a struct field using reflection.
func ListForType ¶
ListForType returns a list of column information associated with the specified type, which must be a struct.
type Path ¶
type Path []struct { // FieldName is the name of the associated StructField. FieldName string // ColumnName is the associated column name, extracted // from the StructTag. If no column name has been specified, // this field is blank. ColumnName string }
A Path contains information about all the StructFields traversed to obtain the value for a column.
The significance of the path is that it is used to construct the column name, either by the column name(s) specified in the struct tags, or by applying a naming convention to the field name(s).
func (Path) Append ¶
Append details of a field to an existing path to create a new path. The original path is unchanged.