models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FDefault   fieldFlag = iota
	FOmitempty fieldFlag = 1 << (iota - 1)
	FIso8601
	FI18n
	FNoFilter
	FLanguage
	FHidden
	FSortable
	FClientID

	// field type
	FTime
	FMap
	FPtr
	FArray
	FSlice
	FBasePtr

	FNestedStruct
	FNestedField
)

Variables

View Source
var (
	ErrModelNotMapped = errors.New("Unmapped model provided.")
)

Functions

func FieldAllowClientID

func FieldAllowClientID(s *StructField) bool

FieldAllowClientID checks if the given field allow ClientID

func FieldBaseType

func FieldBaseType(s *StructField) reflect.Type

FieldBaseType returns the base 'reflect.Type' for the provided field. The base is the lowest possible dereference of the field's type.

func FieldInitCheckFieldType

func FieldInitCheckFieldType(s *StructField) error

FieldInitCheckFieldType initializes StructField type

func FieldIsArray

func FieldIsArray(s *StructField) bool

FieldIsArray checks if the field is an array

func FieldIsBasePtr

func FieldIsBasePtr(s *StructField) bool

FieldIsBasePtr checks if the field has a pointer type in the base

func FieldIsFlag

func FieldIsFlag(s *StructField) bool

FieldIsFlag checks wether the field has a language flag

func FieldIsHidden

func FieldIsHidden(s *StructField) bool

FieldIsHidden checks if the field has a hidden flag

func FieldIsI18n

func FieldIsI18n(s *StructField) bool

FieldIsI18n checks wether the field has a i18n flag

func FieldIsIso8601

func FieldIsIso8601(s *StructField) bool

FieldIsIso8601 checks wether the field uses FIso8601 flag

func FieldIsMap

func FieldIsMap(s *StructField) bool

FieldIsMap checks if the field has a fMap flag

func FieldIsNestedField

func FieldIsNestedField(s *StructField) bool

FieldIsNestedField checks if the field is not defined within ModelStruct

func FieldIsNestedStruct

func FieldIsNestedStruct(s *StructField) bool

FieldIsNestedStruct checks if the field is a nested structure

func FieldIsNoFilter

func FieldIsNoFilter(s *StructField) bool

FieldIsNoFilter checks wether the field uses no filter flag

func FieldIsOmitEmpty

func FieldIsOmitEmpty(s *StructField) bool

FieldIsOmitEmpty checks wether the field uses OmitEmpty flag

func FieldIsPtr

func FieldIsPtr(s *StructField) bool

FieldIsPtr checks if the field is a pointer

func FieldIsPtrTime

func FieldIsPtrTime(s *StructField) bool

FieldIsPtrTime checks wether the field is a base ptr time flag

func FieldIsSlice

func FieldIsSlice(s *StructField) bool

FieldIsSlice checks if the field is a slice based

func FieldIsSortable

func FieldIsSortable(s *StructField) bool

FieldIsSortable checks if the field has a sortable flag

func FieldIsTime

func FieldIsTime(s *StructField) bool

FieldIsTime checks wether the field uses time flag

func FieldIsZeroValue

func FieldIsZeroValue(s *StructField, fieldValue interface{}) bool

FieldIsZeroValue checks if the provided field has Zero value.

func FieldSetFieldKind

func FieldSetFieldKind(s *StructField, fieldKind FieldKind)

FieldSetFieldKind sets the field's kind

func FieldSetFlag

func FieldSetFlag(s *StructField, flag fieldFlag)

FieldSetFlag sets the provided flag for the structField

func FieldSetNested

func FieldSetNested(s *StructField, nested *NestedStruct)

FieldSetNested sets the structFields nested field

func FieldSetRelatedType

func FieldSetRelatedType(sField *StructField) error

FieldSetRelatedType sets the related type for the provided structField

func FieldSetRelationship

func FieldSetRelationship(s *StructField, r *Relationship)

FieldSetRelationship sets the relationship for the given field

func FieldTagValues

func FieldTagValues(s *StructField, tag string) (url.Values, error)

FieldTagValues gets field's tag values

func FieldsRelatedModelType

func FieldsRelatedModelType(s *StructField) reflect.Type

FieldsRelatedModelType gets the relationship's model type Returns nil if the structfield is not a relationship

