meta/interface.go

100 lines
2.5 KiB
Go
Raw Permalink Normal View History

2022-10-01 21:09:54 +03:00
package meta
type Reader interface {
ReadI8(v *int8, field string) error
ReadU8(v *uint8, field string) error
ReadI16(v *int16, field string) error
ReadU16(v *uint16, field string) error
ReadI32(v *int32, field string) error
ReadU32(v *uint32, field string) error
ReadI64(v *int64, field string) error
ReadU64(v *uint64, field string) error
ReadBool(v *bool, field string) error
ReadFloat(v *float32, field string) error
ReadDouble(v *float64, field string) error
ReadString(v *string, field string) error
ReadBlob(v *[]byte, field string) error
BeginContainer(field string) error
EndContainer() error
GetContainerSize() (int, error)
Skip() error
TryReadMask() (bool, FieldsMask, error)
}
type Writer interface {
WriteI8(v int8, field string) error
WriteU8(v uint8, field string) error
WriteI16(v int16, field string) error
WriteU16(v uint16, field string) error
WriteI32(v int32, field string) error
WriteU32(v uint32, field string) error
WriteU64(v uint64, field string) error
WriteI64(v int64, field string) error
WriteBool(v bool, field string) error
WriteFloat(v float32, field string) error
WriteDouble(v float64, field string) error
WriteString(v string, field string) error
WriteBlob(v []byte, field string) error
BeginContainer(field string)
EndContainer() error
GetData() ([]byte, error)
}
type ClassFieldsProps map[string]map[string]string
type IClassProps interface {
CLASS_ID() uint32
CLASS_NAME() string
CLASS_PROPS() *map[string]string
CLASS_FIELDS() []string
CLASS_FIELDS_PROPS() *ClassFieldsProps
}
type MetaFactory func(classId uint32) (IMetaStruct, error)
type IMetaStruct interface {
IClassProps
Read(reader Reader) error
Write(writer Writer) error
ReadFields(reader Reader) error
WriteFields(writer Writer) error
Reset()
}
type IMetaDataItem interface {
IClassProps
GetDbTableName() string
GetDbFields() []string
GetOwnerFieldName() string
GetIdFieldName() string
GetIdValue() uint64
Import(interface{})
Export([]interface{})
NewInstance() IMetaDataItem
}
type IRemovedIds interface {
GetList(classId uint32) []uint64
Add(classId uint32, id uint64)
HasList(classId uint32) bool
}
type IBitmasked interface {
SetFieldChanged(index uint64)
HasValue(index uint64) bool
IsMaskFilled() bool
GetMask() FieldsMask
}
type RPCFactory func(classId uint32) (IRPC, error)
type IRPC interface {
GetCode() int32
GetName() string
GetRequest() IMetaStruct
GetResponse() IMetaStruct
SetError(int32, string)
GetError() (int32, string)
Execute(interface{}) error
}