view

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: LGPL-2.1 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Name      = self.Name
	Using     = self.Using
	Install   = self.Install
	Uninstall = self.Uninstall
)
View Source
var (
	ErrEntityNotFound               = variant.Errorln(-2, "entity not found")
	ErrEntityNoPropTab              = variant.Errorln(-3, "entity hasn't prop table")
	ErrEntityNoProp                 = variant.Errorln(-4, "entity hasn't prop")
	ErrOutdatedRevision             = variant.Errorln(-5, "synchronized revision is outdated")
	ErrDiscontinuousRevision        = variant.Errorln(-6, "synchronized revision is discontinuous")
	ErrMethodNotFound               = variant.Errorln(-7, "op method not found")
	ErrMethodParameterCountMismatch = variant.Errorln(-8, "op method parameter count mismatch")
	ErrMethodParameterTypeMismatch  = variant.Errorln(-9, "op method parameter type mismatch")
)

Functions

func ReferencePropT

func ReferencePropT[T IPropSync](entity ec.Entity, name string) T

ReferencePropT 引用属性

func UnsafeProp deprecated

func UnsafeProp(p IProp) _UnsafeProp

Deprecated: UnsafeProp 访问属性内部函数

func UnsafePropSync deprecated

func UnsafePropSync(ps IPropSync) _UnsafePropSync

Deprecated: UnsafePropSync 访问属性同步内部函数

Types

type IProp

type IProp interface {

	// Reset 重置
	Reset()
	// Revision 版本号
	Revision() int64
	// Marshal 序列化
	Marshal() ([]byte, int64, error)
	// Unmarshal 反序列化
	Unmarshal(data []byte, revision int64) error
	// contains filtered or unexported methods
}

IProp 属性接口

type IPropSync

type IPropSync interface {
	IProp

	// Load 加载
	Load(service string) error
	// Save 保存
	Save(service string) error
	// Managed 托管的属性
	Managed() IProp
	// Atti Atti
	Atti() any
	// Reflected 反射值
	Reflected() reflect.Value
	// contains filtered or unexported methods
}

IPropSync 属性同步接口

func ReferenceProp

func ReferenceProp(entity ec.Entity, name string) IPropSync

ReferenceProp 引用属性

type IPropTab

type IPropTab interface {
	// AddProp 添加属性
	AddProp(name string, ps IPropSync)
	// GetProp 获取属性
	GetProp(name string) IPropSync
	// RangeProps 遍历属性
	RangeProps(fun generic.Func2[string, IPropSync, bool])
	// EachProps 遍历属性
	EachProps(fun generic.Action2[string, IPropSync])
}

IPropTab 属性表接口

type IPropView

type IPropView interface {
	// contains filtered or unexported methods
}

IPropView 属性视图插件接口

type PropCreator

type PropCreator = PropCreatorT[IPropSync]

PropCreator 属性创建器

func DeclareProp

func DeclareProp(entity ec.Entity, name string, prop any) PropCreator

DeclareProp 定义属性

type PropCreatorT

type PropCreatorT[T IPropSync] struct {
	// contains filtered or unexported fields
}

PropCreatorT 属性创建器

func DeclarePropT

func DeclarePropT[T IPropSync](entity ec.Entity, name string) PropCreatorT[T]

DeclarePropT 定义属性

func (PropCreatorT[T]) Atti

func (c PropCreatorT[T]) Atti(atti any) PropCreatorT[T]

Atti 设置Atti

func (PropCreatorT[T]) Reference

func (c PropCreatorT[T]) Reference() T

Reference 引用属性

func (PropCreatorT[T]) SyncTo

func (c PropCreatorT[T]) SyncTo(to ...string) PropCreatorT[T]

SyncTo 设置同步目标

type PropSync

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

PropSync 属性同步器

func (*PropSync) Atti

func (ps *PropSync) Atti() any

Atti Atti

func (*PropSync) Load

func (ps *PropSync) Load(service string) ([]byte, int64, error)

Load 加载数据

func (*PropSync) Reflected

func (ps *PropSync) Reflected() reflect.Value

Reflected 反射值

func (*PropSync) Save

func (ps *PropSync) Save(service string, data []byte, revision int64) error

Save 保存数据

type PropT

type PropT[T variant.Value] struct {
	// contains filtered or unexported fields
}

PropT 属性

func (*PropT[T]) Marshal

func (p *PropT[T]) Marshal() ([]byte, int64, error)

Marshal 序列化

func (*PropT[T]) Reset

func (p *PropT[T]) Reset()

Reset 重置

func (*PropT[T]) Revision

func (p *PropT[T]) Revision() int64

Revision 版本号

func (*PropT[T]) Unmarshal

func (p *PropT[T]) Unmarshal(data []byte, revision int64) error

Unmarshal 反序列化

func (*PropT[T]) Value

func (p *PropT[T]) Value() T

Value 值

type PropTab

type PropTab generic.SliceMap[string, IPropSync]

PropTab 属性表

func (*PropTab) AddProp

func (pt *PropTab) AddProp(name string, ps IPropSync)

AddProp 添加属性

func (*PropTab) EachProps

func (pt *PropTab) EachProps(fun generic.Action2[string, IPropSync])

EachProps 遍历属性

func (*PropTab) GetProp

func (pt *PropTab) GetProp(name string) IPropSync

GetProp 获取属性

func (*PropTab) RangeProps

func (pt *PropTab) RangeProps(fun generic.Func2[string, IPropSync, bool])

RangeProps 遍历属性

Jump to

Keyboard shortcuts

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