Documentation
¶
Index ¶
- Constants
- Variables
- func Abs[I ~int | ~int8 | ~int16 | ~int32 | ~int64](i I) I
- func AllMapValueSlices[K comparable, T comparable](m map[K][]T, needDedup ...bool) []T
- func BatchCall[T any](op func([]T) bool, batchSize int, ts ...T)
- func CopySlice[T any](src []T) []T
- func GenerateQRCode(text, output string, options QRCodeOptions) error
- func GenerateQRCodeToWriter(text string, output io.Writer, options QRCodeOptions) error
- func IF[T any](condition bool, trueValue T, falseValue T) T
- func IndirectType(typ reflect.Type) reflect.Type
- func IndirectValue(val reflect.Value) reflect.Value
- func IsByteSlice(typ reflect.Type) bool
- func IsDefaultZero[T any](t T) bool
- func JsonPrettyString(m any) (string, error)
- func JsonString(m any) (string, error)
- func MustJsonPrettyString(m any) string
- func MustJsonString(m any) string
- func NewIDValuer(ids ...int64) []driver.Valuer
- func OpenWriteFile(fullFilePathName string) (*os.File, error)
- func RandomBytes(length int) []byte
- func RemoveFile(fullFilePathName string) error
- func SetByteSliceValue(val reflect.Value, bs []byte) error
- func SplitNetAddr(addr string) (host string, port int)
- func SsToTs[S, T any](transmitter func(S) T, ss ...S) []T
- func TsToSs[T, S any](transmitter func(T) (S, bool), ts ...T) []S
- func ValidAndCreateDir(pstr string, checkAndCreateIfAbsent bool) (string, error)
- func VariadicParam[T any](params []T, defaultValue ...T) T
- type B
- type Bs
- type Date
- type Exister
- type F
- type ID
- type JSON
- func (j *JSON) Bytes() []byte
- func (j *JSON) Clone() JSON
- func (j *JSON) Equal(o *JSON) bool
- func (j JSON) Format(f fmt.State, c rune)
- func (j JSON) IsNull() bool
- func (j JSON) MarshalJSON() ([]byte, error)
- func (j *JSON) Scan(value interface{}) error
- func (j *JSON) String() string
- func (j *JSON) UnmarshalJSON(data []byte) error
- func (j JSON) Value() (driver.Value, error)
- type JSONArray
- type JSONBuilder
- type KKMap
- func (kkm KKMap[K1, K2, V]) Delete(k1 K1, k2 K2)
- func (kkm KKMap[K1, K2, V]) DeleteKey(k1 K1)
- func (kkm KKMap[K1, K2, V]) Get(k1 K1, k2 K2) (v V, exist bool)
- func (kkm KKMap[K1, K2, V]) IsExist(k1 K1, k2 K2) (exist bool)
- func (kkm KKMap[K1, K2, V]) IsExistKey(k1 K1) (exist bool)
- func (kkm KKMap[K1, K2, V]) Put(k1 K1, k2 K2, v V) KKMap[K1, K2, V]
- func (kkm KKMap[K1, K2, V]) PutKey(k1 K1, km2 map[K2]V) KKMap[K1, K2, V]
- func (kkm KKMap[K1, K2, V]) Range(handler func(k1 K1, k2 K2, v V) (goon bool))
- type KMap
- func (km KMap[K, V]) Delete(ks ...K)
- func (km KMap[K, V]) ExistingList(keys ...K) []V
- func (km KMap[K, V]) Get(k K) (v V, exist bool)
- func (km KMap[K, V]) IsExist(key K) bool
- func (km KMap[K, V]) KeySeq(filters ...func(k K, v V) bool) iter.Seq[K]
- func (km KMap[K, V]) Keys(filters ...func(k K, v V) bool) []K
- func (km KMap[K, V]) List(keys ...K) []V
- func (km KMap[K, V]) Map() map[K]V
- func (km KMap[K, V]) Merge(kmo KMap[K, V]) KMap[K, V]
- func (km KMap[K, V]) Put(key K, value V) KMap[K, V]
- func (km KMap[K, V]) Puts(it iter.Seq2[K, V]) KMap[K, V]
- func (km KMap[K, V]) RangeSubMap(batchSize int, ranger func(m KMap[K, V]) bool)
- func (km KMap[K, V]) SubMap(ks ...K) KMap[K, V]
- func (km KMap[K, V]) Values(filters ...func(k K, v V) bool) []V
- func (km KMap[K, V]) ValuesSeq(filters ...func(k K, v V) bool) iter.Seq[V]
- type KS
- func (ks KS[K]) All() iter.Seq[K]
- func (ks KS[K]) Append(k K) KS[K]
- func (ks KS[K]) Clone() KS[K]
- func (ks KS[K]) Contains(tgt K) bool
- func (ks KS[K]) Dedup(validators ...func(k K) bool) KS[K]
- func (ks KS[K]) DedupRange(one func(k K) error) error
- func (ks KS[K]) Equal(os KS[K]) bool
- func (ks KS[K]) In(e Exister[K]) KS[K]
- func (ks KS[K]) IterateRemove(tgt K) KS[K]
- func (ks KS[K]) Map(validators ...func(k K) bool) KSet[K]
- func (ks KS[K]) NotIn(e Exister[K]) KS[K]
- func (ks KS[K]) Remove(tgts ...K) KS[K]
- func (ks KS[K]) Slice() []K
- func (ks KS[K]) Sub(offset, limit int) KS[K]
- type KSet
- func (km KSet[K]) Add(ks ...K) KSet[K]
- func (km KSet[K]) Adds(it iter.Seq[K]) KSet[K]
- func (km KSet[K]) Append(ks ...K) KSet[K]
- func (km KSet[K]) AppendSet(s KSet[K]) KSet[K]
- func (km KSet[K]) Appends(it iter.Seq[K]) KSet[K]
- func (km KSet[K]) CAS(k K) (set KSet[K], changed bool)
- func (km KSet[K]) Clone() KSet[K]
- func (km KSet[K]) Delete(ks ...K) KSet[K]
- func (km KSet[K]) Equal(o KSet[K]) bool
- func (km KSet[K]) ExsitingList(ks ...K) []K
- func (km KSet[K]) In(input iter.Seq[K]) iter.Seq[K]
- func (km KSet[K]) IsExist(k K) bool
- func (km KSet[K]) Keys() iter.Seq[K]
- func (km KSet[K]) RangeSubSet(batchSize int, ranger func(s KSet[K]) bool)
- func (km KSet[K]) Slice(emptyNil ...bool) []K
- type KV
- func (KV[K, V]) KeyNotInMap(m map[K]V, ks ...K) []K
- func (KV[K, V]) List(keys []K, valuesMap map[K]V) []V
- func (KV[K, V]) MapKeys(m map[K]V) []K
- func (KV[K, V]) MapValues(m map[K]V) []V
- func (KV[K, V]) OneOfMap(k K, mapper func([]K) (map[K]V, error)) (v V, err error)
- func (KV[K, V]) PutToMap(m map[K]V, k K, v V) map[K]V
- func (KV[K, V]) RangeByK(ks []K, m map[K]V, dowork func(k K, v V) error) error
- type List
- func (l *List[T]) All() iter.Seq[T]
- func (l *List[T]) Back() *ListElement[T]
- func (l *List[T]) Front() *ListElement[T]
- func (l *List[T]) Init() *List[T]
- func (l *List[T]) InsertAfter(v T, mark *ListElement[T]) *ListElement[T]
- func (l *List[T]) InsertBefore(v T, mark *ListElement[T]) *ListElement[T]
- func (l *List[T]) Len() int
- func (l *List[T]) MoveAfter(e, mark *ListElement[T])
- func (l *List[T]) MoveBefore(e, mark *ListElement[T])
- func (l *List[T]) MoveToBack(e *ListElement[T])
- func (l *List[T]) MoveToFront(e *ListElement[T])
- func (l *List[T]) PushBack(v T) *ListElement[T]
- func (l *List[T]) PushBackList(other *List[T])
- func (l *List[T]) PushFront(v T) *ListElement[T]
- func (l *List[T]) PushFrontList(other *List[T])
- func (l *List[T]) Remove(e *ListElement[T]) T
- type ListElement
- type NotNullJSON
- func (n *NotNullJSON) Bytes() []byte
- func (n *NotNullJSON) Clone() NotNullJSON
- func (n *NotNullJSON) Equal(o *NotNullJSON) bool
- func (n NotNullJSON) IsNull() bool
- func (n NotNullJSON) MarshalJSON() ([]byte, error)
- func (n *NotNullJSON) Scan(value interface{}) error
- func (n *NotNullJSON) String() string
- func (n NotNullJSON) ToJSON() JSON
- func (n *NotNullJSON) UnmarshalJSON(data []byte) error
- func (n NotNullJSON) Value() (driver.Value, error)
- type NullInt32
- func (i NullInt32) Int() int32
- func (i NullInt32) IsAvailable() bool
- func (i NullInt32) IsNull() bool
- func (i NullInt32) MarshalJSON() ([]byte, error)
- func (i *NullInt32) Scan(value any) error
- func (i NullInt32) String() string
- func (i *NullInt32) UnmarshalJSON(input []byte) error
- func (i NullInt32) Value() (driver.Value, error)
- type NullInt64
- func (i *NullInt64) Clear()
- func (i NullInt64) Int() int64
- func (i NullInt64) IsAvailable() bool
- func (i NullInt64) IsNull() bool
- func (i NullInt64) MarshalJSON() ([]byte, error)
- func (i *NullInt64) Scan(value any) error
- func (i *NullInt64) SetValue(val int64)
- func (i NullInt64) String() string
- func (i *NullInt64) UnmarshalJSON(input []byte) error
- func (i NullInt64) Value() (driver.Value, error)
- type NullString
- type NullTime
- func (n NullTime) Compare(ti time.Time) int
- func (n NullTime) Equal(o NullTime) bool
- func (n NullTime) Format(layout string) string
- func (n NullTime) IsNull() bool
- func (n NullTime) MarshalJSON() ([]byte, error)
- func (n NullTime) Obj() time.Time
- func (n *NullTime) Scan(value any) error
- func (n NullTime) String() string
- func (n NullTime) ToTime() Time
- func (n *NullTime) UnmarshalJSON(data []byte) error
- func (n NullTime) Value() (driver.Value, error)
- type OrderMap
- type QRCodeOptions
- type QRCodeRecoveryLevel
- type S
- func (s S) Bytes() []byte
- func (s S) CSVLike() string
- func (s S) CSVSplit() []string
- func (s S) CamelToSnake() S
- func (s S) FirstByte() byte
- func (s S) FirstRune() rune
- func (s S) FirstRuneString() S
- func (s S) Float64() (float64, error)
- func (s S) Formalize() S
- func (s S) ID() (ID, error)
- func (s S) Includes(ss ...string) bool
- func (s S) Int64() (int64, error)
- func (s S) IsValid() bool
- func (s S) JSON() (JSON, error)
- func (s S) Like() string
- func (s S) MustID() ID
- func (s S) RegexpSplit(expr string) ([]string, error)
- func (s S) Replace(source, target string) S
- func (s S) SplitBy(sep string) []string
- func (s S) SplitLines() (SS, error)
- func (s S) String() string
- func (s S) ToLower() S
- func (s S) ToUpper() S
- func (s S) Trim() S
- type SS
- func (ss SS) Append(s ...string) SS
- func (ss SS) Clone() SS
- func (ss SS) Dedup(transfers ...func(input string) (string, bool)) SS
- func (ss SS) DedupIn(transfers ...func(input string) (string, bool)) SS
- func (ss SS) Has(s string) bool
- func (ss SS) Join(sep string) string
- func (ss SS) Map() KSet[string]
- func (ss SS) Matchs(str string) bool
- func (ss SS) Remove(strs ...string) SS
- func (ss SS) Slice() []string
- func (ss SS) Sort() SS
- type Time
- func NewDate(year int, month time.Month, day, hour, min, sec int) Time
- func NewFullDate(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time
- func NewTime(t time.Time) Time
- func NewUnixTime(ts int64) Time
- func Now() Time
- func ParseTime(layout, value string) (Time, error)
- func ZeroTime() Time
- func (t Time) AddDate(year, month, day int) Time
- func (t Time) After(d time.Duration) Time
- func (t Time) Before(d time.Duration) Time
- func (t Time) Compare(o Time) int
- func (t Time) CurrentHour() Time
- func (t Time) CurrentRound(interval time.Duration) Time
- func (t Time) Day() int
- func (t Time) DetailString() string
- func (t Time) Equal(o Time) bool
- func (t Time) FromUnix(seconds int64) Time
- func (t Time) HourAfter(d time.Duration) Time
- func (t Time) IsZero() bool
- func (t Time) MarshalJSON() ([]byte, error)
- func (t Time) Month() time.Month
- func (t Time) NNUnixMilli() int64
- func (t Time) NextHour() Time
- func (t Time) NextRound(interval time.Duration) Time
- func (t *Time) Scan(value any) error
- func (t Time) String() string
- func (t Time) Sub(o Time) time.Duration
- func (t Time) Time() time.Time
- func (t Time) ToDate() Date
- func (t Time) ToNullTime() NullTime
- func (t Time) UTCString() string
- func (t Time) Unix() int64
- func (t Time) UnixMilli() int64
- func (t Time) UnixMilliString() string
- func (t Time) UnixString() string
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t Time) Value() (driver.Value, error)
- func (t Time) Year() int
- type Version
Constants ¶
const ( TimeTruncater = time.Millisecond DefaultTimeFormat = "2006-01-02 15:04:05 MST" TimeFormatWithMS = "2006-01-02 15:04:05.000 MST" DefaultParseLayout = time.DateTime DateTruncater = 24 * time.Hour DefaultDateFormat = time.DateOnly )
const (
// QRCodeDefaultLogoCover is the default logo cover ratio when logo is enabled.
QRCodeDefaultLogoCover = 0.20
)
Variables ¶
var ( ErrNilSource = errors.New("tools: nil source value") ErrNilValue = errors.New("tools: nil value") )
var ( ErrMissingText = errors.New("tools/qr: text is missing") ErrOutputPathEmpty = errors.New("tools/qr: output path cannot be empty") ErrOutputWriterNil = errors.New("tools/qr: output writer cannot be nil") ErrLogoSourceConflict = errors.New("tools/qr: logo source conflict") ErrLogoCoverNeedsLogo = errors.New("tools/qr: logo-cover requires logo") )
Functions ¶
func AllMapValueSlices ¶ added in v0.1.3
func AllMapValueSlices[K comparable, T comparable](m map[K][]T, needDedup ...bool) []T
func GenerateQRCode ¶ added in v0.2.0
func GenerateQRCode(text, output string, options QRCodeOptions) error
GenerateQRCode generates a QR image file with explicit text and options.
func GenerateQRCodeToWriter ¶ added in v0.2.0
func GenerateQRCodeToWriter(text string, output io.Writer, options QRCodeOptions) error
GenerateQRCodeToWriter generates a QR code PNG to writer with explicit text and options.
func IsByteSlice ¶ added in v0.1.0
func IsDefaultZero ¶ added in v0.1.0
func JsonPrettyString ¶ added in v0.0.5
func JsonString ¶
func MustJsonPrettyString ¶ added in v0.0.5
func MustJsonString ¶ added in v0.0.5
func NewIDValuer ¶ added in v0.1.1
func RandomBytes ¶ added in v0.1.2
func RemoveFile ¶ added in v0.1.2
func SplitNetAddr ¶ added in v0.1.1
SplitNetAddr like host:port to host and port if there's no valid host exists, return "" if there's no valid port exists, return -1
func ValidAndCreateDir ¶ added in v0.1.1
ValidAndCreateDir 将传入的绝对路径pstr当作文件目录,确认其存在,如果不存在则创建。并返回包含最后的路径分隔符的绝对路径字符串
func VariadicParam ¶ added in v0.1.1
func VariadicParam[T any](params []T, defaultValue ...T) T
Types ¶
type Date ¶ added in v0.1.2
func (Date) MarshalJSON ¶ added in v0.1.2
func (*Date) UnmarshalJSON ¶ added in v0.1.2
type Exister ¶ added in v0.1.2
type Exister[K comparable] interface { IsExist(k K) bool }
type JSONArray ¶ added in v0.0.6
type JSONArray[T comparable] []T
func NewJSONArray ¶ added in v0.0.6
func NewJSONArray[T comparable](data JSON) (ja JSONArray[T], err error)
func (JSONArray[T]) MarshalJSON ¶ added in v0.0.6
func (JSONArray[T]) ToNotNullJSON ¶ added in v0.0.6
func (ja JSONArray[T]) ToNotNullJSON() (NotNullJSON, error)
type JSONBuilder ¶
type JSONBuilder struct{}
func (JSONBuilder) FromString ¶
func (b JSONBuilder) FromString(jsonStr string) (JSON, error)
func (JSONBuilder) NoErrObj ¶
func (b JSONBuilder) NoErrObj(obj any) JSON
func (JSONBuilder) NoErrString ¶
func (b JSONBuilder) NoErrString(jsonStr string) JSON
type KKMap ¶
type KKMap[K1 comparable, K2 comparable, V any] map[K1]map[K2]V
func (KKMap[K1, K2, V]) IsExistKey ¶ added in v0.0.5
type KMap ¶
type KMap[K comparable, V any] map[K]V
func (KMap[K, V]) ExistingList ¶ added in v0.0.5
func (km KMap[K, V]) ExistingList(keys ...K) []V
func (KMap[K, V]) RangeSubMap ¶ added in v0.1.2
type KSet ¶
type KSet[K comparable] map[K]struct{}
func NewKSet ¶ added in v0.1.2
func NewKSet[K comparable](ks ...K) KSet[K]
func (KSet[K]) ExsitingList ¶ added in v0.0.5
func (km KSet[K]) ExsitingList(ks ...K) []K
func (KSet[K]) RangeSubSet ¶ added in v0.1.2
type KV ¶
type KV[K comparable, V any] struct{}
func (KV[K, V]) KeyNotInMap ¶
func (KV[K, V]) KeyNotInMap(m map[K]V, ks ...K) []K
type List ¶ added in v0.1.2
type List[T any] struct { // contains filtered or unexported fields }
List represents a doubly linked list. The zero value for List is an empty list ready to use.
func (*List[T]) Back ¶ added in v0.1.2
func (l *List[T]) Back() *ListElement[T]
Back returns the last element of list l or nil if the list is empty.
func (*List[T]) Front ¶ added in v0.1.2
func (l *List[T]) Front() *ListElement[T]
Front returns the first element of list l or nil if the list is empty.
func (*List[T]) Init ¶ added in v0.1.2
func (l *List[T]) Init() *List[T]
Init initializes or clears list l.
func (*List[T]) InsertAfter ¶ added in v0.1.2
func (l *List[T]) InsertAfter(v T, mark *ListElement[T]) *ListElement[T]
InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.
func (*List[T]) InsertBefore ¶ added in v0.1.2
func (l *List[T]) InsertBefore(v T, mark *ListElement[T]) *ListElement[T]
InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.
func (*List[T]) Len ¶ added in v0.1.2
func (l *List[T]) Len() int
Len returns the number of elements of list l. The complexity is O(1).
func (*List[T]) MoveAfter ¶ added in v0.1.2
func (l *List[T]) MoveAfter(e, mark *ListElement[T])
MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*List[T]) MoveBefore ¶ added in v0.1.2
func (l *List[T]) MoveBefore(e, mark *ListElement[T])
MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*List[T]) MoveToBack ¶ added in v0.1.2
func (l *List[T]) MoveToBack(e *ListElement[T])
MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.
func (*List[T]) MoveToFront ¶ added in v0.1.2
func (l *List[T]) MoveToFront(e *ListElement[T])
MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.
func (*List[T]) PushBack ¶ added in v0.1.2
func (l *List[T]) PushBack(v T) *ListElement[T]
PushBack inserts a new element e with value v at the back of list l and returns e.
func (*List[T]) PushBackList ¶ added in v0.1.2
func (l *List[T]) PushBackList(other *List[T])
PushBackList inserts a copy of another list at the back of list l. The lists l and other may be the same. They must not be nil.
func (*List[T]) PushFront ¶ added in v0.1.2
func (l *List[T]) PushFront(v T) *ListElement[T]
PushFront inserts a new element e with value v at the front of list l and returns e.
func (*List[T]) PushFrontList ¶ added in v0.1.2
func (l *List[T]) PushFrontList(other *List[T])
PushFrontList inserts a copy of another list at the front of list l. The lists l and other may be the same. They must not be nil.
func (*List[T]) Remove ¶ added in v0.1.2
func (l *List[T]) Remove(e *ListElement[T]) T
Remove removes e from l if e is an element of list l. It returns the element value e.value. The element must not be nil.
type ListElement ¶ added in v0.1.2
type ListElement[T any] struct { // The value stored with this element. Value T // contains filtered or unexported fields }
ListElement is an element of a linked list.
func (*ListElement[T]) Next ¶ added in v0.1.2
func (e *ListElement[T]) Next() *ListElement[T]
func (*ListElement[T]) Prev ¶ added in v0.1.2
func (e *ListElement[T]) Prev() *ListElement[T]
Prev returns the previous list element or nil.
type NotNullJSON ¶
type NotNullJSON JSON
func (*NotNullJSON) Bytes ¶
func (n *NotNullJSON) Bytes() []byte
func (*NotNullJSON) Clone ¶
func (n *NotNullJSON) Clone() NotNullJSON
func (*NotNullJSON) Equal ¶
func (n *NotNullJSON) Equal(o *NotNullJSON) bool
func (NotNullJSON) IsNull ¶
func (n NotNullJSON) IsNull() bool
func (NotNullJSON) MarshalJSON ¶
func (n NotNullJSON) MarshalJSON() ([]byte, error)
func (*NotNullJSON) Scan ¶
func (n *NotNullJSON) Scan(value interface{}) error
func (*NotNullJSON) String ¶
func (n *NotNullJSON) String() string
func (NotNullJSON) ToJSON ¶ added in v0.0.5
func (n NotNullJSON) ToJSON() JSON
func (*NotNullJSON) UnmarshalJSON ¶
func (n *NotNullJSON) UnmarshalJSON(data []byte) error
type NullInt32 ¶ added in v0.1.1
func LE0NullInt32 ¶ added in v0.1.1
LE0NullInt32 Less or Equal 0 is Null, or not Null
func NewNullInt32 ¶ added in v0.1.2
func (NullInt32) IsAvailable ¶ added in v0.1.1
func (NullInt32) MarshalJSON ¶ added in v0.1.1
func (*NullInt32) UnmarshalJSON ¶ added in v0.1.1
type NullInt64 ¶ added in v0.1.1
func LE0NullInt64 ¶ added in v0.1.1
LE0NullInt64 Less or Equal to 0 is Null, or not Null
func NewNullInt64 ¶ added in v0.1.2
func (NullInt64) IsAvailable ¶ added in v0.1.1
func (NullInt64) MarshalJSON ¶ added in v0.1.1
func (*NullInt64) UnmarshalJSON ¶ added in v0.1.1
type NullString ¶ added in v0.1.1
func EmptyNullString ¶ added in v0.1.2
func EmptyNullString(s string) NullString
func NewNullString ¶ added in v0.1.2
func NewNullString(s string, valid bool) NullString
func (NullString) IsNull ¶ added in v0.1.1
func (n NullString) IsNull() bool
func (NullString) MarshalJSON ¶ added in v0.1.1
func (n NullString) MarshalJSON() ([]byte, error)
func (*NullString) Scan ¶ added in v0.1.1
func (n *NullString) Scan(value any) error
func (NullString) String ¶ added in v0.1.1
func (n NullString) String() string
func (*NullString) UnmarshalJSON ¶ added in v0.1.1
func (n *NullString) UnmarshalJSON(data []byte) error
type NullTime ¶ added in v0.1.1
func NewNullTime ¶ added in v0.1.1
func NewNullUnixTime ¶ added in v0.1.1
func ParseNullTime ¶ added in v0.1.2
func (NullTime) MarshalJSON ¶ added in v0.1.1
func (*NullTime) UnmarshalJSON ¶ added in v0.1.1
type OrderMap ¶ added in v0.1.2
type OrderMap[K comparable, V any] struct { // contains filtered or unexported fields }
OrderMap 一个按插入顺序遍历的map,也可以通过给出的排序器顺序遍历。线程不安全。
func NewOrderMap ¶ added in v0.1.2
func NewOrderMap[K comparable, V any]() *OrderMap[K, V]
type QRCodeOptions ¶ added in v0.2.0
type QRCodeOptions struct {
Level QRCodeRecoveryLevel
// Version accepts 0..40. 0 means auto-select the minimum valid version.
Version int
// Size is the output PNG width/height in pixels.
Size int
// LogoCover is the requested logo area ratio over QR code area.
// When logo is present and LogoCover is 0, QRCodeDefaultLogoCover is used.
LogoCover float64
// DisableForceHighestWhenLogo disables the default behavior that upgrades
// recovery level to highest when logo is present.
DisableForceHighestWhenLogo bool
// LogoPath is an optional logo image file path.
LogoPath string
// LogoReader is an optional logo image reader.
// Set either LogoPath or LogoReader, not both.
LogoReader io.Reader
}
QRCodeOptions contains common QR generation options shared by file/writer APIs.
type QRCodeRecoveryLevel ¶ added in v0.2.0
type QRCodeRecoveryLevel int
QRCodeRecoveryLevel is the QR error correction level used by this package's public API.
const ( QRCodeRecoveryLow QRCodeRecoveryLevel = QRCodeRecoveryLevel(qrcode.Low) QRCodeRecoveryMedium QRCodeRecoveryLevel = QRCodeRecoveryLevel(qrcode.Medium) QRCodeRecoveryHigh QRCodeRecoveryLevel = QRCodeRecoveryLevel(qrcode.High) QRCodeRecoveryHighest QRCodeRecoveryLevel = QRCodeRecoveryLevel(qrcode.Highest) )
type S ¶ added in v0.1.0
type S string
func (S) CamelToSnake ¶ added in v0.1.0
func (S) FirstRuneString ¶ added in v0.1.0
func (S) SplitLines ¶ added in v0.1.0
type SS ¶
type SS []string
func (SS) Dedup ¶
Dedup applies transfer to each element, filters out invalid values, keeps the first occurrence order, and returns a new deduplicated slice.
func (SS) DedupIn ¶ added in v0.1.4
DedupIn applies transfer and deduplicates elements in place. It rewrites the prefix of ss with unique values in first occurrence order and returns the resulting subslice.
type Time ¶ added in v0.1.0
Time mysql timestamp precision to seconds using Now(), NewTime(), NewUnixTime() or ZeroTime() to create Time which is without monotonic clock reading (by truncating millisecond)
func NewFullDate ¶ added in v0.1.0
func NewUnixTime ¶ added in v0.1.0
func ZeroTime ¶ added in v0.1.0
func ZeroTime() Time
ZeroTime according to time.Time document, which is Jan 1 year 1.
func (Time) CurrentHour ¶ added in v0.1.0
func (Time) DetailString ¶ added in v0.1.0
func (Time) MarshalJSON ¶ added in v0.1.0
func (Time) NNUnixMilli ¶ added in v0.1.0
NNUnixMilli not negetive unix milli
func (Time) ToNullTime ¶ added in v0.1.2
func (Time) UnixMilliString ¶ added in v0.1.0
func (Time) UnixString ¶ added in v0.1.0
func (*Time) UnmarshalJSON ¶ added in v0.1.0
type Version ¶ added in v0.1.1
type Version int64
Version 使用64位有符号整数,分为3部分,major.minor.patch,每部分使用6位数,最大支持999,999 patch 使用十进制最低6位数 minor 使用十进制第12位到第7位数 major 使用十进制第18位到第13位数 符号为+时,为正式版,为-时,为alpha版,0.0.0没有alpha版