storage

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	NewSetter func(id MID, val interface{}) Setter //创建新数据结构
	// contains filtered or unexported fields
}

Array 一维数组存储器

func New

func New(cap int) *Array

func (*Array) Create

func (this *Array) Create(v interface{}) Setter

Create 创建一个新数据

func (*Array) Delete

func (this *Array) Delete(id MID) Setter

Delete 删除并返回已删除的数据

func (*Array) Get

func (this *Array) Get(id MID) (Setter, bool)

func (*Array) Mutex

func (this *Array) Mutex(f func())

Mutex 获取操作锁

func (*Array) Range

func (this *Array) Range(f func(Setter) bool)

Range 遍历

func (*Array) Remove

func (this *Array) Remove(ids ...MID)

Remove 批量移除

func (*Array) Set

func (this *Array) Set(id MID, v interface{}) bool

func (*Array) Size

func (this *Array) Size() int

Size 当前数量

type Data

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

func NewData

func NewData(id MID, data interface{}) *Data

NewData 默认存储对象

func (*Data) Get

func (this *Data) Get() interface{}

func (*Data) Id

func (this *Data) Id() MID

func (*Data) Set

func (this *Data) Set(data interface{})

type Hash

type Hash struct {
	Array
	// contains filtered or unexported fields
}

func NewHash

func NewHash(cap int) *Hash

func (*Hash) Create

func (this *Hash) Create(uuid string, val interface{}) Setter

func (*Hash) Delete

func (this *Hash) Delete(uuid string) (r Setter)

func (*Hash) Load

func (this *Hash) Load(uuid string) (r Setter)

func (*Hash) MID

func (this *Hash) MID(uuid string) (mid MID, ok bool)

func (*Hash) Remove

func (this *Hash) Remove(uuid ...string)

func (*Hash) Reset

func (this *Hash) Reset(uuid string, mid MID) (r Setter)

Reset 重新设置uuid mid关联,返回之前的数据(如果存在)

type MID

type MID string

type Setter

type Setter interface {
	Id() MID
	Get() interface{}
	Set(interface{})
}

func NewSetter

func NewSetter(id MID, val interface{}) Setter

Jump to

Keyboard shortcuts

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