func FieldsSetApiName

func FieldsSetApiName(s *StructField, apiName string)

FieldsSetApiName sets the field's apiName

func NestedStructFields

func NestedStructFields(n *NestedStruct) map[string]*NestedField

NestedStructFields gets the nested struct fields

func NestedStructMarshalType

func NestedStructMarshalType(n *NestedStruct) reflect.Type

NestedStructMarshalType returns the marshal type for the provided nested struct

func NestedStructSetMarshalType

func NestedStructSetMarshalType(n *NestedStruct, mType reflect.Type)

NestedStructSetMarshalType sets the nested structs marshal type

func NestedStructSetSubfield

func NestedStructSetSubfield(s *NestedStruct, n *NestedField)

NestedStructSetSubfield sets the subfield for the nestedStructr

func NestedStructType

func NestedStructType(n *NestedStruct) reflect.Type

NestedStructType returns the reflect.Type of the nestedStruct

func RelationshipSetBackrefField

func RelationshipSetBackrefField(r *Relationship, backref *StructField)

RelationshipSetBackrefField sets the backreference field for the relationship

func RelationshipSetBackrefFieldName

func RelationshipSetBackrefFieldName(r *Relationship, backrefName string)

RelationshipSetBackrefFieldName sets the backreference fieldname

func StructAppendField

func StructAppendField(m *ModelStruct, field *StructField)

StructAppendField appends the field to the fieldset for the given model struct

func StructAppendI18n

func StructAppendI18n(m *ModelStruct, f *StructField)

StructI18n returns i18n struct field for given model.

func StructCollectionUrlIndex

func StructCollectionUrlIndex(m *ModelStruct) int

StructCollectionUrlIndex returns index for the collectionUrl

func StructFlags

func StructFlags(m *ModelStruct) *flags.Container

StructFlags return preset flags for the given model

func StructIsEqual

func StructIsEqual(first, second *ModelStruct) bool

StructIsEqual checks if ModelStructs are equal

func StructSetAttr

func StructSetAttr(m *ModelStruct, attr *StructField)

StructSetAttr sets the attribute field for the provided model

func StructSetBelongsToForeigns

func StructSetBelongsToForeigns(m *ModelStruct, v reflect.Value) error

func StructSetBelongsToRelationWithFields

func StructSetBelongsToRelationWithFields(m *ModelStruct, v reflect.Value, fields ...*StructField) error

StructSetBelongsToRelationWithFields sets the value to the Relationship value

func StructSetFilterKey

func StructSetFilterKey(m *ModelStruct, fk *StructField)

StructSetFilterKey sets the filter key for the model struct

func StructSetForeignKey

func StructSetForeignKey(m *ModelStruct, fk *StructField)

StructSetForeignKey sets the foreign key for the model struct

func StructSetLanguage

func StructSetLanguage(m *ModelStruct, f *StructField)

StructSetLanguage sets the language field for given model

func StructSetPrimary

func StructSetPrimary(m *ModelStruct, primary *StructField)

StructSetPrimary sets the primary field for the model

func StructSetRelField

func StructSetRelField(m *ModelStruct, relField *StructField)

StructSetRelField sets the relationship field for the model

func StructSetType

func StructSetType(m *ModelStruct, tp reflect.Type)

StructSetType sets the type for the model struct

func StructSetUrl

func StructSetUrl(m *ModelStruct, url string) error

StructSetUrl sets the ModelStruct's url value

Types

type Collectioner

type Collectioner interface {
	CollectionName() string
}

type FieldKind

type FieldKind int

FieldKind is an enum that defines the following field type (i.e. 'primary', 'attribute')

const (
	// UnknownType is the unsupported unknown type of the struct field
	UnknownType FieldKind = iota
	// KindPrimary is a 'primary' field
	KindPrimary

	// KindAttribute is an 'attribute' field
	KindAttribute

	// KindClientID is id set by client
	KindClientID

	// KindRelationshipSingle is a 'relationship' with single object
	KindRelationshipSingle

	// KindRelationshipMultiple is a 'relationship' with multiple objects
	KindRelationshipMultiple

	// KindForeignKey is the field type that is responsible for the relationships
	KindForeignKey

	// KindFilterKey is the field that is used only for special case filtering
	KindFilterKey

	// KindNested is the field that is nested within another structfield
	KindNested
)

