conf

package
v0.0.0-...-0818f1f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BuffPool = sync.Pool{
		New: func() interface{} {
			return bytes.NewBuffer([]byte{})
		},
	}
)

Functions

func AddToSlice

func AddToSlice(slice []interface{}, value interface{})

func Base64Decode

func Base64Decode(in string) string

func Base64Encode

func Base64Encode(in string) string

func BitIsSet

func BitIsSet(value uint32, position uint32) bool

func ComputeSlice

func ComputeSlice(slice []interface{}) int64

func CopyUint64Map

func CopyUint64Map(in map[uint64]uint64) map[uint64]uint64

func CopyUint64Slice

func CopyUint64Slice(input []uint64) []uint64

func Cross

func Cross(p1x, p1y, p2x, p2y, p3x, p3y int32) int32

func DelNum

func DelNum(a, b int32) int32

func DeleteToSlice

func DeleteToSlice(slice []interface{}, value interface{})

func GenGuid

func GenGuid() string

func GetCurDir

func GetCurDir() string

GetCurDir 获取当前文件执行的路径

func GetIP

func GetIP() string

func GetIPv4ByInterface

func GetIPv4ByInterface(name string) ([]string, error)

GetIPv4ByInterface return IPv4 address from a specific interface IPv4 addresses

func GetMd5String

func GetMd5String(s string) string

func InSlice

func InSlice(slice interface{}, value interface{}) bool

func InitCreateID

func InitCreateID(SevrerID int64)

func InitSliceSize

func InitSliceSize(dst interface{}, size int)

初始化切片大小,传入指针地址

func InitStructNext

func InitStructNext(input interface{}, reset, next bool)

补全或重置结构成员,成员小写不能赋值

func IsDirExists

func IsDirExists(path string) bool

func IsFileExists

func IsFileExists(file string) bool

func IsSliceContant

func IsSliceContant(slice []interface{}, value interface{}) bool
func Link(args ...interface{}) (ret string)

func LocalIPv4s

func LocalIPv4s() ([]string, error)

LocalIPs return all non-loopback IPv4 addresses

func Max

func Max(a, b int32) int32

func MemSet

func MemSet(s unsafe.Pointer, c byte, n uintptr)

func Min

func Min(a, b int32) int32

func NewStructPtrAndNext

func NewStructPtrAndNext(dst interface{})

-------------------------------------------------------------------------------

func NextID

func NextID() (ret uint64)

func ReadFile

func ReadFile(path, gbk, sep string, f func([]string))

func ReadYamlFile

func ReadYamlFile(fpath, filename string, cur interface{})

func ResetBit

func ResetBit(value *uint32, position uint32)

func Segment

func Segment(p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y int32) bool

func SetBit

func SetBit(value *uint32, position uint32)

func StatueFuncArrayToMap

func StatueFuncArrayToMap(keys []string, values []uint32) map[string]uint32

* @brief 雕像加成key-value array转换为map

func ToBool

func ToBool(i interface{}) bool

-------------------------------------------------------------------------------

func ToBytes

func ToBytes(in interface{}) []byte

func ToDuration

func ToDuration(i interface{}) time.Duration

func ToFloat64

func ToFloat64(i interface{}) float64

func ToInt32

func ToInt32(i interface{}) int32

func ToInt64

func ToInt64(i interface{}) int64

func ToSlice

func ToSlice(i interface{}) []interface{}

func ToString

func ToString(i interface{}) string

func ToStringMap

func ToStringMap(i interface{}) map[string]interface{}

func ToStringMapString

func ToStringMapString(i interface{}) map[string]string

func ToStringSlice

func ToStringSlice(i interface{}) (ret []string)

func ToTime

func ToTime(i interface{}) time.Time
func UnLink(d string) (ret []string)

func UpdateStructNext

func UpdateStructNext(ev reflect.Value, reset bool, next bool)

reset强制重置 next:下级初始化

func WriteYamlFile

func WriteYamlFile(path, filename string, cur interface{})

Types

type Api_toml

type Api_toml struct{}

func (*Api_toml) Read

func (*Api_toml) Read(fpath string, v interface{})

func (*Api_toml) Write

func (*Api_toml) Write(fpath string, v interface{})

type Api_yaml

type Api_yaml struct{}

func (*Api_yaml) Read

func (*Api_yaml) Read(fpath string, v interface{})

func (*Api_yaml) Write

func (*Api_yaml) Write(fpath string, v interface{})

type Basic

type Basic struct {
	sync.RWMutex
	Isdirty bool
}

type D

type D struct {
	*viper.Viper
	Ver int32
	Safe
	Sep string
}

func LoadFile

func LoadFile(fpath, filename, Type string) (config *D)

func LoadStruct

func LoadStruct(name string, d interface{}) (config *D)

func LoadYamlString

func LoadYamlString(d string) (config *D)

func NewConf

func NewConf() (ret *D)

func (*D) All

func (self *D) All() (ret map[string]interface{})

func (*D) GetMap

func (self *D) GetMap(key ...interface{}) (ret map[string]bool)
func (self *D) Link(args ...interface{}) (ret string)

func (*D) Loadxlsx

func (self *D) Loadxlsx(file string)

func (*D) SaveData

func (self *D) SaveData(d interface{}, name ...interface{})

func (*D) ToString

func (self *D) ToString(key ...interface{}) (ret string)

func (*D) ToYamlString

func (self *D) ToYamlString() string

type Safe

type Safe struct {
	Basic
	Next map[interface{}]*Safe
}

func (*Safe) GetSafe

func (self *Safe) GetSafe(arg ...interface{}) (cur *Safe)

Jump to

Keyboard shortcuts

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