model

package
v0.0.0-...-eebf476 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUUID

func NewUUID() ([]byte, error)

func Now

func Now() time.Time

Types

type Common

type Common struct {
	Store   *sql.DB   `json:"-"`
	Mapper  string    `json:"-"`
	ID      int64     `json:"-"`
	UUID    []byte    `json:"uuid"`
	Added   time.Time `json:"added"`
	Updated time.Time `json:"updated"`
	Flag    uint8     `json:"flag"`
}

func NewCommon

func NewCommon(store *sql.DB, mapper string) (Common, error)

type Deleter

type Deleter interface {
	Delete() error
}

type Displayer

type Displayer interface {
	Display()
}

type Encoder

type Encoder interface {
	Encode(io.Writer) error
}

type Entity

type Entity interface {
	Displayer
	Encoder
	Setter
	Writer
	Mapper
}

type External

type External struct {
	Common
	Type    string          `json:"type"`
	Name    string          `json:"name"`
	Body    string          `json:"body"`
	Data    []byte          `json:"data"`
	Tags    []Entity        `json:"tags"`
	Mapping map[int64]int64 `json:"-"`
	Meta    *Internal       `json:"-"`
}

func NewExternal

func NewExternal(store *sql.DB) (*External, error)

func (*External) Delete

func (self *External) Delete() error

func (*External) Display

func (self *External) Display()

func (*External) Encode

func (self *External) Encode(w io.Writer) error

func (*External) ExportMetadata

func (self *External) ExportMetadata() (int64, string)
func (self *External) Link(entity Entity) error

func (*External) Map

func (self *External) Map(entity Entity) error

func (*External) Save

func (self *External) Save() error

func (*External) Set

func (self *External) Set(key string, value []byte) error
func (self *External) Unlink() error

func (*External) Unmap

func (self *External) Unmap(entity Entity) error

func (*External) Update

func (self *External) Update() error

type Internal

type Internal struct {
	Common
	Type    string          `json:"type"`
	Origin  string          `json:"origin"`
	Data    []byte          `json:"data"`
	Tags    []Entity        `json:"tags"`
	Mapping map[int64]int64 `json:"-"`
}

func NewInternal

func NewInternal(store *sql.DB) (*Internal, error)

func (*Internal) Delete

func (self *Internal) Delete() error

func (*Internal) Display

func (self *Internal) Display()

func (*Internal) Encode

func (self *Internal) Encode(w io.Writer) error

func (*Internal) ExportMetadata

func (self *Internal) ExportMetadata() (int64, string)

func (*Internal) Map

func (self *Internal) Map(entity Entity) error

func (*Internal) Save

func (self *Internal) Save() error

func (*Internal) Set

func (self *Internal) Set(key string, value []byte) error

func (*Internal) Unmap

func (self *Internal) Unmap(entity Entity) error

func (*Internal) Update

func (self *Internal) Update() error

type Mapper

type Mapper interface {
	ExportMetadata() (int64, string)
	Map(Entity) error
	Unmap(Entity) error
}

type Saver

type Saver interface {
	Save() error
}

type Setter

type Setter interface {
	Set(string, []byte) error
}

type Tag

type Tag struct {
	Common
	Label string `json:"label"`
}

func NewTag

func NewTag(store *sql.DB) (*Tag, error)

func (*Tag) Delete

func (self *Tag) Delete() error

func (*Tag) Display

func (self *Tag) Display()

func (*Tag) Encode

func (self *Tag) Encode(w io.Writer) error

func (*Tag) ExportMetadata

func (self *Tag) ExportMetadata() (int64, string)

func (*Tag) Map

func (self *Tag) Map(entity Entity) error

func (*Tag) Save

func (self *Tag) Save() error

func (*Tag) Set

func (self *Tag) Set(key string, value []byte) error

func (*Tag) Unmap

func (self *Tag) Unmap(entity Entity) error

func (*Tag) Update

func (self *Tag) Update() error

type Updater

type Updater interface {
	Update() error
}

type Writer

type Writer interface {
	Saver
	Updater
	Deleter
}

Jump to

Keyboard shortcuts

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