rice

package module
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 43 Imported by: 0

README

rice

import "github.com/woxingliu/rice"
go mod tidy

Usage

Database

Postgresql 初始化

pg, err := rice.NewPostgres("postgres://postgres:123456@localhost:5432/test?sslmode=disable")
if err != nil {
	return err
}
defer pg.Close()

MariaDB 初始化

mariadb, err := rice.NewMaria("root:root@tcp(localhost:3306)/test?parseTime=True&loc=Local&charset=utf8mb4")
if err != nil {
	return err
}
defer mariadb.Close()

Redis 初始化

rdb, err := rice.NewRedis("localhost:6379")
if err != nil {
	return err
}
defer rdb.Close()

Pretty 封装了 database/sql 标准库里 sql.DBsql.Tx 共有的一些方法,使用 Pretty 时可以在 repo 的上一层初始化,使 repo 层既可以执行 sql.DB 的方法,也可以执行 sql.Tx 的方法,下面是示例。

package repo

type Repo struct {
	Pretty
}

func NewRepo(db Pretty) Repo {
	return Repo{Pretty: db}
}

func (r Repo) Create() error { return nil }

func (r Repo) Update() error { return nil }

func (r Repo) Find() error { return nil }
package usecase

func UseCaseDB() {

	db := NewMariaDB()

	dbRepo := NewRepo(db)

	dbRepo.Find()
}

func UseCaseTx() error {

	tx, _ := NewMariaTx()
	defer tx.Rollback()

	txRepo := NewRepo(tx)

	err := txRepo.Create()
	if err != nil {
		return err
	}

	err = txRepo.Update()
	if err != nil {
		return err
	}

	if err := tx.Commit(); err != nil {
		return err
	}

	return nil
}

Documentation

Index

Constants

View Source
const (
	// LowerLetters is the list of lowercase letters.
	LowerLetters = "abcdefghijklmnopqrstuvwxyz"

	// UpperLetters is the list of uppercase letters.
	UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

	// Digits is the list of permitted digits.
	Digits = "0123456789"

	// Symbols is the list of symbols.
	Symbols = "~!@#$%^&*()_+`-={}|[]\\:\"<>?,./"
)
View Source
const (
	GmailSmtp    = "smtp.gmail.com"
	GmailTLSPort = 587
	GmailSSLPort = 465
)

Variables

View Source
var (
	// Cert is a self signed certificate
	Cert tls.Certificate
	// CertPool contains the self signed certificate
	CertPool *x509.CertPool
)
View Source
var (
	InvalidTransition = errors.New("invalid transition")
)
View Source
var (
	Logger *zerolog.Logger = &zerolog.Logger{}
)

Functions

func BCryptCompareHashAndPassword added in v0.0.9

func BCryptCompareHashAndPassword(pwd, hash string) bool

BCryptCompareHashAndPassword true or false

func BCryptGenerateFromPassword added in v0.0.9

func BCryptGenerateFromPassword(pwd string) (string, error)

BCryptGenerateFromPassword generate hash from password

func BetweenDays added in v0.0.15

func BetweenDays(startTime, endTime time.Time) int64

BetweenDays 两个时间之间隔了多少天 startTime >= endTime

func ByteString

func ByteString(b []byte) string

ByteString []byte to string

func BytesNewBufferString added in v0.0.9

func BytesNewBufferString(b []byte) string

BytesNewBufferString []byte to string

func CertInit added in v0.0.16

func CertInit(certPEM, keyPEM []byte) error

func CheckPassword added in v0.0.15

func CheckPassword(pwd string) error

func CronRun added in v0.0.14

func CronRun(ctx context.Context, corn string, task ...func()) error

func CronRunM added in v0.0.15

func CronRunM(ctx context.Context, corn string, task ...func()) error

func DeleteStruct added in v0.0.15

func DeleteStruct(key string) error

func DeleteStructByPrefix added in v0.0.15

func DeleteStructByPrefix(prefix string) error

func ErrorWrap added in v0.0.15

func ErrorWrap(w http.ResponseWriter, code int, err error, msg ...string) error

