util

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 21 Imported by: 22

README

util

chefgo util

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllinStrings

func AllinStrings(ss []string, ins []string) bool

func Extension

func Extension(name string) string

func InStrings

func InStrings(s string, ins []string) bool

func Ip2Num

func Ip2Num(ip string) int64

func Md5

func Md5(str string) string

md5加密

func Md5File

func Md5File(file string) string

md5加密文件

func MergeString

func MergeString(args ...string) string

func Num2Ip

func Num2Ip(ipInt int64) string

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

func ParseDurationConfig

func ParseDurationConfig(config Map, field string) time.Duration

func ParseSize

func ParseSize(s string) int64

func Sha1

func Sha1(str string) string

sha1加密

func Sha1BaseFile

func Sha1BaseFile(file string) string

func Sha1File

func Sha1File(file string) string

sha1加密文件

func Split

func Split(s string) []string

func UUID

func UUID() string

GenerateUUID is used to generate a random UUID

Types

type FastID

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

func NewFastID

func NewFastID(timeBits, nodeBits, stepBits uint, timeStart int64) *FastID

func NewFastIDWithNode

func NewFastIDWithNode(timeBits, nodeBits, stepBits uint, timeStart, nodeId int64) *FastID

func (*FastID) GetSequence

func (c *FastID) GetSequence(id int64) int64

func (*FastID) GetTime

func (c *FastID) GetTime(id int64) int64

func (*FastID) NextID

func (c *FastID) NextID() int64

type HashRing

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

func NewHashRing

func NewHashRing(weights map[string]int, spotsArgs ...int) *HashRing

func (*HashRing) Append

func (h *HashRing) Append(nodeKey string, weight int)

func (*HashRing) Locate

func (h *HashRing) Locate(s string) string

func (*HashRing) Remove

func (h *HashRing) Remove(nodeKey string)

func (*HashRing) Update

func (h *HashRing) Update(nodeKey string, weight int)

type Runner

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

func NewRunner

func NewRunner() *Runner

func (*Runner) End

func (s *Runner) End()

func (*Runner) Run

func (s *Runner) Run(f func())

func (*Runner) Stop

func (s *Runner) Stop() chan error

func (*Runner) Wait

func (s *Runner) Wait()

type TOMLBuffer

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

func (*TOMLBuffer) Close

func (buf *TOMLBuffer) Close() error

func (*TOMLBuffer) Read

func (buf *TOMLBuffer) Read(p []byte) (n int, err error)

func (*TOMLBuffer) Seek

func (buf *TOMLBuffer) Seek(offset int64, whence int) (int64, error)

type TOMLBuilder

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

func NewTOMLBuilder

func NewTOMLBuilder() *TOMLBuilder

func (*TOMLBuilder) Append

func (this *TOMLBuilder) Append(key string, vals ...string)

func (*TOMLBuilder) Build

func (this *TOMLBuilder) Build() string

func (*TOMLBuilder) Files

func (this *TOMLBuilder) Files() map[string][]TOMLFile

func (*TOMLBuilder) Forms

func (this *TOMLBuilder) Forms() map[string][]string

func (*TOMLBuilder) Store

func (this *TOMLBuilder) Store(key, name, mime string, buf io.ReadSeekCloser)

type TOMLFile

type TOMLFile struct {
	Name   string
	MIME   string
	Buffer io.ReadSeekCloser
}

Jump to

Keyboard shortcuts

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