util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenId

func GenId() int64

func SliceByteToString

func SliceByteToString(bytes []byte) string

func StringToSliceByte

func StringToSliceByte(s string) []byte

Types

type Chain

type Chain[T any] struct {
	// contains filtered or unexported fields
}

func (*Chain[T]) Next

func (c *Chain[T]) Next(ctx context.Context, value T)

type Handler

type Handler[T any] interface {
	Handle(ctx context.Context, value T, c *Chain[T])
}

type Observer

type Observer[T any] interface {
	Update(ctx context.Context, value T)
}

type SimpleChain

type SimpleChain[T any] struct {
	// contains filtered or unexported fields
}

func NewSimpleChain

func NewSimpleChain[T any]() *SimpleChain[T]

func (*SimpleChain[T]) Add

func (s *SimpleChain[T]) Add(h Handler[T])

func (*SimpleChain[T]) Execute

func (s *SimpleChain[T]) Execute(ctx context.Context, value T)

type SimpleSubject

type SimpleSubject[T any] struct {
	// contains filtered or unexported fields
}

func NewSimpleSubject

func NewSimpleSubject[T any]() *SimpleSubject[T]

func (*SimpleSubject[T]) AsyncNotify

func (s *SimpleSubject[T]) AsyncNotify(ctx context.Context, value T)

func (*SimpleSubject[T]) Notify

func (s *SimpleSubject[T]) Notify(ctx context.Context, value T)

func (*SimpleSubject[T]) Register

func (s *SimpleSubject[T]) Register(o Observer[T])

func (*SimpleSubject[T]) Remove

func (s *SimpleSubject[T]) Remove(o Observer[T])

type SnowFlake

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

func NewSnowFlake

func NewSnowFlake(workerId int64, datacenterId int64) (*SnowFlake, error)

func (*SnowFlake) NextId

func (s *SnowFlake) NextId() (int64, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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