func FullPassword added in v0.0.17

func FullPassword(level, length int) (string, error)

func GetHostname added in v0.0.15

func GetHostname() string

func GetString added in v0.0.15

func GetString(key string) string

func GetStruct added in v0.0.15

func GetStruct[T any](key string) (T, error)

GetStruct 如果 key 不存在,返回 error; 如果 key 为空,返回零值

func HGetStruct added in v0.0.15

func HGetStruct[T any](key, field string) (T, error)

func HMCompare added in v0.0.15

func HMCompare(h1, m1, h2, m2 int) bool

HMCompare 如果 1 > 2 return true 小时和分钟 比较大小

func HSetStruct added in v0.0.15

func HSetStruct(key, field string, data any) error

func HttpGet added in v0.0.14

func HttpGet[T any](url string) (T, error)

func In added in v0.0.15

func In[T comparable](e T, s []T) bool

In e 在 s 中吗? true 在,false 不在

func LoggerInit added in v0.0.15

func LoggerInit(level, path string)

func MaxNumber added in v0.0.15

func MaxNumber[T Numbers](n ...T) T

MaxNumber booleans, numbers, strings, pointers, channels, arrays

func MinNumber added in v0.0.15

func MinNumber[T Numbers](n ...T) T

func NewGmailAuth added in v0.0.15

func NewGmailAuth(username, password string) smtp.Auth

func NewLumberjackLogger added in v0.0.13

func NewLumberjackLogger(fileName string, opts ...LumberjackOption) io.Writer

func NextStringId added in v0.0.15

func NextStringId() string

func NotIn added in v0.0.15

func NotIn[T comparable](e T, s []T) bool

NotIn e 不在 s 中吗? true 不在, false 在

func RandInt added in v0.0.13

func RandInt(max int64) (int64, error)

RandInt 生成一个真随机数

func RemoveDuplicates added in v0.0.15

func RemoveDuplicates[T comparable](s1 []T) []T

RemoveDuplicates slice 去重

func RemoveDuplicatesInPlace added in v0.0.15

func RemoveDuplicatesInPlace(userIDs []int64) []int64

RemoveDuplicatesInPlace slice 就地去重

func SetString added in v0.0.15

func SetString(key, value string, expiration ...time.Duration) error

func SetStruct added in v0.0.15

func SetStruct(key string, data any, expiration ...time.Duration) error

func SliceDifference added in v0.0.13

func SliceDifference[T comparable](a, b []T) []T

SliceDifference 取 a 中有,而 b 中没有的

func SliceDifferenceBoth added in v0.0.16

func SliceDifferenceBoth[T comparable](slice1, slice2 []T) []T

SliceDifferenceBoth 取 slice1, slice2 的差集

func SliceIn added in v0.0.15

func SliceIn[T comparable](e T, s []T) bool

SliceIn e 是否在 s 中

func SliceIntersection added in v0.0.13

func SliceIntersection[T comparable](s1, s2 []T) (inter []T)

SliceIntersection 两个 slice 的交集

func SlicePtrToSlice added in v0.0.15

func SlicePtrToSlice[T any](s []*T) []T

func SliceRemoveIndex added in v0.0.10

func SliceRemoveIndex[T any](s []T, index int) []T

SliceRemoveIndex 移除 slice 中的一个元素

func SliceRemoveIndexUnOrder added in v0.0.10

func SliceRemoveIndexUnOrder[T any](s []T, i int) []T

SliceRemoveIndexUnOrder 移除 slice 中的一个元素(无序,但效率高)

func SliceReverse added in v0.0.16

func SliceReverse[T any](slice []T)

SliceReverse 反转 slice

func SliceToSlicePtr added in v0.0.15

func SliceToSlicePtr[T any](s []T) []*T

func StrconvFormatInt

func StrconvFormatInt(i int64) string

StrconvFormatInt 1645270804 to "1645270804"

func StrconvParseFloat added in v0.0.8

func StrconvParseFloat(i int) (float64, error)

StrconvParseFloat int/100 to float64 保留 2 位小数点 example: 2333 -> 23.33

