Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func Connect(url string)
- func DBMiddleware() func(h http.Handler) http.Handler
- func EnsureIndex(collectionName string, index mgo.Index)
- func GetCollection(session *mgo.Session, collectionName string) *mgo.Collection
- func GetDBSession(r *http.Request) *mgo.Session
- func GetSession() *mgo.Session
- func IsDup(err error) bool
- func NewSession() *mgo.Session
- func SetDBSession(r *http.Request) *mgo.Session
- type DBHandler
- type DateTime
Constants ¶
View Source
const ( DB_NAME = "itsyouonline-idserver-db" DB_SESSION = "itsyouonline/identityserver/dbconnection" )
Variables ¶
View Source
var ( //ErrDuplicate indicates the entry is invalid because of a primary key violation ErrDuplicate = errors.New("Duplicate") )
Functions ¶
func EnsureIndex ¶
func EnsureIndex(collectionName string, index mgo.Index)
EnsureIndex make sure indices are created on certain collection.
func GetCollection ¶
func GetCollection(session *mgo.Session, collectionName string) *mgo.Collection
GetCollection return collection.
func GetDBSession ¶
func NewSession ¶
func NewSession() *mgo.Session
func SetDBSession ¶
Types ¶
type DateTime ¶
DateTime is timestamp in "date-time" format defined in RFC3339
func (DateTime) GetBSON ¶
GetBSON implements bson.Getter since the bson library does not look at underlying types and matches directly the time.Time type
func (*DateTime) MarshalJSON ¶
MarshalJSON override marshalJSON
func (*DateTime) SetBSON ¶
SetBSON implements bson.Setter since the bson library does not look at underlying types and matches directly the time.Time type
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON override unmarshalJSON
Click to show internal directories.
Click to hide internal directories.