Documentation ¶
Index ¶
- Constants
- type Comment
- type Database
- func (db *Database) CheckEmailUnique(email string) bool
- func (db *Database) CloseSession()
- func (db *Database) CreateCommentForPostId(comment *Comment, postId bson.ObjectId) error
- func (db *Database) CreatePost(post *Post) error
- func (db *Database) CreateUser(user *User) error
- func (db *Database) GetPostByPostId(id bson.ObjectId) (*Post, error)
- func (db *Database) GetPostsByUserId(id bson.ObjectId) ([]*Post, error)
- func (db *Database) GetUserByEmail(email string) (*User, error)
- func (db *Database) GetUserById(id bson.ObjectId) (*User, error)
- func (db *Database) GetUsers() ([]*User, error)
- type DbError
- type DbErrorCode
- type Post
- type User
- type UserEmbed
Constants ¶
View Source
const ( DbErrorModalLackRequiredPrpty DbErrorCode = 20101 DbErrorModalPrptyErr = 20102 DbErrorInsertErr = 20201 DbErrorDeleteErr = 20202 DbErrorFindErr = 20203 DbErrorUpdateErr = 20204 DbErrorUnknow = 29901 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) CheckEmailUnique ¶
func (*Database) CloseSession ¶
func (db *Database) CloseSession()
func (*Database) CreateCommentForPostId ¶
func (*Database) CreatePost ¶
func (*Database) CreateUser ¶
/////////////////////////////////////////////////////////////////////////
func (*Database) GetPostByPostId ¶
func (*Database) GetPostsByUserId ¶
type DbError ¶
type DbError struct { Code DbErrorCode Err error }
type DbErrorCode ¶
type DbErrorCode int
Click to show internal directories.
Click to hide internal directories.