model

package
v0.0.0-...-da2e21c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2019 License: MIT Imports: 28 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// TemplateArgumentTypeInt indicates that a type of argument is integer
	TemplateArgumentTypeInt = "int"
	// TemplateArgumentTypeFloat indicates that a type of argument is float
	TemplateArgumentTypeFloat = "float"
	// TemplateArgumentTypeBool indicates that a type of argument is bool
	TemplateArgumentTypeBool = "bool"
	// TemplateArgumentTypeString indicates that a type of argument is string
	TemplateArgumentTypeString = "string"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
}

Base is the base class that all model classes inherit

func (*Base) Create

func (receiver *Base) Create(_ extension.Model, db *gorm.DB, _ gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*Base) Delete

func (receiver *Base) Delete(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values) error

Delete corresponds HTTP DELETE message and handles a request for a single resource to delete the specific information

func (*Base) DeleteFromDesign

func (receiver *Base) DeleteFromDesign(model extension.Model, db *gorm.DB) error

DeleteFromDesign deletes the model related to this model in db

func (*Base) DoAfterDBMigration

func (receiver *Base) DoAfterDBMigration(_ *gorm.DB) error

DoAfterDBMigration execute initialization process after DB migration

func (*Base) DoAfterRouterSetup

func (receiver *Base) DoAfterRouterSetup(_ *gin.Engine) error

DoAfterRouterSetup execute initialization process after Router initialization

func (*Base) DoBeforeDBMigration

func (receiver *Base) DoBeforeDBMigration(_ *gorm.DB) error

DoBeforeDBMigration execute initialization process before DB migration

func (*Base) DoBeforeRouterSetup

func (receiver *Base) DoBeforeRouterSetup(_ *gin.Engine) error

DoBeforeRouterSetup execute initialization process before Router initialization

func (*Base) ExtractFromDesign

func (receiver *Base) ExtractFromDesign(model extension.Model, db *gorm.DB) (string, interface{}, error)

ExtractFromDesign extracts the model related to this model from db

func (*Base) GenerateTableName

func (receiver *Base) GenerateTableName(model extension.Model, db *gorm.DB) string

GenerateTableName generates its resource/table name in URL/DB

func (*Base) GetCount

func (receiver *Base) GetCount(model extension.Model, db *gorm.DB) (int, error)

GetCount returns the record count under current db conditions

func (*Base) GetModelKey

func (receiver *Base) GetModelKey(model extension.Model, keyParameterSpecifier string) (extension.ModelKey, error)

GetModelKey returns its key fields

func (*Base) GetMulti

func (receiver *Base) GetMulti(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*Base) GetOptions

func (receiver *Base) GetOptions(_ extension.Model, _ *gorm.DB, _ gin.Params, _ url.Values) error

GetOptions corresponds HTTP OPTIONS message and handles a request for multi resources to retrieve its supported options

func (*Base) GetResourceName

func (receiver *Base) GetResourceName(model extension.Model) (string, error)

GetResourceName returns its resource/table name in URL/DB

func (*Base) GetSingle

func (receiver *Base) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

func (*Base) GetStructFields

func (receiver *Base) GetStructFields(model extension.Model) []reflect.StructField

GetStructFields returns its struct fields used to create containers

func (*Base) GetTypeName

func (receiver *Base) GetTypeName(model extension.Model) string

GetTypeName returns its struct type name

func (*Base) LoadToDesign

func (receiver *Base) LoadToDesign(model extension.Model, db *gorm.DB, data interface{}) error

LoadToDesign loads the model related to this model into db

func (*Base) Patch

func (receiver *Base) Patch(_ extension.Model, _ *gorm.DB, _ gin.Params, _ url.Values, _ interface{}) (interface{}, error)

Patch corresponds HTTP PATCH message and handles a request for a single resource to update partially the specific information

func (*Base) Update

func (receiver *Base) Update(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, inputContainer interface{}) (interface{}, error)

Update corresponds HTTP PUT message and handles a request for a single resource to update the specific information

type Design

