core

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectId

func ObjectId() string

ObjectId generate mongodb ObjectId, currently, just use mgo.v2 lib, can write self.

@return string object id

func ObjectIdWithNow

func ObjectIdWithNow() string

ObjectIdWithNow generate ObjectId with now, currently, just use mgo.v2 lib, can write self.

@return string object id

func RandomUUID

func RandomUUID() string

RandomUUID Version 4, based on random numbers (RFC 4122).

@return string uuid string

func SimpleRandomUUID

func SimpleRandomUUID() string

SimpleRandomUUID simple RandomUUI base RandomUUID.

@return string return uuid without horizontal line

func UUIDV1

func UUIDV1() string

UUIDV1 Version 1, based on timestamp and MAC address (RFC 4122).

@return string

func UUIDV2

func UUIDV2(domain byte) string

UUIDV2 Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1).

@param domain domain
@return string uuid string

func UUIDV3

func UUIDV3(ns uuid.UUID, name string) string

UUIDV3 Version 3, based on MD5 hashing (RFC 4122).

@param ns   uuid namespace
@param name domain name
@return string uuid string

func UUIDV5

func UUIDV5(ns uuid.UUID, name string) string

UUIDV5 Version 5, based on SHA-1 hashing (RFC 4122).

@param ns   uuid namespace
@param name domain name
@return string uuid string

func UnixMillisId

func UnixMillisId() string

UnixMillisId generate timestamp id with millisecond.

@return string

func UnixNanoTimeId

func UnixNanoTimeId() string

UnixNanoTimeId generate timestamp id with unixNano.

@return string

Types

type Properties

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

func NewProperties

func NewProperties() *Properties

func (*Properties) Get

func (p *Properties) Get(key string) (value string, ok bool)

Get load value by key from Properties

@receiver p properties
@param key the key
@return value the value
@return ok status

func (*Properties) GetConfigFromFile

func (p *Properties) GetConfigFromFile(path string) (err error)

GetConfigFromFile get map from file

@param path file path
@return map[string]string
usage:
p := NewProperties()
p.GetConfigFromFile(your path)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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