Enums for the field kind

func (FieldKind) String

func (f FieldKind) String() string

type ModelMap

type ModelMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ModelMap contains mapped models ( as reflect.Type ) to its ModelStruct representation. Allow concurrent safe gets and sets to the map.

func NewModelMap

func NewModelMap() *ModelMap

NewModelMap creates new model map

func (*ModelMap) Get

func (m *ModelMap) Get(model reflect.Type) *ModelStruct

Get is concurrent safe getter of model structs.

func (*ModelMap) GetByCollection

func (m *ModelMap) GetByCollection(collection string) *ModelStruct

func (*ModelMap) Models

func (m *ModelMap) Models() []*ModelStruct

Models returns all models set within given model map

func (*ModelMap) Set

func (m *ModelMap) Set(value *ModelStruct) error

Set sets the modelstruct for given map If the model already exists the function returns an error

func (*ModelMap) SetByCollection

func (m *ModelMap) SetByCollection(ms *ModelStruct)

SetByCollection sets the model by it's collection

type ModelSchemas

type ModelSchemas struct {

	// Flags contains the config flags for given schema
	Flags *flags.Container

	// NamerFunc is the function required for naming convenction
	NamerFunc namer.Namer
	// contains filtered or unexported fields
}

ModelSchemas is a struct containing all the schemas mapped with it's model's and names

func NewModelSchemas

func NewModelSchemas(
	namerFunc namer.Namer,
	c *config.Controller,
	flgs *flags.Container,
) (*ModelSchemas, error)

NewModelSchemas create new ModelSchemas based on the config

func (*ModelSchemas) ComputeNestedIncludedCount

func (m *ModelSchemas) ComputeNestedIncludedCount(limit int)

ComputeNestedIncludedCount computes the limits for the nested included count for each model in each schema

func (*ModelSchemas) DefaultSchema

func (m *ModelSchemas) DefaultSchema() *Schema

DefaultSchema returns default schema for give models

func (*ModelSchemas) GetModelStruct

func (m *ModelSchemas) GetModelStruct(model interface{}) (*ModelStruct, error)

GetModelStruct gets the model from the model schemas

func (*ModelSchemas) ModelByType

func (m *ModelSchemas) ModelByType(t reflect.Type) (*ModelStruct, error)

ModelByType returns the model on the base of the provided model type

func (*ModelSchemas) RegisterModels

func (m *ModelSchemas) RegisterModels(
	models ...interface{},
) error

RegisterModels registers the model within the schemas container

func (*ModelSchemas) RegisterModelsRecursively

func (m *ModelSchemas) RegisterModelsRecursively(models ...interface{}) error

RegisterModelsRecursively registers the models and it's related models into the model schemas

func (*ModelSchemas) RegisterSchemaModels

func (m *ModelSchemas) RegisterSchemaModels(schemaName string, models ...interface{}) error

RegisterSchemaModels registers models for provided schema

func (*ModelSchemas) Schema

func (m *ModelSchemas) Schema(schemaName string) (*Schema, bool)

Schema returns schema on the base of schemaName

func (*ModelSchemas) SchemaByType

func (m *ModelSchemas) SchemaByType(t reflect.Type) (*Schema, error)

SchemaByType returns schema by the type provided in the arguments

func (*ModelSchemas) Schemas

func (m *ModelSchemas) Schemas() []*Schema

Schemas returns all registered schemas

type ModelStruct

type ModelStruct struct {
	// contains filtered or unexported fields
}

ModelStruct is a computed representation of the jsonapi models. Contain information about the model like the collection type, distinction of the field types (primary, attributes, relationships).

func BuildModelStruct

func BuildModelStruct(
	model interface{},
	namerFunc namer.Namer,
	flgs *flags.Container,
) (*ModelStruct, error)

BuildModelStruct builds the model struct for the provided model with the given namer function

func FieldsRelatedModelStruct

func FieldsRelatedModelStruct(s *StructField) *ModelStruct

FieldsRelatedModelStruct gets the ModelStruct of the field Type. Returns nil if the structField is not a relationship

func FieldsStruct