type Design struct {
	Base
	ClayVersion   string                 `json:"clay_version,omitempty" yaml:"clay_version,omitempty"`
	GeneratedDate string                 `json:"generated_date,omitempty" yaml:"generated_date,omitempty"`
	Content       map[string]interface{} `json:"content" yaml:"content"`
}

Design is the model class what represents the whole object model store

func NewDesign

func NewDesign() *Design

NewDesign creates a design model instance

func (*Design) Delete

func (receiver *Design) Delete(_ extension.Model, db *gorm.DB, _ gin.Params, _ url.Values) error

Delete deletes all models

func (*Design) GetContainerForMigration

func (receiver *Design) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*Design) GetSingle

func (receiver *Design) GetSingle(_ extension.Model, db *gorm.DB, _ gin.Params, urlValues url.Values, _ string) (interface{}, error)

GetSingle returns all models to store into versioning repositories

func (*Design) Update

func (receiver *Design) Update(_ extension.Model, db *gorm.DB, _ gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Update deletes and updates all models bases on the given data

type EphemeralBinaryObject

type EphemeralBinaryObject struct {
	Base
	Name        string `json:"name" yaml:"name" form:"name" gorm:"primary_key" validate:"required"`
	Content     []byte `json:"content" yaml:"content" form:"content"`
	Description string `json:"description" yaml:"description" form:"description" sql:"type:text"`
}

EphemeralBinaryObject is the model class what represents ephemeral binary object data which can exist at runtime only

func NewEphemeralBinaryObject

func NewEphemeralBinaryObject() *EphemeralBinaryObject

NewEphemeralBinaryObject creates a ephemeralBinaryObject model instance

func (*EphemeralBinaryObject) Create

func (receiver *EphemeralBinaryObject) Create(_ extension.Model, _ *gorm.DB, _ gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*EphemeralBinaryObject) Delete

func (receiver *EphemeralBinaryObject) Delete(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values) error

Delete corresponds HTTP DELETE message and handles a request for a single resource to delete the specific information

func (*EphemeralBinaryObject) GetContainerForMigration

func (receiver *EphemeralBinaryObject) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*EphemeralBinaryObject) GetCount

func (receiver *EphemeralBinaryObject) GetCount(_ extension.Model, _ *gorm.DB) (int, error)

GetCount returns the record count under current db conditions

func (*EphemeralBinaryObject) GetMulti

func (receiver *EphemeralBinaryObject) GetMulti(_ extension.Model, db *gorm.DB, _ gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*EphemeralBinaryObject) GetSingle

func (receiver *EphemeralBinaryObject) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

func (*EphemeralBinaryObject) Update

func (receiver *EphemeralBinaryObject) Update(model extension.Model, _ *gorm.DB, parameters gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Update corresponds HTTP PUT message and handles a request for a single resource to update the specific information

type EphemeralBinaryObjectRaw

type EphemeralBinaryObjectRaw struct {
	Base
	Name string `json:"name" yaml:"name" gorm:"primary_key"`
}

EphemeralBinaryObjectRaw is the model class what represents ephemeral binary object raw

func NewEphemeralBinaryObjectRaw

func NewEphemeralBinaryObjectRaw() *EphemeralBinaryObjectRaw

NewEphemeralBinaryObjectRaw creates a ephemeral binary object raw model instance

func (*EphemeralBinaryObjectRaw) GetContainerForMigration

func (receiver *EphemeralBinaryObjectRaw) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*EphemeralBinaryObjectRaw) GetSingle

func (receiver *EphemeralBinaryObjectRaw) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

type EphemeralScript

type EphemeralScript struct {
	Base
	Name          string `json:"name" yaml:"name" form:"name" gorm:"primary_key" validate:"required"`
	Description   string `json:"description" yaml:"description" form:"description"`
	ScriptContent string `json:"script_content" yaml:"script_content" form:"script_content" sql:"type:text"`
	Status        string `json:"status" yaml:"status"`
	ReturnValue   string `json:"return_value" yaml:"return_value" sql:"type:text"`
	Error         string `json:"error" yaml:"error" sql:"type:text"`
	StartedAt     string `json:"started_at" yaml:"started_at"`
	FinishedAt    string `json:"finished_at" yaml:"finished_at"`
	// contains filtered or unexported fields
}

