field

package
v0.0.0-...-35e313c Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringTypeID  = 1
	IntegerTypeID = 2
	EmailTypeID   = 3
	BooleanTypeID = 4
)
View Source
const (
	StringType   = "STRING"
	IntegerType  = "INTEGER"
	EmailType    = "EMAIL"
	BooleanType  = "BOOLEAN"
	DateTimeType = "DATETIME"
)

data types and default values

View Source
const STYPE string = "Fields"

STYPE type of Fields module

View Source
const Type string = "Field"

Type of Model

Variables

View Source
var ErrFieldNotFound = errors.New("field not found")

ErrFieldNotFound is to be returned where field is not found

Functions

func Contains

func Contains(fieldType string) bool

Contains checks whether given data type is supported

Types

type Field

type Field struct {
	ContainerID container.ID `json:"-" db:"CONTAINER_ID,omitempty"`
	ID          ID           `json:"_id,omitempty" db:"ID,omitempty"`
	Name        string       `json:"name,omitempty" db:"NAME,omitempty"`
	Type        string       `json:"type,omitempty" db:"TYPE,omitempty"`
	Encrypted   uint8        `json:"encrypted,omitempty" db:"ENCRYPTED,omitempty"`
	Stream      uint8        `json:"stream,omitempty" db:"STREAM,omitempty"`
	Created     time.Time    `json:"created,omitempty" db:"CREATED,omitempty"`
	Updated     time.Time    `json:"last_updated,omitempty" db:"UPDATED,omitempty"`
}

Field field type

func GetFromPersistenceByID

func GetFromPersistenceByID(tx sqlbuilder.Tx, SD *datastore.DataStore, fieldID ID) (*Field, error)

GetFromPersistenceByID get the field using its ID

type Fields

type Fields []*Field

Fields list of Field

func GetFromPersistence

func GetFromPersistence(tx sqlbuilder.Tx, SD *datastore.DataStore) (Fields, error)

GetFromPersistence fields of the object

type FieldsByName

type FieldsByName map[string]*Field

FieldsByName : Map of fields by its name

func FieldsToMapByName

func FieldsToMapByName(fields Fields) FieldsByName

FieldsToMapByName convert list of fields to map of fields by its name

type ID

type ID string

ID of Field

type Model

type Model struct {
	DataStore *datastore.DataStore
}

func (Model) ByID

func (m Model) ByID(contID container.ID, fieldID ID) (*Field, string, int, error)

ByID #

func (Model) Create

func (m Model) Create(field *Field) (string, string, int, error)

Create #

func (Model) Delete

func (m Model) Delete(contID container.ID, fieldID ID) (ID, string, int, error)

Delete #

func (Model) Get

func (m Model) Get(contID container.ID) (Fields, string, int, error)

Get #

func (Model) UpdateName

func (m Model) UpdateName(contID container.ID, fieldID ID, name string) (string, int, error)

UpdateName #

Jump to

Keyboard shortcuts

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