Documentation ¶
Index ¶
- Constants
- func FindAll(collection string, results types.Document, filter bson.D, ...) error
- func FindAllUsers(filter bson.D) (*[]User, error)
- func FindMessages(filter bson.D, opts *options.FindOptions) (*[]Message, error)
- func FindOne(collection string, filter bson.M, result Model) error
- func Insert(collection string, model Model) error
- func InsertMessages(message *Message) error
- func InsertUser(user *User) error
- func Update(collection string, filter bson.M, update primitive.D) error
- func UpdateMessages(message *Message, feilds primitive.E) error
- func UpdateUser(user *User, filter bson.M, update bson.D) error
- type BaseModel
- type Message
- type Model
- type User
Constants ¶
View Source
const ( READ = "read" UNREAD = "unread" )
Variables ¶
This section is empty.
Functions ¶
func FindMessages ¶
func InsertMessages ¶
func InsertUser ¶
Types ¶
type BaseModel ¶
type BaseModel struct { ID string `json:"id" bson:"_id,omitempty"` CreatedAt primitive.DateTime `json:"created_at" bson:"created_at"` UpdatedAt primitive.DateTime `json:"updated_at" bson:"updated_at"` }
func (*BaseModel) GetCreatedAt ¶
func (*BaseModel) GetUpdatedAt ¶
func (*BaseModel) SetCreatedAt ¶
func (b *BaseModel) SetCreatedAt()
func (*BaseModel) SetUpdatedAt ¶
func (b *BaseModel) SetUpdatedAt()
type Message ¶
type Message struct { BaseModel `bson:",inline"` ReceiverId string `json:"receiver_id" bson:"receiver_id,omitempty"` Status string `json:"status" bson:"status,omitempty"` UserId string `json:"user_id" bson:"user_id,omitempty"` Text string `json:"text" bson:"text,omitempty"` Type string `json:"type"` }
func FindMessage ¶
func (*Message) CollectionName ¶
type User ¶
type User struct { BaseModel `bson:",inline"` ID string `json:"id" bson:"_id,omitempty"` Name string `json:"name" bson:"name,omitempty"` Email string `json:"email" bson:"email,omitempty"` Picture string `json:"picture" bson:"picture,omitempty"` Contacts []string `json:"contacts" bson:"contacts,omitempty"` //Role string `json:"role" bson:"role,omitempty"` Password []byte `json:"-"` }
func FindUserById ¶
func (*User) CollectionName ¶
Click to show internal directories.
Click to hide internal directories.