func StrconvParseInt

func StrconvParseInt(s string) (int64, error)

StrconvParseInt "1645270804" to 1645270804

func StringByte

func StringByte(s string) []byte

StringByte string to []byte

func StringByteUnsafe added in v0.0.13

func StringByteUnsafe(s string) []byte

StringByteUnsafe string to []byte

func TickerRun added in v0.0.14

func TickerRun(ctx context.Context, d time.Duration, task ...Task) error

func TickerRunContext added in v0.0.15

func TickerRunContext(ctx context.Context, d time.Duration, task ...TaskContext) error

TickerRunContext 立即开始以 ticker 的方式执行 task

func TickerRunWithStartTimeContext added in v0.0.15

func TickerRunWithStartTimeContext(ctx context.Context, wg *sync.WaitGroup, tm time.Time, d time.Duration, task ...TaskContext) error

TickerRunWithStartTimeContext 到达 tm 时间之后,开始以 tikcer 的方式执行 task

func TimeCompare added in v0.0.15

func TimeCompare(t1, t2 time.Time) bool

TimeCompare 如果 t1>t2, return true, 如果 t1 <= t2, return false

func TimeExistIntersection added in v0.0.13

func TimeExistIntersection(startTime, endTime time.Time, anotherStartTime, anotherEndTime time.Time) bool

TimeExistIntersection 两个时间段是否有交集 false 没有交集,true 有交集

func TimeFormat

func TimeFormat(tm time.Time) string

TimeFormat time.Time to "2006-01-02 15:04:05"

func TimeFormatDate added in v0.0.13

func TimeFormatDate(tm time.Time) string

TimeFormatDate time to date

func TimeNowFormat

func TimeNowFormat() string

TimeNowFormat time.Time to "2006-01-02 15:04:05"

func TimeParseDate added in v0.0.13

func TimeParseDate(date string) (time.Time, error)

TimeParseDate string date to time date

func TimeParseDatetime added in v0.0.15

func TimeParseDatetime(datetime string) (time.Time, error)

func TimeUnixFormatDate added in v0.0.15

func TimeUnixFormatDate(timestamp int64) string

TimeUnixFormatDate timestamp to date

func TimeUnixFormatDatetime added in v0.0.15

func TimeUnixFormatDatetime(timestamp int64) string

TimeUnixFormatDatetime time to datetime

func TimerRun added in v0.0.14

func TimerRun(ctx context.Context, tm time.Time, task ...Task) error

func TimestampExistIntersection added in v0.0.13

func TimestampExistIntersection(startTime, endTime int64, anotherStartTime, anotherEndTime int64) bool

TimestampExistIntersection 两个时间段是否有交集 false 没有交集,true 有交集

func TodayZeroTime added in v0.0.16

func TodayZeroTime() time.Time

func TodayZeroTimestamp added in v0.0.16

func TodayZeroTimestamp() int64

func UnWrapBody added in v0.0.15

func UnWrapBody[T any](r *http.Request) (*T, error)

func UnWrapURL added in v0.0.15

func UnWrapURL(r *http.Request) (map[string]any, error)

func Wrap added in v0.0.15

func Wrap(w http.ResponseWriter, data any, msg ...string) error

func ZeroTime added in v0.0.16

func ZeroTime(tm time.Time) time.Time

func ZeroTimestamp added in v0.0.16

func ZeroTimestamp(ts int64) int64

Types

type AESCrypter added in v0.0.16

type AESCrypter interface {
	Encrypt(keyString, plainString string) (string, error)
	Decrypt(keyString, cipherString string) (string, error)
}

func NewCTRCrypt added in v0.0.17

func NewCTRCrypt() AESCrypter

type ApiWrapper added in v0.0.15

type ApiWrapper struct {
	Code int    `json:"code"`
	Data any    `json:"data"`
	Msg  string `json:"msg"`
}

type AsyncError added in v0.0.15

type AsyncError struct {
	Err error
}

AsyncError is returned by FSM.Event() when a callback have initiated an asynchronous state transition.