func FieldsStruct(s *StructField) *ModelStruct

FieldsStruct returns field's modelStruct

func RelationshipMStruct

func RelationshipMStruct(r *Relationship) *ModelStruct

RelationshipMStruct returns relationship's modelstruc

func (*ModelStruct) AllowClientID

func (m *ModelStruct) AllowClientID() bool

AllowClientID returns boolean if the client settable id is allowed

func (*ModelStruct) Attribute

func (m *ModelStruct) Attribute(field string) (*StructField, bool)

Attribute returns the attribute field for given string

func (*ModelStruct) CheckField

func (m *ModelStruct) CheckField(field string) (sField *StructField, err *aerrors.ApiError)

CheckField checks if the field exists within given modelstruct

func (ModelStruct) Collection

func (m ModelStruct) Collection() string

Collection returns model's collection type

func (*ModelStruct) Config

func (m *ModelStruct) Config() *config.ModelConfig

Config returns config for the model

func (*ModelStruct) FieldCount

func (m *ModelStruct) FieldCount() int

FieldCount gets the field count for given model

func (*ModelStruct) Fields

func (m *ModelStruct) Fields() []*StructField

Fields returns model's fields

func (*ModelStruct) FilterKey

func (m *ModelStruct) FilterKey(fk string) (*StructField, bool)

FilterKey return model's fitler key

func (*ModelStruct) Flags

func (m *ModelStruct) Flags() *flags.Container

Flags return model's flags

func (*ModelStruct) ForeignKey

func (m *ModelStruct) ForeignKey(fk string) (*StructField, bool)

ForeignKey return model's foreign key

func (*ModelStruct) ForeignKeys

func (m *ModelStruct) ForeignKeys() (fks []*StructField)

ForeignKeys return ForeignKey Structfields for the given model

func (ModelStruct) ID

func (m ModelStruct) ID() int

ID returns model structs index number

func (*ModelStruct) IsAfterLister

func (m *ModelStruct) IsAfterLister() bool

IsAfterLister returns the boolean if the given model implements AfterListerR interface

func (*ModelStruct) IsBeforeLister

func (m *ModelStruct) IsBeforeLister() bool

IsBeforeLister returns the boolean if the given model implements BeforeListerR interface

func (*ModelStruct) LanguageField

func (m *ModelStruct) LanguageField() *StructField

LanguageField returns model's Language

func (*ModelStruct) MaxIncludedCount

func (m *ModelStruct) MaxIncludedCount() int

MaxIncludedCount gets the maximum included count prepared for given model

func (*ModelStruct) NewReflectValueMany

func (m *ModelStruct) NewReflectValueMany() reflect.Value

NewReflectValueMany creates the *[]*m.Type reflect.Value

func (*ModelStruct) NewReflectValueSingle

func (m *ModelStruct) NewReflectValueSingle() reflect.Value

NewReflectValueSingle creates and returns a model's new single value

func (*ModelStruct) NewValueMany

func (m *ModelStruct) NewValueMany() interface{}

NewValueMany creates and returns a model's new slice of pointers to values

func (*ModelStruct) NewValueSingle

func (m *ModelStruct) NewValueSingle() interface{}

NewValueSingle creates and returns new value for the given model type

func (*ModelStruct) PrimaryField

func (m *ModelStruct) PrimaryField() *StructField

PrimaryField returns model's primary struct field

func (*ModelStruct) PrimaryValues

func (m *ModelStruct) PrimaryValues(value reflect.Value) (primaries reflect.Value, err error)

PrimaryValues gets the primary values for the provided value

func (*ModelStruct) RelationshipField

func (m *ModelStruct) RelationshipField(field string) (*StructField, bool)

RelationshipField returns the StructField for given raw field

func (*ModelStruct) RelationshipFields

func (m *ModelStruct) RelationshipFields() (rels []*StructField)

RelationshipFields return structfields that are matched as relatinoships

func (*ModelStruct) RepositoryName

func (m *ModelStruct) RepositoryName() string

RepositoryName returns the repository name for given model

func (*ModelStruct) SchemaName

func (m *ModelStruct) SchemaName() string

SchemaName returns model's schema name

func (*ModelStruct) SetConfig

func (m *ModelStruct) SetConfig(cfg *config.ModelConfig) error

