fields

package
v0.0.0-...-b45a7ae Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package fields provides basic set of fields usable to define domain model

Index

Constants

View Source
const (
	CharFieldInfinityLength int = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyEntityReferenceField

type AnyEntityReferenceField struct{}

func (AnyEntityReferenceField) AllowedNullElement

func (f AnyEntityReferenceField) AllowedNullElement() bool

func (AnyEntityReferenceField) DeserializeValueFromString

func (f AnyEntityReferenceField) DeserializeValueFromString(s string) (interface{}, error)

func (AnyEntityReferenceField) GetSubFieldNames

func (f AnyEntityReferenceField) GetSubFieldNames() []string

func (AnyEntityReferenceField) GetSubFields

func (f AnyEntityReferenceField) GetSubFields() []field.Field

func (AnyEntityReferenceField) MapCompoundValueToSlice

func (f AnyEntityReferenceField) MapCompoundValueToSlice(original interface{}) (storage []interface{}, err error)

func (AnyEntityReferenceField) MarshalJSON

func (f AnyEntityReferenceField) MarshalJSON() ([]byte, error)

func (AnyEntityReferenceField) SerializeValueToString

func (f AnyEntityReferenceField) SerializeValueToString(value interface{}) string

func (AnyEntityReferenceField) Type

func (AnyEntityReferenceField) UnmapCompoundValueFromSlice

func (f AnyEntityReferenceField) UnmapCompoundValueFromSlice(storage []interface{}) (original interface{})

type ArrayField

type ArrayField struct {
	Elem field.Field
}

func (ArrayField) DeserializeValueFromString

func (c ArrayField) DeserializeValueFromString(s string) (interface{}, error)

func (ArrayField) MarshalJSON

func (c ArrayField) MarshalJSON() ([]byte, error)

func (ArrayField) SerializeValueToString

func (c ArrayField) SerializeValueToString(value interface{}) string

type BlobField

type BlobField struct {
}

func (BlobField) DeserializeValueFromString

func (c BlobField) DeserializeValueFromString(s string) (interface{}, error)

func (BlobField) MarshalJSON

func (c BlobField) MarshalJSON() ([]byte, error)

func (BlobField) SerializeValueToString

func (c BlobField) SerializeValueToString(value interface{}) string

type BooleanField

type BooleanField struct {
}

func (BooleanField) DeserializeValueFromString

func (f BooleanField) DeserializeValueFromString(s string) (interface{}, error)

func (BooleanField) MarshalJSON

func (f BooleanField) MarshalJSON() ([]byte, error)

func (BooleanField) SerializeValueToString

func (f BooleanField) SerializeValueToString(value interface{}) string

type CharField

type CharField struct {
	MaxLength int
}

func (CharField) DeserializeValueFromString

func (c CharField) DeserializeValueFromString(s string) (interface{}, error)

func (CharField) MarshalJSON

func (c CharField) MarshalJSON() ([]byte, error)

func (CharField) SerializeValueToString

func (c CharField) SerializeValueToString(value interface{}) string

type CompoundFieldDefinition

type CompoundFieldDefinition interface {
	domainModel.PersistenceCompoundField
	domainModel.UserCompoundField
}

func CompoundField

func CompoundField(
	Fields field.StructType,
	nullable bool,
) CompoundFieldDefinition

type Date

type Date time.Time

func (Date) Equal

func (d Date) Equal(o Date) bool

func (Date) MarshalText

func (d Date) MarshalText() (text []byte, err error)

func (Date) Time

func (d Date) Time() time.Time

type DateField

type DateField struct{}

func (DateField) DeserializeValueFromString

func (d DateField) DeserializeValueFromString(s string) (interface{}, error)

func (DateField) MarshalJSON

func (d DateField) MarshalJSON() ([]byte, error)

func (DateField) SerializeValueToString

func (d DateField) SerializeValueToString(value interface{}) string

type DateTime

type DateTime time.Time

func (DateTime) MarshalText

func (d DateTime) MarshalText() (text []byte, err error)

type DateTimeField

type DateTimeField struct{}

func (DateTimeField) DeserializeValueFromString

func (d DateTimeField) DeserializeValueFromString(s string) (interface{}, error)

func (DateTimeField) MarshalJSON

func (d DateTimeField) MarshalJSON() ([]byte, error)

func (DateTimeField) SerializeValueToString

func (d DateTimeField) SerializeValueToString(value interface{}) string

type DecimalField

type DecimalField struct {
	Precision, Scale int
}

func (DecimalField) DeserializeValueFromString

func (d DecimalField) DeserializeValueFromString(s string) (interface{}, error)

func (DecimalField) MarshalJSON

func (d DecimalField) MarshalJSON() ([]byte, error)

func (DecimalField) SerializeValueToString

func (d DecimalField) SerializeValueToString(value interface{}) string

type EntityReferenceField

type EntityReferenceField struct {
	EntityUname entity.Key
}

func (EntityReferenceField) DeserializeValueFromString

func (field EntityReferenceField) DeserializeValueFromString(s string) (interface{}, error)

func (EntityReferenceField) GetFieldType

func (field EntityReferenceField) GetFieldType() field.Field

func (EntityReferenceField) MapValueToAlias

func (field EntityReferenceField) MapValueToAlias(original interface{}) (storage interface{}, err error)

func (EntityReferenceField) MarshalJSON

func (field EntityReferenceField) MarshalJSON() ([]byte, error)

func (EntityReferenceField) SerializeValueToString

func (field EntityReferenceField) SerializeValueToString(value interface{}) string

func (EntityReferenceField) UnmapValueFromAlias

func (field EntityReferenceField) UnmapValueFromAlias(storage interface{}) (original interface{})

type EntityRevisionReferenceField

type EntityRevisionReferenceField struct {
	EntityUname string
}

func (EntityRevisionReferenceField) GetSubFieldNames

func (f EntityRevisionReferenceField) GetSubFieldNames() []string

func (EntityRevisionReferenceField) GetSubFields

func (f EntityRevisionReferenceField) GetSubFields() []field.Field

TODO: what about foreign keys

type FileField

type FileField struct {
	FileStorage string
}

func (FileField) DeserializeValueFromString

func (f FileField) DeserializeValueFromString(s string) (interface{}, error)

func (FileField) MarshalJSON

func (f FileField) MarshalJSON() ([]byte, error)

func (FileField) SerializeValueToString

func (f FileField) SerializeValueToString(value interface{}) string

type FileValue

type FileValue interface {
	FileName() string
	OpenReader() (ReadSeekCloser, error)
}

func NewFileValue

func NewFileValue(filename string, value []byte) FileValue

type ImageField

type ImageField struct {
	FileStorage string
}

TODO: maybe move the responsiblity for composition here

func (ImageField) DeserializeValueFromString

func (i ImageField) DeserializeValueFromString(s string) (interface{}, error)

func (ImageField) MarshalJSON

func (i ImageField) MarshalJSON() ([]byte, error)

func (ImageField) SerializeValueToString

func (i ImageField) SerializeValueToString(value interface{}) string

type ImageValue

type ImageValue interface {
	Content() FileValue
	Format() string
	Width() int
	Height() int
	Hash() []byte
}

func NewImageValue

func NewImageValue(name string, mime string, content []byte) (ImageValue, error)

func NewImageValueFromDecodedData

func NewImageValueFromDecodedData(fileValue FileValue, format string, width int, height int) (ImageValue, error)

func NewImageValueFromFileValue

func NewImageValueFromFileValue(fileValue FileValue) (ImageValue, error)

type Int16

type Int16 struct {
}

func (Int16) DeserializeValueFromString

func (i Int16) DeserializeValueFromString(s string) (interface{}, error)

func (Int16) MarshalJSON

func (i Int16) MarshalJSON() ([]byte, error)

func (Int16) SerializeValueToString

func (i Int16) SerializeValueToString(value interface{}) string

type Int64

type Int64 struct {
}

func (Int64) DeserializeValueFromString

func (i Int64) DeserializeValueFromString(s string) (interface{}, error)

func (Int64) MarshalJSON

func (i Int64) MarshalJSON() ([]byte, error)

func (Int64) SerializeValueToString

func (i Int64) SerializeValueToString(value interface{}) string

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

type RichTextField

type RichTextField struct {
}

func (RichTextField) AllowedNullElement

func (r RichTextField) AllowedNullElement() bool

func (RichTextField) DeserializeValueFromString

func (r RichTextField) DeserializeValueFromString(s string) (interface{}, error)

func (RichTextField) GetSubFieldNames

func (r RichTextField) GetSubFieldNames() []string

func (RichTextField) GetSubFields

func (r RichTextField) GetSubFields() []field.Field

func (RichTextField) MapCompoundValueToSlice

func (r RichTextField) MapCompoundValueToSlice(original interface{}) (storage []interface{}, err error)

func (RichTextField) MarshalJSON

func (r RichTextField) MarshalJSON() ([]byte, error)

func (RichTextField) SerializeValueToString

func (r RichTextField) SerializeValueToString(value interface{}) string

func (RichTextField) Type

func (r RichTextField) Type() reflect.Type

func (RichTextField) UnmapCompoundValueFromSlice

func (r RichTextField) UnmapCompoundValueFromSlice(storage []interface{}) (original interface{})

type RichTextValue

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

func NewRichTextValue

func NewRichTextValue(mimeType string, content string) RichTextValue

func (RichTextValue) GetContent

func (v RichTextValue) GetContent() string

func (RichTextValue) MarshalText

func (v RichTextValue) MarshalText() (text []byte, err error)

type StoredFileValue

type StoredFileValue interface {
	FileValue

	Reference() string
}

type StructFieldDefinition

type StructFieldDefinition interface {
	domainModel.PersistenceCompoundField
	domainModel.UserCompoundField
}

func StructField

func StructField(
	StructType interface{},
	OverrideFields field.StructType,
	nullable bool,
) StructFieldDefinition

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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