func (AsyncError) Error added in v0.0.15

func (e AsyncError) Error() string

type CTRCrypt added in v0.0.16

type CTRCrypt struct{}

func (*CTRCrypt) Decrypt added in v0.0.17

func (*CTRCrypt) Decrypt(keyString, cipherString string) (string, error)

func (*CTRCrypt) Encrypt added in v0.0.17

func (*CTRCrypt) Encrypt(keyString, plainString string) (string, error)

type Callback added in v0.0.15

type Callback func(*Event)

type CallbackKey added in v0.0.15

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

type CallbackType added in v0.0.15

type CallbackType int
const (
	None CallbackType = iota
	BeforeEvent
	LeaveState
	EnterState
	AfterEvent
)

type Callbacks added in v0.0.15

type Callbacks map[string]Callback

type CanceledError added in v0.0.15

type CanceledError struct {
	Err error
}

CanceledError is returned by FSM.Event() when a callback have canceled a transition.

func (CanceledError) Error added in v0.0.15

func (e CanceledError) Error() string

type Event added in v0.0.15

type Event struct {
	FSM   *FSM
	Event EventType
	Src   StateType
	Dst   StateType
	Err   error
	Args  []interface{}
	// contains filtered or unexported fields
}

Event is the info that get passed as a reference in the callbacks.

type EventDesc added in v0.0.15

type EventDesc struct {
	Name EventType
	Src  []StateType
	Dst  StateType
}

type EventKey added in v0.0.15

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

type EventType added in v0.0.15

type EventType int

type FSM added in v0.0.15

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

func NewFSM added in v0.0.15

func NewFSM(initState StateType, events []EventDesc, callbacks map[CallbackKey]Callback) *FSM

func (*FSM) Current added in v0.0.15

func (fsm *FSM) Current() StateType

func (*FSM) Event added in v0.0.15

func (fsm *FSM) Event(eventType EventType, args ...any) error

func (*FSM) Is added in v0.0.15

func (fsm *FSM) Is(state StateType) bool

func (*FSM) Metadata added in v0.0.15

func (f *FSM) Metadata(key string) (any, bool)

func (*FSM) Previous added in v0.0.15

func (fsm *FSM) Previous() StateType

func (*FSM) Transition added in v0.0.15

func (fsm *FSM) Transition(event EventType)

type FSMManage added in v0.0.15

type FSMManage struct{}

type FileStorage added in v0.0.15

type FileStorage struct {
	BasePath string
	Date     string
}

func NewFileStorage added in v0.0.15

func NewFileStorage(basePath, date string) *FileStorage

func (*FileStorage) Append added in v0.0.15

func (fs *FileStorage) Append(name string, data any) error

func (*FileStorage) Save added in v0.0.15

func (fs *FileStorage) Save(name string, data []byte) error

type FullPasswordConf added in v0.0.17

type FullPasswordConf struct {
	Length          int
	NumLowerLetters int
	NumUpperLetters int
	NumDigits       int
	NumSymbols      int
}

func SetLevel added in v0.0.17

func SetLevel(level, length int) FullPasswordConf

type IFSM added in v0.0.15

type IFSM interface{}

type Ider added in v0.0.15

type Ider interface {
	NextInt64Id() int64
	NextStringId() string
}

func NewUUID added in v0.0.15

func NewUUID() Ider

func NewXId added in v0.0.15

func NewXId() Ider

func NewYitId added in v0.0.15

func NewYitId() Ider

type InTransitionError added in v0.0.15

type InTransitionError struct {
	Event string
}

InTransitionError is returned by FSM.Event() when an asynchronous transition is already in progress.

func (InTransitionError) Error added in v0.0.15

func (e InTransitionError) Error() string

type InternalError added in v0.0.15

type InternalError struct{}

InternalError is returned by FSM.Event() and should never occur. It is a probably because of a bug.

func (InternalError) Error added in v0.0.15

func (e InternalError) Error() string

type InvalidEventError added in v0.0.15

type InvalidEventError struct {
	Event string
	State string
}

InvalidEventError is returned by FSM.Event() when the event cannot be called in the current state.