SetConfig sets the config for given ModelStruct

func (*ModelStruct) SetRepositoryName

func (m *ModelStruct) SetRepositoryName(repo string)

SetRepositoryName sets the repositoryName

func (*ModelStruct) SetSchemaName

func (m *ModelStruct) SetSchemaName(schema string)

SetSchemaName sets the schema name for the given model

func (*ModelStruct) SortScopeCount

func (m *ModelStruct) SortScopeCount() int

SortScopeCount returns the count of the sort fieldsb

func (*ModelStruct) StoreDelete

func (m *ModelStruct) StoreDelete(key string)

StoreDelete deletes the store's value at key

func (*ModelStruct) StoreGet

func (m *ModelStruct) StoreGet(key string) (interface{}, bool)

StoreGet gets the value from the store at the key: 'key'.

func (*ModelStruct) StoreSet

func (m *ModelStruct) StoreSet(key string, value interface{})

StoreSet sets into the store the value 'value' for given 'key'

func (*ModelStruct) StructFields

func (m *ModelStruct) StructFields() (fields []*StructField)

StructFields return all the StructFields used in the ModelStruct

func (ModelStruct) Type

func (m ModelStruct) Type() reflect.Type

Type returns model's reflect.Type

func (ModelStruct) UseI18n

func (m ModelStruct) UseI18n() bool

UseI18n returns the bool if the model struct uses i18n.

type NestedField

type NestedField struct {
	// contains filtered or unexported fields
}

NestedField is the field within the NestedStruct

func NestedStructSubField

func NestedStructSubField(n *NestedStruct, field string) (*NestedField, bool)

NestedStructSubField returns the NestedStruct subfield if exists.

func NewNestedField

func NewNestedField(
	root *NestedStruct,
	structFielder StructFielder,
	nField reflect.StructField,
) *NestedField

NewNestedField returns New NestedField

func (*NestedField) Self

func (n *NestedField) Self() *StructField

Self is the relation to it's struct field

func (*NestedField) SelfNested

func (n *NestedField) SelfNested() *NestedField

SelfNested returns the pointer to itself

func (*NestedField) StructField

func (n *NestedField) StructField() *StructField

StructField returns the structField

type NestedStruct

type NestedStruct struct {
	// contains filtered or unexported fields
}

NestedStruct is the field StructField that is composed from different abstraction then the basic data types. It may contain multiple fields *NestedFields

func FieldsNested

func FieldsNested(s *StructField) *NestedStruct

FieldsNested gets NestedStruct in the field

func NestedFieldRoot

func NestedFieldRoot(n *NestedField) *NestedStruct

NestedFieldRoot returns the root of the NestedField

func NewNestedStruct

func NewNestedStruct(t reflect.Type, structField StructFielder) *NestedStruct

NewNestedStruct returns new nested structure

func (*NestedStruct) Attr

func (n *NestedStruct) Attr() *StructField

Attr returns nested struct related attribute field

func (*NestedStruct) Fields

func (n *NestedStruct) Fields() map[string]*NestedField

Fields return nested fields for the given structure

func (*NestedStruct) StructField

func (n *NestedStruct) StructField() StructFielder

StructField returns nested structs related struct field

func (*NestedStruct) Type

func (n *NestedStruct) Type() reflect.Type

Type returns nested struct's reflect.Type

type NestedStructFielder

type NestedStructFielder interface {
	StructFielder
	SelfNested() *NestedField
}

type Relationship

type Relationship struct {
	// contains filtered or unexported fields
}

Relationship is the structure that uses

func FieldRelationship

func FieldRelationship(s *StructField) *Relationship

FieldRelationship returns the struct field relationship

func (*Relationship) BackreferenceField

func (r *Relationship) BackreferenceField() *StructField

BackreferenceField returns the field that is backrefereneced in relationships models

func (*Relationship) BackrefernceFieldName

func (r *Relationship) BackrefernceFieldName() string

BackreferenceFieldName returns relationships backrefernce field name

func (*Relationship) ForeignKey

func (r *Relationship) ForeignKey() *StructField

ForeignKey returns relationships foreign key

func (Relationship) IsManyToMany

func (r Relationship) IsManyToMany() bool

func (Relationship) IsToMany

