collection

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const TASK_QUEUE_SIZE = 64

Variables

Functions

This section is empty.

Types

type Collection

type Collection[T ItemSelf] struct {
	Errs []error
	// contains filtered or unexported fields
}

func NewCollection

func NewCollection[T ItemSelf](lg *log.Logger, wg *sync.WaitGroup) *Collection[T]

func (*Collection[T]) AddItem

func (c *Collection[T]) AddItem(lg *log.Logger) int

func (*Collection[T]) Collect

func (c *Collection[T]) Collect(id int)

func (*Collection[T]) CollectAll

func (c *Collection[T]) CollectAll()

func (*Collection[T]) IDValid added in v0.3.0

func (c *Collection[T]) IDValid(id int) bool

func (*Collection[T]) Item

func (c *Collection[T]) Item(id int) *Item[T]

func (*Collection[T]) ItemExists added in v0.3.0

func (c *Collection[T]) ItemExists(id int) bool

func (*Collection[T]) Next

func (c *Collection[T]) Next() int

func (*Collection[T]) OnCollect

func (c *Collection[T]) OnCollect(fn func(i *Item[T])) *Collection[T]

func (*Collection[T]) Schedule

func (c *Collection[T]) Schedule(id int, tk *Task[T]) <-chan struct{}

func (*Collection[T]) ScheduleAdd added in v0.3.0

func (c *Collection[T]) ScheduleAdd(name string, lg *log.Logger, tl, tn string, fn func(i *Item[T])) int

func (*Collection[T]) ScheduleAll

func (c *Collection[T]) ScheduleAll(tk *Task[T]) <-chan struct{}

func (*Collection[T]) SchedulePipe added in v0.3.0

func (c *Collection[T]) SchedulePipe(id1, id2 int, tk1, tk2 *Task[T]) <-chan struct{}

type CollectionType

type CollectionType int
const (
	TYPE_TASK CollectionType = iota
	TYPE_IMAGE
	TYPE_CONTEXT
	TYPE_QR
)

type Crate

type Crate[T any] struct {
	Items []*CrateItem[T]
	// contains filtered or unexported fields
}

func NewCrate

func NewCrate[T any, C CrateItem[T]]() *Crate[T]

func (*Crate[T]) Add

func (c *Crate[T]) Add(i *T) int

func (*Crate[T]) Clean

func (c *Crate[T]) Clean(index int)

func (*Crate[T]) CleanAll

func (c *Crate[T]) CleanAll()

func (*Crate[T]) Item

func (c *Crate[T]) Item(id int) (*T, error)

func (*Crate[T]) ItemFull

func (c *Crate[T]) ItemFull(id int) (*CrateItem[T], error)

func (*Crate[T]) OnClean

func (c *Crate[T]) OnClean(clean func(i *CrateItem[T])) *Crate[T]

type CrateItem

type CrateItem[T any] struct {
	Self *T
}

type Item

type Item[T ItemSelf] struct {
	Self *T
	Lg   *log.Logger

	Err error

	TaskQueue chan *Task[T]
	// contains filtered or unexported fields
}

func NewItem

func NewItem[T ItemSelf](lg *log.Logger, wg *sync.WaitGroup, fn func(i *Item[T])) *Item[T]

type ItemContext

type ItemContext struct {
	Context *gg.Context
}

func (ItemContext) Identifier

func (context ItemContext) Identifier() CollectionType

type ItemImage

type ItemImage struct {
	Image    image.Image
	Name     string
	Encoding imageutil.ImageEncoding
	Model    imageutil.ColorModel
}

func (ItemImage) Identifier

func (img ItemImage) Identifier() CollectionType

type ItemQR

type ItemQR struct {
	QR *qrcode.QRCode
}

func (ItemQR) Identifier

func (qr ItemQR) Identifier() CollectionType

type ItemSelf

type ItemSelf interface {
	Identifier() CollectionType
}

type ItemTask

type ItemTask struct {
	Name string
}

func (ItemTask) Identifier

func (qr ItemTask) Identifier() CollectionType

type RefItem

type RefItem[T any] struct {
	Value T
}

type StyleItem added in v0.3.0

type StyleItem struct {
	Style *lipgloss.Style
}

type Task

type Task[T ItemSelf] struct {
	Fn   func(i *Item[T])
	Fail func(i *Item[T])

	Lib  string
	Name string
}

Jump to

Keyboard shortcuts

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