core

package
v0.0.0-...-6725582 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Exit = os.Exit
)

Functions

func Do

func Do(f func(), r func(interface{}))

func Err

func Err(f string, args ...interface{}) error

func ExitIf

func ExitIf(condition bool, format string, args ...interface{})

func ExitOn

func ExitOn(i interface{})

func Go

func Go(f func(), r func(interface{}))

func MustGoGroup

func MustGoGroup(fs ...func())

func Now

func Now() time.Time

func NowMilli

func NowMilli() time.Time

func NowUnixMilli

func NowUnixMilli() int64

func NowUnixNano

func NowUnixNano() int64

func PanicIf

func PanicIf(condition bool, format string, args ...interface{})

func PanicIfZeroID

func PanicIfZeroID(id ID)

func PanicOn

func PanicOn(i interface{})

func Print

func Print(args ...interface{})

func Printf

func Printf(f string, args ...interface{})

func Println

func Println(args ...interface{})

func Recover

func Recover(r func(interface{}))

func Str

func Str(args ...interface{}) string

func StrEllipsis

func StrEllipsis(s string, max uint) string

func StrJoin

func StrJoin(strs []string, sep string) string

func StrLen

func StrLen(s string) int

func StrLower

func StrLower(s string) string

func StrRepeat

func StrRepeat(s string, count int) string

func StrReplace

func StrReplace(s, old, new string, n int) string

func StrReplaceAll

func StrReplaceAll(s, old, new string) string

func StrSplit

func StrSplit(s string, sep string) []string

func StrTrim

func StrTrim(s, cutset string) string

func StrTrimWS

func StrTrimWS(s string) string

func StrUpper

func StrUpper(s string) string

func Strf

func Strf(f string, args ...interface{}) string

func Strln

func Strln(args ...interface{}) string

Types

type Bit

type Bit uint8

func (Bit) Bool

func (b Bit) Bool() bool

func (Bit) MarshalBinary

func (b Bit) MarshalBinary() ([]byte, error)

func (Bit) MarshalJSON

func (b Bit) MarshalJSON() ([]byte, error)

func (Bit) MarshalText

func (b Bit) MarshalText() ([]byte, error)

func (*Bit) UnmarshalBinary

func (b *Bit) UnmarshalBinary(d []byte) error

func (*Bit) UnmarshalJSON

func (b *Bit) UnmarshalJSON(d []byte) error

func (*Bit) UnmarshalText

func (b *Bit) UnmarshalText(d []byte) error

type Bits

type Bits []Bit

func (Bits) MarshalBinary

func (bs Bits) MarshalBinary() ([]byte, error)

func (Bits) MarshalText

func (bs Bits) MarshalText() ([]byte, error)

func (*Bits) UnmarshalBinary

func (bs *Bits) UnmarshalBinary(ds []byte) error

func (*Bits) UnmarshalText

func (bs *Bits) UnmarshalText(d []byte) error

type Error

type Error interface {
	Error() string
	String() string
	Message() string
	StackTrace() string
	Value() interface{}
}

func GoGroup

func GoGroup(fs ...func()) Error

func ToError

func ToError(i interface{}) Error

type Errors

type Errors []Error

func (Errors) Error

func (es Errors) Error() string

func (Errors) String

func (es Errors) String() string

type ID

type ID ulid.ULID

func MustParseID

func MustParseID(id string) ID

func ParseID

func ParseID(id string) (ID, error)

func (ID) Compare

func (id ID) Compare(other ID) int

func (ID) Copy

func (id ID) Copy() ID

func (ID) Equal

func (id ID) Equal(other ID) bool

func (ID) IsZero

func (id ID) IsZero() bool

func (ID) MarshalBinary

func (id ID) MarshalBinary() ([]byte, error)

func (ID) MarshalBinaryTo

func (id ID) MarshalBinaryTo(dst []byte) error

func (ID) MarshalText

func (id ID) MarshalText() ([]byte, error)

func (ID) MarshalTextTo

func (id ID) MarshalTextTo(dst []byte) error

func (*ID) Scan

func (id *ID) Scan(src interface{}) error

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalBinary

func (id *ID) UnmarshalBinary(data []byte) error

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(data []byte) error

func (ID) Value

func (id ID) Value() (driver.Value, error)

type IDGen

type IDGen interface {
	New() (ID, error)
	MustNew() ID
}

func NewIDGen

func NewIDGen() IDGen

type IDGenPool

type IDGenPool interface {
	Get() IDGen
}

func NewIDGenPool

func NewIDGenPool(size int) IDGenPool

n.b. each IDGen allocates approx 5kb of memory so use a fixed pool to save on lots of big memory de/allocations

type IDs

type IDs []ID

func IDsMerge

func IDsMerge(idss ...IDs) IDs

func (IDs) StrJoin

func (ids IDs) StrJoin(sep string) string

func (IDs) ToIs

func (ids IDs) ToIs() []interface{}

Jump to

Keyboard shortcuts

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