func (InvalidEventError) Error added in v0.0.15

func (e InvalidEventError) Error() string

type JsonUnmarshal added in v0.0.15

type JsonUnmarshal struct{}

func (*JsonUnmarshal) ReadConfig added in v0.0.15

func (j *JsonUnmarshal) ReadConfig(p []byte, v any) error

func (*JsonUnmarshal) ReadConfigFromFile added in v0.0.15

func (j *JsonUnmarshal) ReadConfigFromFile(path string, v any) error

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 Mail added in v0.0.15

type Mail struct {
	Auth smtp.Auth
	Host string
	Addr string
	From string
}

func (*Mail) SendMail added in v0.0.15

func (m *Mail) SendMail(subject, body string, to []string) error

type Mailer added in v0.0.15

type Mailer interface {
	SendMail(subject, body string, to []string) error
}

func NewMail added in v0.0.15

func NewMail(auth smtp.Auth, from, host string, port int) Mailer

type MariaDB added in v0.0.8

type MariaDB struct {
	// connAttempts int
	// connTimeout  time.Duration
	*sql.DB
}

func NewMaria added in v0.0.12

func NewMaria(dsn string, opts ...Option) (*MariaDB, error)

func (*MariaDB) Close added in v0.0.8

func (db *MariaDB) Close()

type NoTransitionError added in v0.0.15

type NoTransitionError struct {
	Err error
}

NoTransitionError is returned by FSM.Event() when no transition have happened, for example if the source and destination states are the same.

func (NoTransitionError) Error added in v0.0.15

func (e NoTransitionError) Error() string

type NotInTransitionError added in v0.0.15

type NotInTransitionError struct{}

NotInTransitionError is returned by FSM.Transition() when an asynchronous transition is not in progress.

func (NotInTransitionError) Error added in v0.0.15

func (e NotInTransitionError) Error() string

type Numbers added in v0.0.15

type Numbers interface {
	uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64 | float32 | float64 | int | uint
}

type Option added in v0.0.12

type Option func(*sql.DB)

func ConnMaxIdleTime added in v0.0.12

func ConnMaxIdleTime(d time.Duration) Option

ConnMaxIdleTime 一个连接空闲的最大时长

func ConnMaxLifetime added in v0.0.12

func ConnMaxLifetime(d time.Duration) Option

ConnMaxLifetime 一个连接使用的最大时长

func MaxIdleConns added in v0.0.12

func MaxIdleConns(size int) Option

MaxIdleConns 最大闲置的连接数

func MaxOpenConns added in v0.0.12

func MaxOpenConns(size int) Option

MaxOpenConns 最大打开的连接数

type Postgres added in v0.0.8

type Postgres struct {
	*sql.DB
}

func NewPostgres added in v0.0.12

func NewPostgres(dsn string, opts ...Option) (*Postgres, error)

func (*Postgres) Close added in v0.0.8

func (db *Postgres) Close()

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 NewMariaTx() (PrettyTx, error)

func NewMariaTxContext added in v0.0.12

func NewMariaTxContext(ctx context.Context) (PrettyTx, error)

func NewPostgresTx added in v0.0.12

func NewPostgresTx() (PrettyTx, error)

func NewPostgresTxContext added in v0.0.12

func NewPostgresTxContext(ctx context.Context) (PrettyTx, error)

type RSASign added in v0.0.17

