util

package
v0.16.13 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONEncode

func JSONEncode(w io.WriteCloser, v interface{}) error

func Marshal

func Marshal(v interface{}) (data []byte, err error)

Marshal is the json marshaler implementation for jsoniter, depending on the build tags.

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

Unmarshal is the json unmarshaler implementation that is defined by the used build tags.

Types

type AtomicLock

type AtomicLock int32

func (*AtomicLock) AcquireLock

func (l *AtomicLock) AcquireLock() bool

func (*AtomicLock) IsLocked

func (l *AtomicLock) IsLocked() bool

func (*AtomicLock) Unlock

func (l *AtomicLock) Unlock()

type Queue

type Queue interface {
	Pop() (interface{}, error)
	Push(...interface{})
	Len() uint
}

func NewThreadSafeQueue

func NewThreadSafeQueue() Queue

func NewThreadUnsafeQueue

func NewThreadUnsafeQueue() Queue

type Snowflake

type Snowflake = snowflake.Snowflake

func GetSnowflake

func GetSnowflake(v interface{}) (Snowflake, error)

GetSnowflake see snowflake.GetSnowflake

func NewSnowflake

func NewSnowflake(id uint64) Snowflake

NewSnowflake see snowflake.NewSnowflake

func ParseSnowflakeString

func ParseSnowflakeString(v string) Snowflake

ParseSnowflakeString see snowflake.ParseSnowflakeString

type Ticket

type Ticket int
const (
	NoTicket Ticket = -1
)

type TicketQueue

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

func (*TicketQueue) Delete

func (q *TicketQueue) Delete(ticket Ticket)

func (*TicketQueue) NewTicket

func (q *TicketQueue) NewTicket() (ticket Ticket)

func (*TicketQueue) Next

func (q *TicketQueue) Next(ticket Ticket, cb func() bool) bool

Jump to

Keyboard shortcuts

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