annotation

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package annotation contains constants used as mapping annotations.

Index

Constants

View Source
const (
	// Flags is the neuron model field's tag used for defining field flags.
	Flags = "flags"
	// Hidden defines that the field should be hidden from marshaling.
	Hidden = "hidden"
	// ISO8601 sets the time field format to ISO8601.
	ISO8601 = "iso8601"
	// OmitEmpty allows to omit marshaling this field if it's zero-value.
	OmitEmpty = "omitempty"
	// I18n defines that this field is internationalization ready.
	I18n = "i18n"
	// NoFilter is the neuron model field's flag that disallows to query filter for given field.
	NoFilter = "nofilter"
	// NotSortable is the neuron model field's flag that disallows to query sort on given field.
	NotSortable = "nosort"
	// CreatedAt is the neuron model field's flag that defines CreatedAt field.
	CreatedAt = "created_at"
	// DeletedAt is the neuron model field's flag that defines DeletedAt field.
	DeletedAt = "deleted_at"
	// UpdatedAt is the neuron model field's flag that defines UpdatedAt field.
	UpdatedAt = "updated_at"
)

Model field's flag tags.

View Source
const (
	Primary      = "primary"
	PrimaryFull  = "primary_key"
	PrimaryFullS = "primarykey"
	ID           = "id"
	PrimaryShort = "pk"
)

Model primary field annotation tags.

View Source
const (
	Attribute     = "attr"
	AttributeFull = "attribute"
)

Model attribute field annotation tags.

View Source
const (
	Relation     = "relation"
	RelationFull = "relationship"
)

Model relationship field annotation tags.

View Source
const (
	// Name is the neuron model field's tag used to set the NeuronName.
	Name = "name"
	// FieldType is the neuron model field's tag used to set the neuron field type.
	FieldType = "type"
)
View Source
const (
	ForeignKey      = "foreign"
	ForeignKeyFull  = "foreign_key"
	ForeignKeyFullS = "foreignkey"
	ForeignKeyShort = "fk"
)

Model foreign key field annotation tags.

View Source
const (
	// FilterKey is the model's filter key field tag.
	FilterKey = "filterkey"
	// NestedField is the model field's neuron tag that defines if the field type is of nested type.
	NestedField = "nested"
)
View Source
const (
	OnCreate = "on_create"
	OnPatch  = "on_patch"
	OnDelete = "on_delete"
	Order    = "order"
	OnError  = "on_error"
	OnChange = "on_change"

	RelationRestrict = "restrict"
	RelationNoAction = "no-action"
	RelationCascade  = "cascade"
	RelationSetNull  = "set-null"

	FailOnError     = "fail"
	ContinueOnError = "continue"

	Default = "default"
)

Relation strategy relationship fields tags.

View Source
const (
	// Separator is the symbol used to separate the sub-tags for given neuron tag.
	// Example: `neuron:"many2many=foreign,related_foreign"`
	//										 ^
	Separator = ","

	// TagSeparator is the symbol used to separate neuron based tags.
	// Example: `neuron:"type=attr;name=custom_name"`
	//								 ^
	TagSeparator = ";"
	// TagEqual is the symbol used to set the values for the for given neuron tag.
	// Example: `neuron:"type=attr"`
	//						    ^
	TagEqual = '='

	// NestedSeparator is the symbol used as a separator for the nested fields access.
	// Used in included or sort fields.
	// Example: field.relationship.
	// 				    ^
	NestedSeparator = "."

	// OpenedBracket is the symbol used in filtering system
	// which is used to open new logical part.
	// Example: filter[collection][name][$operator]
	//				  ^           ^     ^
	OpenedBracket = '['

	// ClosedBracket is the symbol used in filtering system
	// which is used to open new logical part.
	// Example: filter[collection][name][$operator]
	//				  			 ^     ^          ^
	ClosedBracket = ']'
)

Separators and other symbols.

View Source
const ClientID = "client-id"

ClientID states if the primary field could be defined by the client.

View Source
const Language = "lang"

Language defines the attribute field that contains the language tag. for i18n.

View Source
const ManyToMany = "many2many"

ManyToMany is the neuron relationship field tag that states this relationship is of type many2many.

View Source
const Neuron = "neuron"

Neuron is the root struct field annotation tag.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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