EphemeralScript is the model class what represents ephemeralScript to execute something

func NewEphemeralScript

func NewEphemeralScript() *EphemeralScript

NewEphemeralScript creates a ephemeralScript model instance

func (*EphemeralScript) Create

func (receiver *EphemeralScript) Create(_ extension.Model, db *gorm.DB, _ gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*EphemeralScript) Delete

func (receiver *EphemeralScript) Delete(model extension.Model, _ *gorm.DB, parameters gin.Params, _ url.Values) error

Delete corresponds HTTP DELETE message and handles a request for a single resource to delete the specific information

func (*EphemeralScript) GetContainerForMigration

func (receiver *EphemeralScript) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*EphemeralScript) GetCount

func (receiver *EphemeralScript) GetCount(_ extension.Model, _ *gorm.DB) (int, error)

GetCount returns the record count under current db conditions

func (*EphemeralScript) GetMulti

func (receiver *EphemeralScript) GetMulti(_ extension.Model, db *gorm.DB, _ gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*EphemeralScript) GetSingle

func (receiver *EphemeralScript) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

func (*EphemeralScript) Update

func (receiver *EphemeralScript) Update(model extension.Model, _ *gorm.DB, parameters gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Update corresponds HTTP PUT message and handles a request for a single resource to update the specific information

type EphemeralScriptExecution

type EphemeralScriptExecution struct {
	Base
	Name string                 `json:"name" yaml:"name" form:"name" gorm:"primary_key"`
	Data map[string]interface{} `json:"data" yaml:"data" form:"data" sql:"-"`
}

EphemeralScriptExecution is the model class what represents ephemeralScript execution

func NewEphemeralScriptExecution

func NewEphemeralScriptExecution() *EphemeralScriptExecution

NewEphemeralScriptExecution creates a ephemeralScriptExecution model instance

func (*EphemeralScriptExecution) Create

func (receiver *EphemeralScriptExecution) Create(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, inputContainer interface{}) (interface{}, error)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*EphemeralScriptExecution) Delete

func (receiver *EphemeralScriptExecution) Delete(model extension.Model, _ *gorm.DB, parameters gin.Params, _ url.Values) error

Delete corresponds HTTP DELETE message and handles a request for a single resource to delete the specific information

func (*EphemeralScriptExecution) GetContainerForMigration

func (receiver *EphemeralScriptExecution) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

type EphemeralScriptRaw

type EphemeralScriptRaw struct {
	Base
	Name string `json:"name" yaml:"name" gorm:"primary_key"`
}

EphemeralScriptRaw is the model class what represents ephemeral script raw

func NewEphemeralScriptRaw

func NewEphemeralScriptRaw() *EphemeralScriptRaw

NewEphemeralScriptRaw creates a ephemeral script raw model instance

func (*EphemeralScriptRaw) GetContainerForMigration

func (receiver *EphemeralScriptRaw) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*EphemeralScriptRaw) GetSingle

func (receiver *EphemeralScriptRaw) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

type EphemeralTemplate

type EphemeralTemplate struct {
	Base
	Name            string `json:"name" yaml:"name" form:"name" gorm:"primary_key" validate:"required"`
	TemplateContent string `json:"template_content" yaml:"template_content" form:"template_content" sql:"type:text"`
	Description     string `json:"description" yaml:"description" form:"description" sql:"type:text"`
}

EphemeralTemplate is the model class what represents ephemeral template data which can exist at runtime only

func NewEphemeralTemplate

func NewEphemeralTemplate() *EphemeralTemplate

NewEphemeralTemplate creates a ephemeralTemplate model instance

func (*EphemeralTemplate) Create

func (receiver *EphemeralTemplate) Create(_ extension.Model, _ *gorm.DB, _ gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*EphemeralTemplate) Delete

func (receiver *EphemeralTemplate) Delete(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values) error

Delete corresponds HTTP DELETE message and handles a request for a single resource to delete the specific information

