Documentation ¶
Index ¶
- Constants
- func DeleteUserByID(id string) error
- func ExistUserByID(id string) (bool, error)
- func ExistUserByQuery(query interface{}) (bool, error)
- func GetSessionAndCollection(collection string) (*mgo.Session, *mgo.Collection)
- func GetSessionAndGridFS(prefix string) (*mgo.Session, *mgo.GridFS)
- func UpdateUser(selector interface{}, user *User) error
- func UpdateUserAll(selector interface{}, user *User) (*mgo.ChangeInfo, error)
- func UpdateUserByID(id string, user *User) error
- type DB
- type User
Constants ¶
View Source
const (
CollectionUser = "users"
)
Variables ¶
This section is empty.
Functions ¶
func DeleteUserByID ¶
func ExistUserByID ¶
func ExistUserByQuery ¶
func GetSessionAndCollection ¶
func GetSessionAndCollection(collection string) (*mgo.Session, *mgo.Collection)
func UpdateUser ¶
func UpdateUserAll ¶
func UpdateUserAll(selector interface{}, user *User) (*mgo.ChangeInfo, error)
func UpdateUserByID ¶
Types ¶
type User ¶
type User struct { ID bson.ObjectId `bson:"_id" json:"_id"` UserName string `bson:"user_name" json:"user_name,omitempty" valid:"required~first name is blank"` Email string `bson:"email" json:"email,omitempty" valid:"required,email"` Password string `bson:"password" json:"password,omitempty" valid:"required"` CreatedAt int64 `bson:"created_at" json:"created_at"` UpdatedAt int64 `bson:"updated_at" json:"updated_at"` }
func FindAllUserByQuery ¶
func FindUserByID ¶
func FindUserByQuery ¶
Click to show internal directories.
Click to hide internal directories.