Documentation
¶
Index ¶
- func CombinedOutputFilename(goFile string) string
- func GenerateMapping(f *File, m *StructMapping, goPackage string) (err error)
- func SplitOutputFilename(m *StructMapping, goFile string) string
- func StartFile(goPackage string) *File
- type FieldMapping
- type ReadColDef
- type StructMapping
- type WriteColDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinedOutputFilename ¶ added in v2.2.0
func GenerateMapping ¶ added in v2.2.0
func GenerateMapping(f *File, m *StructMapping, goPackage string) (err error)
GenerateMapping generates Go code for the struct mapping
func SplitOutputFilename ¶ added in v2.2.0
func SplitOutputFilename(m *StructMapping, goFile string) string
Types ¶
type FieldMapping ¶
type FieldMapping struct { // Name is the Go field name Name string // ReadColDef is the read column definition (nil if not given) ReadColDef *ReadColDef // WriteColDef is the write column definition (nil if not given) WriteColDef *WriteColDef // FieldType is the type in the Go struct FieldType types.Type // HasEqual is true, if the field type has an Equal method for comparison HasEqual bool }
FieldMapping contains mapping information for a field of a mapping
type ReadColDef ¶
type ReadColDef struct { // Col is the column name Col string // Sortable is true, if the column should appear in the list of sortable columns Sortable bool }
ReadColDef is the read column definition
type StructMapping ¶
type StructMapping struct { // TargetName is the exported record name (e.g. "MyRecord") TargetName string // MappingTypePackage is the package of the type with mapping information MappingTypePackage string // MappingTypePackage is the name of the type with mapping information MappingTypeName string // TableName contains the table name (if set) TableName string // FieldMappings contains all field mappings derived from the type FieldMappings []FieldMapping }
StructMapping contains mapping information for a struct type
func BuildStructMapping ¶
func BuildStructMapping(mappingTypePackage string, mappingTypeName string, targetTypeName string) (*StructMapping, error)
BuildStructMapping builds a struct mapping for a given mapping type and target type
func DiscoverStructMappings ¶
func DiscoverStructMappings(mappingTypePackage string) (mappings []*StructMapping, err error)
DiscoverStructMappings discovers all struct mappings in a given package
type WriteColDef ¶
type WriteColDef struct { // Col is the column name Col string // ToJSON when writing a column value ToJSON bool // NoDiff skips the comparison for this field when building a change set from a diff NoDiff bool }
WriteColDef is the write column definition
Directories
¶
Path | Synopsis |
---|---|
Code generated by construct, DO NOT EDIT.
|
Code generated by construct, DO NOT EDIT. |
repository
Code generated by construct, DO NOT EDIT.
|
Code generated by construct, DO NOT EDIT. |
Click to show internal directories.
Click to hide internal directories.