Documentation
¶
Index ¶
Constants ¶
View Source
const Template = `` /* 2034-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Basic ¶
type Basic struct {
// contains filtered or unexported fields
}
Basic represents basic generator
type Options ¶
type Options struct {
base.Options
// Package sets package name for model
// Works only with SchemaPackage = false
Package string
// Do not replace primary key name to ID
KeepPK bool
// Soft delete column
SoftDelete string
// use sql.Null... instead of pointers
UseSQLNulls bool
// Do not generate alias tag
NoAlias bool
// Do not generate discard_unknown_columns tag
NoDiscard bool
// Override type for json/jsonb
JSONTypes map[string]string
// Add json tag to models
AddJSONTag bool
}
Options for generator
type TemplateColumn ¶
TemplateColumn stores column info
func NewTemplateColumn ¶
NewTemplateColumn creates a column for template
type TemplateEntity ¶
type TemplateEntity struct {
model.Entity
Tag template.HTML
NoAlias bool
Alias string
Columns []TemplateColumn
HasRelations bool
Relations []TemplateRelation
}
TemplateEntity stores struct info
func NewTemplateEntity ¶
func NewTemplateEntity(entity model.Entity, options Options) TemplateEntity
NewTemplateEntity creates an entity for template
type TemplatePackage ¶
type TemplatePackage struct {
Package string
HasImports bool
Imports []string
Entities []TemplateEntity
ORMNeeded bool
ORMDbStruct string
}
TemplatePackage stores package info
func NewTemplatePackage ¶
func NewTemplatePackage(entities []model.Entity, options Options) TemplatePackage
NewTemplatePackage creates a package for template
type TemplateRelation ¶
TemplateRelation stores relation info
func NewTemplateRelation ¶
func NewTemplateRelation(relation model.Relation, options Options) TemplateRelation
NewTemplateRelation creates relation for template
func NewTemplateRelationWithJoin ¶
func NewTemplateRelationWithJoin(relation model.Relation, relFK, relPK string, options Options) TemplateRelation
NewTemplateRelationWithJoin creates relation for template with `join` tag component relPK - primary key in foreign table
Click to show internal directories.
Click to hide internal directories.