Documentation ¶
Index ¶
- Constants
- func AllinStrings(ss []string, ins []string) bool
- func Extension(name string) string
- func InStrings(s string, ins []string) bool
- func Ip2Num(ip string) int64
- func Md5(str string) string
- func Md5File(file string) string
- func MergeString(args ...string) string
- func Num2Ip(ipInt int64) string
- func ParseDuration(s string) (time.Duration, error)
- func ParseDurationConfig(config Map, field string) time.Duration
- func ParseSize(s string) int64
- func Sha1(str string) string
- func Sha1BaseFile(file string) string
- func Sha1File(file string) string
- func Sha256(str string) string
- func Sha256BaseFile(file string) string
- func Sha256File(file string) string
- func Split(s string) []string
- func UUID() string
- type FastID
- type HashID
- func (h *HashID) Decode(hash string) []int
- func (h *HashID) DecodeHex(hash string) (string, error)
- func (h *HashID) DecodeInt64(hash string) []int64
- func (h *HashID) DecodeInt64WithError(hash string) ([]int64, error)
- func (h *HashID) DecodeWithError(hash string) ([]int, error)
- func (h *HashID) Encode(numbers []int) (string, error)
- func (h *HashID) EncodeHex(hex string) (string, error)
- func (h *HashID) EncodeInt64(numbers []int64) (string, error)
- type HashIDData
- type HashRing
- type Runner
- type TOMLBuffer
- type TOMLBuilder
- type TOMLFile
Constants ¶
const ( // Version is the version number of the library Version string = "1.0.0" // DefaultAlphabet is the default alphabet used by go-hashids DefaultAlphabet string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" )
const (
NoDuration = -99999
)
Variables ¶
This section is empty.
Functions ¶
func AllinStrings ¶
func MergeString ¶
func ParseDuration ¶
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 Sha1BaseFile ¶
func Sha256BaseFile ¶ added in v0.0.4
Types ¶
type FastID ¶
type FastID struct {
// contains filtered or unexported fields
}
func NewFastIDWithNode ¶
func (*FastID) GetSequence ¶
type HashID ¶ added in v0.0.2
type HashID struct {
// contains filtered or unexported fields
}
HashID contains everything needed to encode/decode hashids
func NewWithData ¶ added in v0.0.2
func NewWithData(data *HashIDData) (*HashID, error)
NewWithData creates a new HashID with the provided HashIDData
func (*HashID) Decode ¶ added in v0.0.2
DEPRECATED: Use DecodeWithError instead Decode unhashes the string passed to an array of int. It is symmetric with Encode if the Alphabet and Salt are the same ones which were used to hash. MinLength has no effect on Decode.
func (*HashID) DecodeHex ¶ added in v0.0.2
DecodeHex unhashes the string passed to a hexadecimal string. It is symmetric with EncodeHex if the Alphabet and Salt are the same ones which were used to hash.
Each hex nibble is decoded from an integer in range [16, 31].
func (*HashID) DecodeInt64 ¶ added in v0.0.2
DEPRECATED: Use DecodeInt64WithError instead DecodeInt64 unhashes the string passed to an array of int64. It is symmetric with EncodeInt64 if the Alphabet and Salt are the same ones which were used to hash. MinLength has no effect on DecodeInt64.
func (*HashID) DecodeInt64WithError ¶ added in v0.0.2
DecodeInt64 unhashes the string passed to an array of int64. It is symmetric with EncodeInt64 if the Alphabet and Salt are the same ones which were used to hash. MinLength has no effect on DecodeInt64.
func (*HashID) DecodeWithError ¶ added in v0.0.2
Decode unhashes the string passed to an array of int. It is symmetric with Encode if the Alphabet and Salt are the same ones which were used to hash. MinLength has no effect on Decode.
func (*HashID) Encode ¶ added in v0.0.2
Encode hashes an array of int to a string containing at least MinLength characters taken from the Alphabet. Use Decode using the same Alphabet and Salt to get back the array of int.
func (*HashID) EncodeHex ¶ added in v0.0.2
EncodeHex hashes a hexadecimal string to a string containing at least MinLength characters taken from the Alphabet. A hexadecimal string should not contain the 0x prefix. Use DecodeHex using the same Alphabet and Salt to get back the hexadecimal string.
Each hex nibble is encoded as an integer in range [16, 31].
func (*HashID) EncodeInt64 ¶ added in v0.0.2
EncodeInt64 hashes an array of int64 to a string containing at least MinLength characters taken from the Alphabet. Use DecodeInt64 using the same Alphabet and Salt to get back the array of int64.
type HashIDData ¶ added in v0.0.2
type HashIDData struct { // Alphabet is the alphabet used to generate new ids Alphabet string // MinLength is the minimum length of a generated id MinLength int // Salt is the secret used to make the generated id harder to guess Salt string }
HashIDData contains the information needed to generate hashids
func NewData ¶ added in v0.0.2
func NewData() *HashIDData
NewData creates a new HashIDData with the DefaultAlphabet already set.
type TOMLBuffer ¶
type TOMLBuffer struct {
// contains filtered or unexported fields
}
func (*TOMLBuffer) Close ¶
func (buf *TOMLBuffer) Close() 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)