func (r Relationship) IsToMany() bool

func (Relationship) IsToOne

func (r Relationship) IsToOne() bool

func (*Relationship) Kind

func (r *Relationship) Kind() RelationshipKind

Kind returns relationships kind

func (*Relationship) SetBackreferenceField

func (r *Relationship) SetBackreferenceField(s *StructField)

SetBackreferenceField sets the Backreference Field for the relationship

func (*Relationship) SetForeignKey

func (r *Relationship) SetForeignKey(s *StructField)

SetForeignKey sets foreign key structfield

func (*Relationship) SetKind

func (r *Relationship) SetKind(kind RelationshipKind)

SetKind sets the relationship kind

func (*Relationship) SetSync

func (r *Relationship) SetSync(b *bool)

SetSync sets the relationship sync

func (*Relationship) Struct

func (r *Relationship) Struct() *ModelStruct

Struct returns relationship model *ModelStruct

func (*Relationship) Sync

func (r *Relationship) Sync() *bool

Sync checks if the relationships syncs values with the repositories

type RelationshipKind

type RelationshipKind int

RelationshipKind is the enum of the Relationship kinds

const (
	RelUnknown RelationshipKind = iota
	RelBelongsTo
	RelHasOne
	RelHasMany
	RelMany2Many
)

func RelationshipGetKind

func RelationshipGetKind(r *Relationship) RelationshipKind

RelationshipGetKing returns relationship kind

func (RelationshipKind) String

func (r RelationshipKind) String() string

type RelationshipOption

type RelationshipOption int

RelationshipOption defines the option on how to treat the relationship

const (
	Restrict RelationshipOption = iota
	NoAction
	Cascade
	SetNull
)

type Schema

type Schema struct {

	// Name is the schema name for given models
	// - i.e. public models would have the name 'public'
	Name string
	// contains filtered or unexported fields
}

Schema is a container for the given

func (*Schema) Config

func (s *Schema) Config() *config.Schema

Config gets the config.Schema

func (*Schema) Model

func (s *Schema) Model(t reflect.Type) *ModelStruct

Model returns model for given type within the schema

func (*Schema) ModelByCollection

func (s *Schema) ModelByCollection(collection string) *ModelStruct

ModelByCollection returns ModelStruct on the base of provided collection name

func (*Schema) Models

func (s *Schema) Models() []*ModelStruct

Models returns all the models saved in the given schema

type SchemaNamer

type SchemaNamer interface {
	SchemaName() string
}

SchemaNamer is the interface that defines the model's Schema Name

type StructField

type StructField struct {
	// contains filtered or unexported fields
}

StructField represents a field structure with its json api parameters and model relationships.

func NestedFieldAttr

func NestedFieldAttr(n *NestedField) *StructField

NestedFieldAttr returns nested Fields Attribute

func NestedStructAttr

func NestedStructAttr(n *NestedStruct) *StructField

NestedStructAttr returns related attribute to the provided nested struct

func NewStructField

func NewStructField(
	refField reflect.StructField,
	mStruct *ModelStruct,
) *StructField

NewStructField is the creator function for the struct field

func RelationshipForeignKey

func RelationshipForeignKey(r *Relationship) *StructField

RelationshipForeignKey returns given relationship foreign key

func StructAllFields

func StructAllFields(m *ModelStruct) []*StructField

StructAllFields return all model's fields

func StructAttr

func StructAttr(m *ModelStruct, attr string) (*StructField, bool)

StructAttr returns attribute for the provided structField

func StructFieldByName

func StructFieldByName(m *ModelStruct, name string) *StructField

StructFieldByName returns field for provided name It matches both name and apiName

func StructFilterKeyField

func StructFilterKeyField(m *ModelStruct, fk string) (*StructField, bool)

StructFilterKeyField returns ModelStruct filterKey

func StructForeignKeyField

func StructForeignKeyField(m *ModelStruct, fk string) (*StructField, bool)

StructForeignKeyField returns ModelStruct foreign key field if exists

func StructPrimary

func StructPrimary(m *ModelStruct) *StructField

StructPrimary gets the primary field for the given model

func StructRelField

func StructRelField(m *ModelStruct, relField string) (*StructField, bool)

StructRelField returns ModelsStruct relationship field if exists

