model

package
v0.0.0-...-704dcf6 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	// Table name in database
	Table string

	// Fields definitions list
	Fields []field.Mapper
}

Base model with table common properties and fields definitions

func New

func New(optFuncs ...OptionFunc) Base

New base model instance constructor

func (Base) Flags

func (m Base) Flags() uint64

Flags method for Modifer interface satisfation

func (Base) GetModel

func (m Base) GetModel() *Base

GetModel base object

func (Base) GetPrimaryKey

func (m Base) GetPrimaryKey() field.Mapper

GetPrimaryKey returns this model primary key or nil if primary key not defined

func (Base) Modify

func (m Base) Modify(t token.Token) (token.Token, error)

Modify interface realization which calls decorated modificator

type Field

type Field struct {
	// Model mapper
	Model Mapper

	// field maper for associated model
	Field field.Mapper
}

Field contains both mappers for model and field

func (Field) Flags

func (f Field) Flags() uint64

Flags method for Modifer interface satisfation

func (Field) GetField

func (f Field) GetField() field.Mapper

GetField from model and field link object

func (Field) GetModel

func (f Field) GetModel() Mapper

GetModel from field and model link object

func (Field) Modify

func (f Field) Modify(t token.Token) (token.Token, error)

Modify interface realization which calls decorated modificator

type Mapper

type Mapper interface {
	// GetModel base object
	GetModel() *Base
}

Mapper interface to model properties

type OptionFunc

type OptionFunc func(*Base)

OptionFunc function uses to configure model properties object

func OptFields

func OptFields(fieldMappers ...field.Mapper) OptionFunc

OptFields list property configure

func OptTable

func OptTable(name string) OptionFunc

OptTable name property configure

Jump to

Keyboard shortcuts

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