pool

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 7

README

pool

object pool with golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default added in v0.0.3

func Default(namespace, name string, new func() any)

func DefaultNoCtx added in v0.0.3

func DefaultNoCtx(namespace, name string, new func() any)

func Get

func Get[T object.ObjectInterface](namespace, name string, ctx object.CtxInterface) T

func GetNoCtx added in v0.0.2

func GetNoCtx[T object.ObjNoCtxInterface](namespace, name string) T

func GetObjNoCtx added in v0.0.2

func GetObjNoCtx(namespace, name string) object.ObjNoCtxInterface

func GetObject

func GetObject(namespace, name string, ctx object.CtxInterface) object.ObjectInterface

func Put

func Put[T object.ObjectInterface](obj T)

func PutNoCtx added in v0.0.2

func PutNoCtx[T object.ObjNoCtxInterface](obj T)

func Reg

func Reg(pool PoolInterface)

func RegNoCtx added in v0.0.2

func RegNoCtx(pool PoolNoCtxInterface)

Types

type Context added in v0.0.3

type Context struct {
	*object.ObjNoCtx
	context.Context
	// contains filtered or unexported fields
}

func NewContext added in v0.0.3

func NewContext(parent context.Context) *Context

func (*Context) Drop added in v0.0.5

func (c *Context) Drop()

func (*Context) Get added in v0.0.3

func (c *Context) Get(namespace, name string) object.ObjectInterface

func (*Context) GetNoCtx added in v0.0.3

func (c *Context) GetNoCtx(namespace, name string) object.ObjNoCtxInterface

func (*Context) Reset added in v0.0.3

func (c *Context) Reset()

type Pool

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

func NewPool

func NewPool(namespace, name string, new func() any) *Pool

func (*Pool) Get

func (*Pool) Name

func (p *Pool) Name() string

func (*Pool) Put

func (p *Pool) Put(obj object.ObjectInterface)

type PoolInterface

type PoolInterface interface {
	Put(object.ObjectInterface)
	Get(object.CtxInterface) object.ObjectInterface
	Name() string
}

type PoolNoCtx added in v0.0.2

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

func NewPoolNoCtx added in v0.0.2

func NewPoolNoCtx(namespace, name string, new func() any) *PoolNoCtx

func (*PoolNoCtx) Get added in v0.0.2

func (*PoolNoCtx) Name added in v0.0.2

func (p *PoolNoCtx) Name() string

func (*PoolNoCtx) Put added in v0.0.2

func (p *PoolNoCtx) Put(obj object.ObjNoCtxInterface)

type PoolNoCtxInterface added in v0.0.2

type PoolNoCtxInterface interface {
	Put(object.ObjNoCtxInterface)
	Get() object.ObjNoCtxInterface
	Name() string
}

type PoolNoCtxs added in v0.0.2

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

func NewPoolNoCtxs added in v0.0.2

func NewPoolNoCtxs() *PoolNoCtxs

func (*PoolNoCtxs) Get added in v0.0.2

func (p *PoolNoCtxs) Get(namespace, name string) object.ObjNoCtxInterface

func (*PoolNoCtxs) Put added in v0.0.2

func (p *PoolNoCtxs) Put(obj object.ObjNoCtxInterface)

func (*PoolNoCtxs) Reg added in v0.0.2

func (p *PoolNoCtxs) Reg(pool PoolNoCtxInterface)

type Pools

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

func NewPools

func NewPools() *Pools

func (*Pools) Get

func (p *Pools) Get(namespace, name string, ctx object.CtxInterface) object.ObjectInterface

func (*Pools) Put

func (p *Pools) Put(obj object.ObjectInterface)

func (*Pools) Reg

func (p *Pools) Reg(pool PoolInterface)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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