utils

package
v0.0.0-...-e5f04d6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualFloat

func EqualFloat(x, y, epsilon float64) bool

func FromBytes

func FromBytes(data []byte, obj any) error

func GenAppKey

func GenAppKey() string

GenAppKey 生成appKey

func GenAppSecret

func GenAppSecret(appKey, name string) (string, error)

GenAppSecret 生成appSecret sm3(appKey + name + timestamp + random)

func GenUuid

func GenUuid() string

func HashString

func HashString(s string) uint32

HashString get a unique value from a string

func StandardTime

func StandardTime(year int) (time.Time, time.Time)

StandardTime 获取冬令时起止时间

func ToBytes

func ToBytes(obj any) ([]byte, error)

Types

type File

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

func NewFile

func NewFile(filename string) *File

func (*File) AppendFile

func (f *File) AppendFile(buf []byte) error

AppendFile appends buf to a file

func (*File) Close

func (f *File) Close()

func (*File) LoadFile

func (f *File) LoadFile() ([]byte, error)

LoadFile reads all content from file

func (*File) SaveFile

func (f *File) SaveFile(buf []byte) error

SaveFile saves buf to a file

Jump to

Keyboard shortcuts

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