Documentation
¶
Index ¶
- func AESDecrypt(key []byte, s string) (string, error)
- func AESEncrypt(key []byte, s string) (string, error)
- func AESNewCBCDecrypter(keyString, cipherString string) (string, error)
- func AESNewCBCEncrypter(keyString, plainString string) (string, error)
- func AESNewCFBDecrypter()
- func AESNewCFBEncrypter()
- func AESNewGCMDecrypt(keyString, nonceString, ciphertext string) (string, error)
- func AESNewGCMEncrypt(keyString, plaintext string) (string, error)
- func BCryptCompareHashAndPassword(pwd, hash string) bool
- func BCryptGenerateFromPassword(pwd string) (string, error)
- func ByteString(b []byte) string
- func BytesNewBufferString(b []byte) string
- func CronRun(ctx context.Context, corn string, task ...func()) error
- func FmtSprintfByte(b []byte) string
- func HttpGet(url string) ([]byte, error)
- func NewLumberjackLogger(fileName string, opts ...LumberjackOption) *lumberjack.Logger
- func NextId() string
- func RandInt(max int64) (int64, error)
- func SliceDifference[T comparable](a, b []T) []T
- func SliceIntersection[T comparable](s1, s2 []T) (inter []T)
- func SliceRemoveIndex[T any](s []T, index int) []T
- func SliceRemoveIndexUnOrder[T any](s []T, i int) []T
- func SliceSet[T comparable](s1 []T) []T
- func StrconvFormatInt(i int64) string
- func StrconvParseFloat(i int) (float64, error)
- func StrconvParseInt(s string) (int64, error)
- func StringByte(s string) []byte
- func StringByteUnsafe(s string) []byte
- func TickerRun(ctx context.Context, d time.Duration, task ...Task) error
- func TimeExistIntersection(startTime, endTime time.Time, anotherStartTime, anotherEndTime time.Time) bool
- func TimeFormat(tm time.Time) string
- func TimeFormatDate(tm time.Time) string
- func TimeNowFormat() string
- func TimeParse(s string) (time.Time, error)
- func TimeParseDate(date string) (time.Time, error)
- func TimeUnix(sec int64) time.Time
- func TimerRun(ctx context.Context, tm time.Time, task ...Task) error
- func TimestampExistIntersection(startTime, endTime int64, anotherStartTime, anotherEndTime int64) bool
- func UUIDNewString() string
- func XidNewString() string
- type Data
- type LumberjackOption
- type MariaDB
- type Option
- type Postgres
- type Pretty
- type PrettyDB
- type PrettyTx
- type Redis
- type RedisOption
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESNewCBCDecrypter ¶ added in v0.0.9
func AESNewCBCEncrypter ¶ added in v0.0.9
func AESNewCFBDecrypter ¶ added in v0.0.9
func AESNewCFBDecrypter()
func AESNewCFBEncrypter ¶ added in v0.0.9
func AESNewCFBEncrypter()
func AESNewGCMDecrypt ¶ added in v0.0.9
func AESNewGCMEncrypt ¶ added in v0.0.9
func BCryptCompareHashAndPassword ¶ added in v0.0.9
BCryptCompareHashAndPassword true or false
func BCryptGenerateFromPassword ¶ added in v0.0.9
BCryptGenerateFromPassword generate hash from password
func BytesNewBufferString ¶ added in v0.0.9
BytesNewBufferString []byte to string
func FmtSprintfByte ¶ added in v0.0.9
FmtSprintfByte []byte to string
func NewLumberjackLogger ¶ added in v0.0.13
func NewLumberjackLogger(fileName string, opts ...LumberjackOption) *lumberjack.Logger
func SliceDifference ¶ added in v0.0.13
func SliceDifference[T comparable](a, b []T) []T
SliceDifference 取 a 中有,而 b 中没有的
func SliceIntersection ¶ added in v0.0.13
func SliceIntersection[T comparable](s1, s2 []T) (inter []T)
SliceIntersection 两个 slice 的交集
func SliceRemoveIndex ¶ added in v0.0.10
SliceRemoveIndex 移除 slice 中的一个元素
func SliceRemoveIndexUnOrder ¶ added in v0.0.10
SliceRemoveIndexUnOrder 移除 slice 中的一个元素(无序,但效率高)
func StrconvFormatInt ¶
StrconvFormatInt 1645270804 to "1645270804"
func StrconvParseFloat ¶ added in v0.0.8
StrconvParseFloat int/100 to float64 保留 2 位小数点 example: 2333 -> 23.33
func StrconvParseInt ¶
StrconvParseInt "1645270804" to 1645270804
func StringByteUnsafe ¶ added in v0.0.13
StringByteUnsafe string to []byte
func TimeExistIntersection ¶ added in v0.0.13
func TimeExistIntersection(startTime, endTime time.Time, anotherStartTime, anotherEndTime time.Time) bool
TimeExistIntersection 两个时间段是否有交集 false 没有交集,true 有交集
func TimeFormat ¶
TimeFormat time.Time to "2006-01-02 15:04:05"
func TimeFormatDate ¶ added in v0.0.13
TimeFormatDate time to date
func TimeParseDate ¶ added in v0.0.13
TimeParseDate date to time
func TimestampExistIntersection ¶ added in v0.0.13
func TimestampExistIntersection(startTime, endTime int64, anotherStartTime, anotherEndTime int64) bool
IsHaveIntersectionTimestamp 两个时间段是否有交集 false 没有交集,true 有交集
func UUIDNewString ¶ added in v0.0.10
func UUIDNewString() string
UUIDNewString creates a new random UUID
func XidNewString ¶ added in v0.0.13
func XidNewString() string
Types ¶
type LumberjackOption ¶ added in v0.0.13
type LumberjackOption func(*lumberjack.Logger)
func Compress ¶ added in v0.0.13
func Compress(b bool) LumberjackOption
func LocalTime ¶ added in v0.0.13
func LocalTime(b bool) LumberjackOption
func MaxAge ¶ added in v0.0.13
func MaxAge(i int) LumberjackOption
func MaxBackups ¶ added in v0.0.13
func MaxBackups(i int) LumberjackOption
func MaxSize ¶ added in v0.0.13
func MaxSize(i int) LumberjackOption
type Option ¶ added in v0.0.12
func ConnMaxIdleTime ¶ added in v0.0.12
ConnMaxIdleTime 一个连接空闲的最大时长
func ConnMaxLifetime ¶ added in v0.0.12
ConnMaxLifetime 一个连接使用的最大时长
type Pretty ¶ added in v0.0.12
type Pretty interface {
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
Prepare(query string) (*sql.Stmt, error)
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
Exec(query string, args ...any) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
Query(query string, args ...any) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
QueryRow(query string, args ...any) *sql.Row
}
type PrettyDB ¶ added in v0.0.12
type PrettyDB interface {
Pretty
BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
Begin() (*sql.Tx, error)
}
func NewMariaDB ¶ added in v0.0.8
func NewMariaDB() PrettyDB
func NewPostgresDB ¶ added in v0.0.8
func NewPostgresDB() PrettyDB
type PrettyTx ¶ added in v0.0.12
type PrettyTx interface {
Pretty
Commit() error
Rollback() error
StmtContext(ctx context.Context, stmt *sql.Stmt) *sql.Stmt
Stmt(stmt *sql.Stmt) *sql.Stmt
}
func NewMariaTx ¶ added in v0.0.12
func NewMariaTxContext ¶ added in v0.0.12
func NewPostgresTx ¶ added in v0.0.12
type Redis ¶ added in v0.0.8
func NewRedisDB ¶ added in v0.0.12
func NewRedisDB() *Redis
func (*Redis) HGetStruct ¶ added in v0.0.13
func (*Redis) HSetStruct ¶ added in v0.0.13
type RedisOption ¶ added in v0.0.10
func RedisAddr ¶ added in v0.0.13
func RedisAddr(addr string) RedisOption
func RedisDB ¶ added in v0.0.10
func RedisDB(db int) RedisOption
func RedisPassword ¶ added in v0.0.10
func RedisPassword(pwd string) RedisOption
func RedisPoolSize ¶ added in v0.0.10
func RedisPoolSize(poolSize int) RedisOption
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package httpserver implements HTTP server.
|
Package httpserver implements HTTP server. |
|
rabbitmq
|
|