func (*EphemeralTemplate) GetContainerForMigration

func (receiver *EphemeralTemplate) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*EphemeralTemplate) GetCount

func (receiver *EphemeralTemplate) GetCount(_ extension.Model, _ *gorm.DB) (int, error)

GetCount returns the record count under current db conditions

func (*EphemeralTemplate) GetMulti

func (receiver *EphemeralTemplate) GetMulti(_ extension.Model, db *gorm.DB, _ gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*EphemeralTemplate) GetSingle

func (receiver *EphemeralTemplate) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

func (*EphemeralTemplate) Update

func (receiver *EphemeralTemplate) Update(model extension.Model, _ *gorm.DB, parameters gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Update corresponds HTTP PUT message and handles a request for a single resource to update the specific information

type EphemeralTemplateGeneration

type EphemeralTemplateGeneration struct {
	Base
	Name string `json:"name" yaml:"name" gorm:"primary_key"`
}

EphemeralTemplateGeneration is the model class what represents ephemeral template generation

func NewEphemeralTemplateGeneration

func NewEphemeralTemplateGeneration() *EphemeralTemplateGeneration

NewEphemeralTemplateGeneration creates a ephemeral template generation model instance

func (*EphemeralTemplateGeneration) GetContainerForMigration

func (receiver *EphemeralTemplateGeneration) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*EphemeralTemplateGeneration) GetSingle

func (receiver *EphemeralTemplateGeneration) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

type EphemeralTemplateRaw

type EphemeralTemplateRaw struct {
	Base
	Name string `json:"name" yaml:"name" gorm:"primary_key"`
}

EphemeralTemplateRaw is the model class what represents ephemeral template raw

func NewEphemeralTemplateRaw

func NewEphemeralTemplateRaw() *EphemeralTemplateRaw

NewEphemeralTemplateRaw creates a ephemeral template raw model instance

func (*EphemeralTemplateRaw) GetContainerForMigration

func (receiver *EphemeralTemplateRaw) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*EphemeralTemplateRaw) GetSingle

func (receiver *EphemeralTemplateRaw) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

type Template

type Template struct {
	Base
	ID                int                 `json:"id" yaml:"id" form:"id" gorm:"primary_key;auto_increment"`
	Name              string              `json:"name" yaml:"name" form:"name" gorm:"not null;unique" validate:"required"`
	TemplateContent   string              `json:"template_content" yaml:"template_content" form:"template_content" sql:"type:text"`
	Description       string              `json:"description" yaml:"description" form:"description" sql:"type:text"`
	TemplateArguments []*TemplateArgument `json:"template_arguments" yaml:"template_arguments" gorm:"ForeignKey:template_id" validate:"omitempty,dive"`
}

Template is the model class what represents templates to generate texts from models

func NewTemplate

func NewTemplate() *Template

NewTemplate creates a template model instance

func (*Template) GetContainerForMigration

func (receiver *Template) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

type TemplateArgument

type TemplateArgument struct {
	Base
	ID           int       `json:"id" yaml:"id" gorm:"primary_key;auto_increment"`
	TemplateID   int       `json:"template_id" yaml:"template_id" gorm:"unique_index:template_id_name" sql:"type:integer references templates(id)"`
	Template     *Template `json:"template" yaml:"template" gorm:"ForeignKey:TemplateID" validate:"omitempty,dive"`
	Name         string    `json:"name" yaml:"name" gorm:"unique_index:template_id_name" validate:"required"`
	Description  string    `json:"description" yaml:"description" form:"description" sql:"type:text"`
	Type         string    `json:"type" yaml:"type" validate:"oneof=int float bool string"`
	DefaultValue string    `json:"default_value" yaml:"default_value" validate:"required"`
	ToBeDeleted  bool      `json:"to_be_deleted,omitempty" yaml:"to_be_deleted,omitempty" sql:"-"`
}

TemplateArgument is the model class what represents model-independent arguments used in templates

func NewTemplateArgument

func NewTemplateArgument() *TemplateArgument

NewTemplateArgument creates a template argument model instance

func (*TemplateArgument) DoAfterDBMigration

