Documentation ¶
Index ¶
- func ObjectId() string
- func ObjectIdWithNow() string
- func RandomUUID() string
- func SimpleRandomUUID() string
- func UUIDV1() string
- func UUIDV2(domain byte) string
- func UUIDV3(ns uuid.UUID, name string) string
- func UUIDV5(ns uuid.UUID, name string) string
- func UnixMillisId() string
- func UnixNanoTimeId() string
- type Properties
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 ¶
UUIDV2 Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1).
@param domain domain @return string uuid string
func UUIDV3 ¶
UUIDV3 Version 3, based on MD5 hashing (RFC 4122).
@param ns uuid namespace @param name domain name @return string uuid string
func UUIDV5 ¶
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)