Documentation
¶
Index ¶
- func Combinations(set []string) (subsets [][]string)
- func EntityPrimaryKeys(entity *nemgen.Entity) []*nemgen.Field
- func FieldTypeToMYSQL(f *nemgen.Field) string
- func FieldTypeToPG(f *nemgen.Field) string
- func GenerateFile(ctx context.Context, req *GenerateFileRequest) error
- func MapEntityToTypes(e *nemgen.Entity, projectVersion *nemgen.ProjectVersion, dbType db.DBType) ([]SchemaField, []SchemaIndex, []SchemaConstraint)
- func PrintEntities(message string, entities []*nemgen.Entity)
- func SortStandaloneEntities(pv *nemgen.ProjectVersion)
- type Action
- type ActionResult
- type ConfigValues
- type GenerateFileRequest
- type GenerateRequest
- type GenerateResponse
- type SchemaConstraint
- type SchemaEntity
- type SchemaField
- type SchemaIndex
- type SchemaSelectStatement
- type SchemaSelectStatementField
- type SchemaTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Combinations ¶
func FieldTypeToMYSQL ¶
func FieldTypeToPG ¶
func GenerateFile ¶
func GenerateFile(ctx context.Context, req *GenerateFileRequest) error
func MapEntityToTypes ¶
func MapEntityToTypes(e *nemgen.Entity, projectVersion *nemgen.ProjectVersion, dbType db.DBType) ([]SchemaField, []SchemaIndex, []SchemaConstraint)
func PrintEntities ¶ added in v1.0.42
func SortStandaloneEntities ¶ added in v1.0.41
func SortStandaloneEntities(pv *nemgen.ProjectVersion)
Types ¶
type Action ¶
type Action string
const ( SelectSimpleAction Action = "select_simple" SelectForIndexedSimpleAction Action = "select_indexed_simple" SelectForIndexedCombinedAction Action = "select_indexed_combined" InsertAction Action = "insert" UpdateAction Action = "update" DeleteAction Action = "delete" CreateAction Action = "create" )
type ActionResult ¶
type ConfigValues ¶
type ConfigValues struct {
DBType db.DBType `json:"db_type"`
Entities []string `json:"entities"`
Actions []Action `json:"actions"`
}
func ConfigValuesFromAny ¶ added in v1.0.1
func ConfigValuesFromAny(any interface{}) (*ConfigValues, error)
type GenerateFileRequest ¶
type GenerateFileRequest struct {
ExecutionUUID string
Configvalues *ConfigValues
Data SchemaTemplate
ActionResults *[]ActionResult
Action Action
// contains filtered or unexported fields
}
type GenerateRequest ¶
type GenerateRequest struct {
ExecutionUUID string
ProjectVersion *nemgen.ProjectVersion
Configvalues *ConfigValues
}
type GenerateResponse ¶
type GenerateResponse struct {
ExecutionUUID string
WorkingDir string
ZipFile string
Results []ActionResult
}
func GenerateSQL ¶ added in v1.0.4
func GenerateSQL(ctx context.Context, req GenerateRequest) (*GenerateResponse, error)
type SchemaConstraint ¶
type SchemaConstraint struct {
DBType db.DBType
Name string
Relationship *nemgen.Relationship
TableName string
FromFields []SchemaField
ToFields []SchemaField
HasComma bool
}
contraints
func (SchemaConstraint) ForeignKeyFields ¶
func (sc SchemaConstraint) ForeignKeyFields() string
func (SchemaConstraint) ReferenceFields ¶
func (sc SchemaConstraint) ReferenceFields() string
type SchemaEntity ¶
type SchemaEntity struct {
DBType db.DBType
Name string
NameTitle string
PrimaryKeys []string
Fields []SchemaField
Indexes []SchemaIndex
Constraints []SchemaConstraint
SelectStatements []SchemaSelectStatement
}
entity
func (SchemaEntity) IsPrimaryKey ¶
func (e SchemaEntity) IsPrimaryKey(fieldIdentifier string) bool
func (SchemaEntity) PrimaryKeysIdentifiers ¶
func (e SchemaEntity) PrimaryKeysIdentifiers() string
func (SchemaEntity) PrimaryKeysWhereClause ¶
func (e SchemaEntity) PrimaryKeysWhereClause() string
func (SchemaEntity) UpdateFields ¶
func (e SchemaEntity) UpdateFields() string
type SchemaField ¶
type SchemaField struct {
Name string
NameTitle string
Type string
Field *nemgen.Field
Null string
HasComma bool
Default string
Unique string
}
field
func (SchemaField) Postfix ¶
func (f SchemaField) Postfix() string
type SchemaIndex ¶
type SchemaIndex struct {
DBType db.DBType
Name string
FieldNames map[string]string
Index *nemgen.Index
TypePrefix string
Type string
TypeSort int
HasComma bool
}
index
func (SchemaIndex) FieldNamesIdentifiers ¶
func (i SchemaIndex) FieldNamesIdentifiers() string
type SchemaSelectStatement ¶
type SchemaSelectStatement struct {
Name string
Identifier string
EntityIdentifier string
Fields []SchemaSelectStatementField
CombinedIndexes bool
IsPrimary bool
TimeFields []SchemaField
SortSupported bool
}
select
func ResolveSelectStatements ¶
func ResolveSelectStatements(e *nemgen.Entity, dbType db.DBType) []SchemaSelectStatement
type SchemaSelectStatementField ¶
type SchemaSelectStatementField struct {
Name string
Field SchemaField
IsLast bool
}
type SchemaTemplate ¶
type SchemaTemplate struct {
Entities []SchemaEntity
}
Click to show internal directories.
Click to hide internal directories.