func (receiver *TemplateArgument) DoAfterDBMigration(db *gorm.DB) error

DoAfterDBMigration execute initialization process after DB migration

func (*TemplateArgument) GetContainerForMigration

func (receiver *TemplateArgument) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

type TemplateGeneration

type TemplateGeneration struct {
	Base
}

TemplateGeneration is the model class what represents template generation

func NewTemplateGeneration

func NewTemplateGeneration() *TemplateGeneration

NewTemplateGeneration creates a template generation model instance

func (*TemplateGeneration) GenerateTemplate

func (receiver *TemplateGeneration) GenerateTemplate(db *gorm.DB, parameters gin.Params, urlValues url.Values) (interface{}, error)

GenerateTemplate generates text data based on registered templates parameters include either id or name actual parameters for template arguments must be included in urlValues as shaped like q[...]=...

func (*TemplateGeneration) GetContainerForMigration

func (receiver *TemplateGeneration) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*TemplateGeneration) GetSingle

func (receiver *TemplateGeneration) GetSingle(_ extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, _ string) (interface{}, error)

GetSingle generates text data based on registered templates parameters must be given as p[...]=...

type TemplateRaw

type TemplateRaw struct {
	Base
}

TemplateRaw is the model class what represents raw template

func NewTemplateRaw

func NewTemplateRaw() *TemplateRaw

NewTemplateRaw creates a template raw model instance

func (*TemplateRaw) GetContainerForMigration

func (receiver *TemplateRaw) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*TemplateRaw) GetSingle

func (receiver *TemplateRaw) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

type URLAlias

type URLAlias struct {
	Base
}

URLAlias is the model class what represents urlAlias to execute something

func NewURLAlias

func NewURLAlias() *URLAlias

NewURLAlias creates a urlAlias model instance

func (*URLAlias) GetContainerForMigration

func (receiver *URLAlias) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

type URLAliasDefinition

type URLAliasDefinition struct {
	Base
	Name    string                             `json:"name" yaml:"name" gorm:"primary_key" validate:"required"`
	From    string                             `json:"from" yaml:"from" validate:"required"`
	To      string                             `json:"to" yaml:"to" validate:"required"`
	Query   string                             `json:"query" yaml:"query"`
	Methods []*URLAliasMethodURLTypeDefinition `json:"methods" yaml:"methods" validate:"required,dive"`
}

URLAliasDefinition is the model class what represents url alias definitions

func NewURLAliasDefinition

func NewURLAliasDefinition() *URLAliasDefinition

NewURLAliasDefinition creates a template raw model instance

func (*URLAliasDefinition) Create

func (receiver *URLAliasDefinition) Create(_ extension.Model, _ *gorm.DB, _ gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*URLAliasDefinition) GetContainerForMigration

func (receiver *URLAliasDefinition) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*URLAliasDefinition) GetCount

func (receiver *URLAliasDefinition) GetCount(_ extension.Model, _ *gorm.DB) (int, error)

GetCount returns the record count under current db conditions

func (*URLAliasDefinition) GetMulti

func (receiver *URLAliasDefinition) GetMulti(_ extension.Model, _ *gorm.DB, _ gin.Params, _ url.Values, _ string) (interface{}, error)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*URLAliasDefinition) GetSingle

func (receiver *URLAliasDefinition) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

type URLAliasMethodURLTypeDefinition

type URLAliasMethodURLTypeDefinition struct {
	Base
	Method        string `json:"method" yaml:"method" validate:"required,oneof=GET POST PUT DELETE PATCH OPTIONS"`
	TargetURLType string `json:"target_url_type" yaml:"target_url_type" validate:"required,oneof=single multi"`
	Accept        string `json:"accept" yaml:"accept"`
	AcceptCharset string `json:"accept_charset" yaml:"accept_charset"`
}

URLAliasMethodURLTypeDefinition is the model class what represents url alias method-urltype definition

func NewURLAliasMethodURLTypeDefinition

func NewURLAliasMethodURLTypeDefinition() *URLAliasMethodURLTypeDefinition

