gopool

package
v0.0.0-...-b36d24e Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MulanPSL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectIchubResultPool

func InjectIchubResultPool(s *IchubResultPool)

func LoadIchubResultPool

func LoadIchubResultPool() baseiface.ISingleton

Types

type GeneralObjectPool

type GeneralObjectPool[T baseiface.IpoolObj] struct {
	CommonPool *pool.ObjectPool
}

func NewGeneralObjectPool

func NewGeneralObjectPool[T baseiface.IpoolObj]() *GeneralObjectPool[T]

NewGeneralObjectPool 使用传入的上下文初始化连接池

func (*GeneralObjectPool[T]) BorrowObject

func (gop *GeneralObjectPool[T]) BorrowObject(ctx context.Context) (T, error)

BorrowObject 从连接池借用对象,增加了错误处理和重试逻辑

func (gop *GeneralObjectPool[T]) Link() (T, error)

Link 初始化连接,通过指针类型初始化对象

func (*GeneralObjectPool[T]) NewOfPtrType

func (gop *GeneralObjectPool[T]) NewOfPtrType() T

func (*GeneralObjectPool[T]) NewOfType

func (gop *GeneralObjectPool[T]) NewOfType() T

func (*GeneralObjectPool[T]) ReturnObject

func (gop *GeneralObjectPool[T]) ReturnObject(ctx context.Context, object T) error

ReturnObject 交还对象到连接池

type IchubResultPool

type IchubResultPool struct {
	basedto.BaseEntitySingle
	*GeneralObjectPool[*basedto.IchubResult]
}

func FindBeanIchubResultPool

func FindBeanIchubResultPool() *IchubResultPool

FindBeanIchubResultPool

func NewIchubResultPool

func NewIchubResultPool() *IchubResultPool

Jump to

Keyboard shortcuts

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