func (*StructField) ApiName

func (s *StructField) ApiName() string

ApiName returns the structFields ApiName

func (*StructField) FieldIndex

func (s *StructField) FieldIndex() []int

FieldIndex - gets the field index in the given model

func (*StructField) FieldKind

func (s *StructField) FieldKind() FieldKind

FieldKind returns structFields kind

func (*StructField) FieldName

func (s *StructField) FieldName() string

FieldName returns struct fields name

func (*StructField) FieldType

func (s *StructField) FieldType() reflect.Type

FieldType returns field's reflect.Type

func (*StructField) GetDereferencedType

func (s *StructField) GetDereferencedType() reflect.Type

GetDereferencedType returns structField dereferenced type

func (*StructField) IsArray

func (s *StructField) IsArray() bool

IsArray checks if the field is an array

func (*StructField) IsBasePtr

func (s *StructField) IsBasePtr() bool

IsBasePtr checks if the field has a pointer type in the base

func (*StructField) IsHidden

func (s *StructField) IsHidden() bool

IsHidden checks if the field has a hidden flag

func (*StructField) IsI18n

func (s *StructField) IsI18n() bool

IsI18n returns flag if the struct fields is an i18n field

func (*StructField) IsIso8601

func (s *StructField) IsIso8601() bool

IsIso8601 checks wether the field uses FIso8601 flag

func (*StructField) IsLanguage

func (s *StructField) IsLanguage() bool

IsLanguage checks wether the field is a language type field

func (*StructField) IsMap

func (s *StructField) IsMap() bool

IsMap checks if the field has a fMap flag

func (*StructField) IsNestedStruct

func (s *StructField) IsNestedStruct() bool

IsNestedStruct checks if the field is a nested structure

func (*StructField) IsOmitEmpty

func (s *StructField) IsOmitEmpty() bool

IsOmitEmpty checks if the given field has a omitempty flag

func (*StructField) IsPrimary

func (s *StructField) IsPrimary() bool

IsPrimary checks if the field is the primary field type

func (*StructField) IsPtr

func (s *StructField) IsPtr() bool

IsPtr checks if the field is a pointer

func (*StructField) IsRelationship

func (s *StructField) IsRelationship() bool

IsRelationship checks if given field is a relationship

func (*StructField) IsSlice

func (s *StructField) IsSlice() bool

IsSlice checks if the field is a slice based

func (*StructField) IsTime

func (s *StructField) IsTime() bool

IsTime checks wether the field uses time flag

func (*StructField) Name

func (s *StructField) Name() string

Name returns the StructFields Golang Name

func (*StructField) Nested

func (s *StructField) Nested() *NestedStruct

Nested returns nested field's structure

func (*StructField) ReflectField

func (s *StructField) ReflectField() reflect.StructField

ReflectField returns structs reflect.StructField

func (*StructField) Relationship

func (s *StructField) Relationship() *Relationship

Relationship returns StructField's Relationships

func (*StructField) Self

func (s *StructField) Self() *StructField

Self returns itself. Used in the nested fields. Implements Structfielder interface.

func (*StructField) SetRelatedModel

func (s *StructField) SetRelatedModel(relModel *ModelStruct)

SetRelatedModel sets the related model for the given struct field

func (*StructField) SetRelationship

func (s *StructField) SetRelationship(rel *Relationship)

SetRelationship sets the relationship value for the struct field

func (*StructField) StoreDelete

func (s *StructField) StoreDelete(key string)

StoreDelete deletes the store value at 'key'

func (*StructField) StoreGet

func (s *StructField) StoreGet(key string) (interface{}, bool)

StoreGet gets the value from the store at the key: 'key'.

func (*StructField) StoreSet

func (s *StructField) StoreSet(key string, value interface{})

StoreSet sets into the store the value 'value' for given 'key'

func (*StructField) Struct

func (s *StructField) Struct() *ModelStruct

Struct returns fields modelstruct

func (*StructField) TagValues

func (s *StructField) TagValues(tag string) (url.Values, error)

TagValues returns the url.Values for the specific tag

type StructFielder

type StructFielder interface {
	Self() *StructField
}

StructFielder is the interfaces used for getting the pointer to itself

Jump to

Keyboard shortcuts

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