NewURLAliasMethodURLTypeDefinition creates a template raw model instance

func (*URLAliasMethodURLTypeDefinition) GetContainerForMigration

func (receiver *URLAliasMethodURLTypeDefinition) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

type UserDefinedManyToManyAssociationModel

type UserDefinedManyToManyAssociationModel struct {
	UserDefinedModel
	// contains filtered or unexported fields
}

UserDefinedManyToManyAssociationModel is the model class what represents many to many association between models

func NewUserDefinedManyToManyAssociationModel

func NewUserDefinedManyToManyAssociationModel() *UserDefinedManyToManyAssociationModel

NewUserDefinedManyToManyAssociationModel creates an user defined many to many association model instance

func (*UserDefinedManyToManyAssociationModel) Delete

func (receiver *UserDefinedManyToManyAssociationModel) Delete(model extension.Model, db *gorm.DB, parameters gin.Params, _ url.Values) error

Delete corresponds HTTP DELETE message and handles a request for a single resource to delete the specific information

func (*UserDefinedManyToManyAssociationModel) GetLeftResourceKeyName

func (receiver *UserDefinedManyToManyAssociationModel) GetLeftResourceKeyName() string

GetLeftResourceKeyName returns its parent resource key name

func (*UserDefinedManyToManyAssociationModel) GetLeftResourceName

func (receiver *UserDefinedManyToManyAssociationModel) GetLeftResourceName() string

GetLeftResourceName returns its parent resource name

func (*UserDefinedManyToManyAssociationModel) GetMulti

func (receiver *UserDefinedManyToManyAssociationModel) GetMulti(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*UserDefinedManyToManyAssociationModel) GetRightResourceKeyName

func (receiver *UserDefinedManyToManyAssociationModel) GetRightResourceKeyName() string

GetRightResourceKeyName returns its child resource name

func (*UserDefinedManyToManyAssociationModel) GetRightResourceName

func (receiver *UserDefinedManyToManyAssociationModel) GetRightResourceName() string

GetRightResourceName returns its child resource name

type UserDefinedModel

type UserDefinedModel struct {
	Base
	// contains filtered or unexported fields
}

UserDefinedModel is the model class what handles user defined models Todo: Note that current Go implementation, reflect.StructOf does not generate wrapper methods to embedded structure Todo: therefore, methods like BeforeSave do not work.

func NewUserDefinedModel

func NewUserDefinedModel() *UserDefinedModel

NewUserDefinedModel creates an user defined model instance

func (*UserDefinedModel) DeleteFromDesign

func (receiver *UserDefinedModel) DeleteFromDesign(model extension.Model, db *gorm.DB) error

DeleteFromDesign deletes the model related to this model in db

func (*UserDefinedModel) DoAfterDBMigration

func (receiver *UserDefinedModel) DoAfterDBMigration(db *gorm.DB) error

DoAfterDBMigration execute initialization process after DB migration

func (*UserDefinedModel) DoBeforeDBMigration

func (receiver *UserDefinedModel) DoBeforeDBMigration(db *gorm.DB) error

DoBeforeDBMigration execute initialization process before DB migration

func (*UserDefinedModel) ExtractFromDesign

func (receiver *UserDefinedModel) ExtractFromDesign(model extension.Model, db *gorm.DB) (string, interface{}, error)

ExtractFromDesign extracts the model related to this model from db

func (*UserDefinedModel) GenerateTableName

func (receiver *UserDefinedModel) GenerateTableName(_ extension.Model, _ *gorm.DB) string

GenerateTableName generates its resource/table name in URL/DB

func (*UserDefinedModel) GetContainerForMigration

func (receiver *UserDefinedModel) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*UserDefinedModel) GetResourceName

func (receiver *UserDefinedModel) GetResourceName(_ extension.Model) (string, error)

GetResourceName returns its resource/table name in URL/DB

func (*UserDefinedModel) GetStructFields

func (receiver *UserDefinedModel) GetStructFields(model extension.Model) []reflect.StructField

GetStructFields returns its struct fields used to create containers

func (*UserDefinedModel) GetTypeName

