lib

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusSuccess   = 0
	StatusBad       = 400
	StatusNoAuth    = 401
	StatusForbidden = 403
	StatusNotFound  = 404
	StatusUnknown   = 500
)

Status Code

Variables

View Source
var (
	ConfigIsLocal   = false
	ConfigIsDevelop = true
	ConfigIsProduct = false

	ConfigIsDebug   = true || ConfigIsLocal
	ConfigIsRelease = !ConfigIsDebug
)

Server Configuration

View Source
var (
	ConfigIsDB  = false
	DbConnMongo = "mongodb://localhost:27017"
)

MongoDB Configuration

View Source
var GlobalMgoSession *mgo.Session

GlobalMgoSession :

View Source
var Log = logging.MustGetLogger("example")

Log :Global Log Instance

Functions

func CloneSession

func CloneSession() *mgo.Session

CloneSession :Get MongoDB Global Session

func Get

func Get() (*mgo.Session, *mgo.Database)

Get :Get Session and Database

func GetCurrentDirectory

func GetCurrentDirectory() string

GetCurrentDirectory :Get current running directory

func GetNewUID

func GetNewUID() (int64, error)

GetNewUID :Get New Unique ID

func GetStatusMessage

func GetStatusMessage(status int) string

GetStatusMessage :Handle all status code, return status message

func HandleError

func HandleError(err error) int

HandleError :Handle all errors, return status code

func Int64ToString

func Int64ToString(i int64) string

Int64ToString :Int64 To String

func IntToString

func IntToString(i int) string

IntToString :Int To String

func MD5

func MD5(s string) string

MD5 :Crypt to MD5

func ToInt32

func ToInt32(s string) (bool, int, error)

ToInt32 :String To Int32

func ToInt64

func ToInt64(s string) (bool, int64, error)

ToInt64 :String To Int64

func ToObjectID

func ToObjectID(s string) (bson.ObjectId, error)

ToObjectID :String To bson.ObjectId

Types

This section is empty.

Jump to

Keyboard shortcuts

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