types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeShift = 12
	MaxStep   = 1 << TimeShift
	IDBit     = 54
)
View Source
const (
	// ISO860: YYYY-MM-DDThh:mm:ss.sssZ
	TimeFormat       = "2006-01-02T15:04:05.999Z"
	StringTimeFormat = `"` + TimeFormat + `"`
)
View Source
const Epoch int64 = 1685577600000 // 2023-06-01 00:00:00 +00:00

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag uint32

func StringToFlag

func StringToFlag(p string) Flag

string to Permission, if not return 0

func (Flag) Base64

func (p Flag) Base64() string

func (Flag) Binary

func (p Flag) Binary() string

func (Flag) Bytes

func (p Flag) Bytes() []byte

func (Flag) Int64

func (p Flag) Int64() int64

func (*Flag) Scan

func (p *Flag) Scan(src any) error

for sql

func (Flag) StrictSubset

func (p Flag) StrictSubset(other Flag) bool

if the permissions on other are a strict subset of those on self.

func (Flag) StrictSuperset

func (p Flag) StrictSuperset(other Flag) bool

if the permissions on other are a strict superset of those on self.

func (Flag) String

func (p Flag) String() string

func (Flag) Subset

func (p Flag) Subset(other Flag) bool

if self has the same or fewer permissions as other.

func (Flag) Superset

func (p Flag) Superset(other Flag) bool

if self has the same or more permissions as other.

func (*Flag) Value

func (f *Flag) Value() (driver.Value, error)

for sql

type ID

type ID int64

ID is a 54-bit ID.

func StringToID

func StringToID(s string) ID

string to ID, if not return -1

func (ID) Base2

func (f ID) Base2() string

func (ID) Base64

func (f ID) Base64() string

func (ID) Bytes

func (f ID) Bytes() []byte

func (ID) Int64

func (f ID) Int64() int64

func (ID) MarshalJSON

func (f ID) MarshalJSON() ([]byte, error)

func (*ID) Scan

func (f *ID) Scan(src any) error

for sql

func (ID) String

func (f ID) String() string

func (ID) Time

func (f ID) Time() time.Time

func (*ID) UnmarshalJSON

func (f *ID) UnmarshalJSON(data []byte) error

func (*ID) Value

func (f *ID) Value() (driver.Value, error)

for sql

type SummonID

type SummonID struct {
	Epoch time.Time
	// contains filtered or unexported fields
}
var GlobalIDMake *SummonID

func NewSummonID

func NewSummonID() *SummonID

func (*SummonID) Generate

func (s *SummonID) Generate() ID

type Time

type Time time.Time

func NewTime

func NewTime(time time.Time) Time

func NowTime

func NowTime() Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) Scan

func (t *Time) Scan(src any) error

for sql

func (Time) String

func (t Time) String() string

func (Time) Time

func (t Time) Time() time.Time

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

func (Time) Value

func (t Time) Value() (driver.Value, error)

for sql

Jump to

Keyboard shortcuts

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