func (receiver *UserDefinedModel) GetTypeName(_ extension.Model) string

GetTypeName returns its struct type name

func (*UserDefinedModel) IsControllerEnabled

func (receiver *UserDefinedModel) IsControllerEnabled() bool

IsControllerEnabled returns if the correspond controller should be generated or registered

func (*UserDefinedModel) ToBeMigrated

func (receiver *UserDefinedModel) ToBeMigrated() bool

ToBeMigrated returns if it should be migrated or not

type UserDefinedModelDefinition

type UserDefinedModelDefinition struct {
	Base
	TypeName                    string                             `json:"type_name" yaml:"type_name" gorm:"primary_key" validate:"required"`
	ResourceName                string                             `json:"resource_name" yaml:"resource_name" validate:"required"`
	ToBeMigrated                bool                               `json:"to_be_migrated" yaml:"to_be_migrated"`
	IsControllerEnabled         bool                               `json:"is_controller_enabled" yaml:"is_controller_enabled"`
	SQLBeforeMigration          []string                           `json:"sql_before_migration" yaml:"sql_before_migration"`
	SQLAfterMigration           []string                           `json:"sql_after_migration" yaml:"sql_after_migration"`
	SQLWhereForDesignExtraction []string                           `json:"sql_where_for_design_extraction" yaml:"sql_where_for_design_extraction"`
	SQLWhereForDesignDeletion   []string                           `json:"sql_where_for_design_deletion" yaml:"sql_where_for_design_deletion"`
	IsManyToManyAssociation     bool                               `json:"is_many_to_many_association" yaml:"is_many_to_many_association"`
	IsDesignAccessDisabled      bool                               `json:"is_design_access_disabled" yaml:"is_design_access_disabled"`
	Fields                      []*UserDefinedModelFieldDefinition `json:"fields" yaml:"fields" validate:"gt=0,dive"`
}

UserDefinedModelDefinition is the model class what represents user defined model

func NewUserDefinedModelDefinition

func NewUserDefinedModelDefinition() *UserDefinedModelDefinition

NewUserDefinedModelDefinition creates a template raw model instance

func (*UserDefinedModelDefinition) Create

func (receiver *UserDefinedModelDefinition) Create(model extension.Model, db *gorm.DB, _ gin.Params, _ url.Values, inputContainer interface{}) (interface{}, error)

Create corresponds HTTP POST message and handles a request for multi resource to create a new information

func (*UserDefinedModelDefinition) GetContainerForMigration

func (receiver *UserDefinedModelDefinition) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

func (*UserDefinedModelDefinition) GetCount

func (receiver *UserDefinedModelDefinition) GetCount(_ extension.Model, _ *gorm.DB) (int, error)

GetCount returns the record count under current db conditions

func (*UserDefinedModelDefinition) GetMulti

func (receiver *UserDefinedModelDefinition) GetMulti(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetMulti corresponds HTTP GET message and handles a request for multi resource to get the list of information

func (*UserDefinedModelDefinition) GetSingle

func (receiver *UserDefinedModelDefinition) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error)

GetSingle corresponds HTTP GET message and handles a request for a single resource to get the information

type UserDefinedModelFieldDefinition

type UserDefinedModelFieldDefinition struct {
	Base
	Name     string `json:"name" yaml:"name" gorm:"primary_key" validate:"required"`
	Tag      string `json:"tag" yaml:"tag"`
	TypeName string `json:"type_name" yaml:"type_name" validate:"required"`
	IsSlice  bool   `json:"is_slice" yaml:"is_slice"`
}

UserDefinedModelFieldDefinition is the model class what represents user defined model field definition

func NewUserDefinedModelFieldDefinition

func NewUserDefinedModelFieldDefinition() *UserDefinedModelFieldDefinition

NewUserDefinedModelFieldDefinition creates a template raw model instance

func (*UserDefinedModelFieldDefinition) GetContainerForMigration

func (receiver *UserDefinedModelFieldDefinition) GetContainerForMigration() (interface{}, error)

GetContainerForMigration returns its container for migration, if no need to be migrated, just return null

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL