model

package
v0.0.0-...-750f124 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const IN_HOUSE = "018e9522-01c9-77c0-be6c-65526f21ec1a"

Variables

This section is empty.

Functions

func Decode

func Decode(recorder Recorder, rec *Record) (err error)

func DumpList

func DumpList(records []*Record)

func GetDimensions

func GetDimensions(path, ext string) (width int32, height int32)

func RecordID

func RecordID(id uuid.UUID) (major, minor int64)

func RecordUUID

func RecordUUID(major, minor int64) (id uuid.UUID)

func SetupRecord

func SetupRecord(rec *Record, class string, classn int32,
	vContent any, encoding Encoding)

func SetupRecorder

func SetupRecorder[T any](gd Recorder, name string, classn int32)

func SetupResource

func SetupResource(res *Resource, path string, classn int32)

Types

type Encoding

type Encoding int32
const (
	RAW Encoding = iota
	JSON
	YAML
	XML
	CSV
)

func (Encoding) Decode

func (en Encoding) Decode(buf []byte, v any) (err error)

func (Encoding) Encode

func (en Encoding) Encode(v any) (buf []byte, err error)

func (Encoding) String

func (i Encoding) String() string

type JsonSerializer

type JsonSerializer struct{}

func (*JsonSerializer) Format

func (jsn *JsonSerializer) Format(obj any) ([]byte, error)

func (*JsonSerializer) MarshalText

func (jsn *JsonSerializer) MarshalText(r Recorder) ([]byte, error)

func (*JsonSerializer) Scan

func (jsn *JsonSerializer) Scan(buffer []byte, obj any) error
type Link struct {
	Major    int64
	Minor    int64
	Linked   int64
	Linkedn  int64
	Repeated int32
	Weight   float64
}
func NewLink(item, linked Recorder, repeated int32, weight float64) *Link

type Parent

type Parent interface {
	Recorder
	LinkChild(Recorder)
	Children() []Recorder
}

type Record

type Record struct {
	Class    string
	Classn   int32
	Content  string
	Encoding Encoding
	Major    int64
	Minor    int64
	Origin   int64
	Originn  int64
	Created  time.Time
	Updated  time.Time
}

func (*Record) Copy

func (rec *Record) Copy(record *Record)

func (*Record) Dump

func (rec *Record) Dump()

func (*Record) UpdateContent

func (rec *Record) UpdateContent(v any) string

type Recorder

type Recorder interface {
	GetRecord() *Record
	GetItem() any
}

type RecorderClass

type RecorderClass[T any] struct {
	Record  Record
	Content T
}

func (*RecorderClass[T]) GetItem

func (rr *RecorderClass[T]) GetItem() any

func (*RecorderClass[T]) GetRecord

func (rr *RecorderClass[T]) GetRecord() *Record

type Resource

type Resource struct {
	Name   string
	Path   string
	Scheme Scheme
	IsDir  bool
	Size   int64
	Width  int32
	Height int32
	Err    error `json:"-" yaml:"-"`
}

type Scheme

type Scheme int
const (
	None Scheme = iota // none
	File               // file
)

func (Scheme) String

func (i Scheme) String() string

type Version

type Version struct {
	Item      int64
	Itemn     int64
	Major     uint16
	Minor     uint16
	Patch     uint16
	Extension uint16
	Created   time.Time
	Updated   time.Time
}

func (*Version) FromUint64

func (ver *Version) FromUint64(i uint64)

func (*Version) ToUint64

func (ver *Version) ToUint64() uint64

type YamlSerializer

type YamlSerializer struct{}

func (*YamlSerializer) MarshalText

func (yml *YamlSerializer) MarshalText(obj any) ([]byte, error)

func (*YamlSerializer) UnmarshalText

func (yml *YamlSerializer) UnmarshalText(buffer []byte, obj any) error

Jump to

Keyboard shortcuts

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