type RSASign struct {
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

func (*RSASign) Sign added in v0.0.17

func (r *RSASign) Sign(data []byte) ([]byte, error)

func (*RSASign) Verify added in v0.0.17

func (r *RSASign) Verify(data []byte, signature []byte) error

type Redis added in v0.0.8

type Redis struct{ *redis.Client }

func NewRedis added in v0.0.12

func NewRedis(addr string, opts ...RedisOption) (*Redis, error)

func NewRedisDB added in v0.0.12

func NewRedisDB() *Redis

type RedisOption added in v0.0.10

type RedisOption func(*redis.Options)

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

type Server added in v0.0.15

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

Server -.

func NewHttpServer added in v0.0.15

func NewHttpServer(handler http.Handler, opts ...ServerOption) *Server

NewHttpServer -.

func (*Server) Notify added in v0.0.15

func (s *Server) Notify() <-chan error

Notify -.

func (*Server) Shutdown added in v0.0.15

func (s *Server) Shutdown() error

Shutdown -.

type ServerOption added in v0.0.15

type ServerOption func(*Server)

ServerOption -.

func Port added in v0.0.15

func Port(port string) ServerOption

Port -.

func ReadTimeout added in v0.0.15

func ReadTimeout(timeout time.Duration) ServerOption

ReadTimeout -.

func ShutdownTimeout added in v0.0.15

func ShutdownTimeout(timeout time.Duration) ServerOption

ShutdownTimeout -.

func WriteTimeout added in v0.0.15

func WriteTimeout(timeout time.Duration) ServerOption

WriteTimeout -.

type Signer added in v0.0.17

type Signer interface {
	Sign(data []byte) ([]byte, error)
	Verify(data []byte, signature []byte) error
}

func NewRSASignFromBytes added in v0.0.17

func NewRSASignFromBytes(privateKeyData, publicKeyData []byte) (Signer, error)

func NewRSASignFromFile added in v0.0.17

func NewRSASignFromFile(privateKeyFile, publicKeyFile string) (Signer, error)

type StateType added in v0.0.15

type StateType int

type Storage added in v0.0.15

type Storage interface {
	Save(name string, data []byte) error
	Append(name string, data any) error
}

type Task added in v0.0.14

type Task func() error

type TaskContext added in v0.0.15

type TaskContext func(ctx context.Context) error

type TomlUnmarshal added in v0.0.15

type TomlUnmarshal struct{}

func (*TomlUnmarshal) ReadConfig added in v0.0.15

func (t *TomlUnmarshal) ReadConfig(p []byte, v any) error

func (*TomlUnmarshal) ReadConfigFromFile added in v0.0.15

func (t *TomlUnmarshal) ReadConfigFromFile(path string, v any) error

type Transition added in v0.0.15

type Transition int

type UUID added in v0.0.15

type UUID struct{}

func (*UUID) NextInt64Id added in v0.0.15

func (u *UUID) NextInt64Id() int64

func (*UUID) NextStringId added in v0.0.15

func (u *UUID) NextStringId() string

type UnknownEventError added in v0.0.15

type UnknownEventError struct {
	Event string
}

UnknownEventError is returned by FSM.Event() when the event is not defined.

func (UnknownEventError) Error added in v0.0.15

func (e UnknownEventError) Error() string

type UnmarshalConfiger added in v0.0.15

type UnmarshalConfiger interface {
	ReadConfig(p []byte, v any) error
	ReadConfigFromFile(path string, v any) error
}

func NewJsonUnmarshal added in v0.0.15

func NewJsonUnmarshal() UnmarshalConfiger

func NewTomlUnmarshal added in v0.0.15

func NewTomlUnmarshal() UnmarshalConfiger

func NewYamlUnmarshal added in v0.0.15

func NewYamlUnmarshal() UnmarshalConfiger

type XId added in v0.0.15

type XId struct{}

func (*XId) NextInt64Id added in v0.0.15

func (x *XId) NextInt64Id() int64

func (*XId) NextStringId added in v0.0.15

func (x *XId) NextStringId() string

type YamlUnmarshal added in v0.0.15

type YamlUnmarshal struct{}

func (*YamlUnmarshal) ReadConfig added in v0.0.15

func (y *YamlUnmarshal) ReadConfig(p []byte, v any) error

func (*YamlUnmarshal) ReadConfigFromFile added in v0.0.15

func (y *YamlUnmarshal) ReadConfigFromFile(path string, v any) error

type YitId added in v0.0.15

type YitId struct{}

func (*YitId) NextInt64Id added in v0.0.15

func (n *YitId) NextInt64Id() int64

func (*YitId) NextStringId added in v0.0.15

func (n *YitId) NextStringId() string

Jump to

Keyboard shortcuts

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