Documentation ¶
Index ¶
- func FindAll(collection string, results Document, filter bson.M) error
- func FindAllUsers() (*[]User, error)
- func FindMessages(key string, value string) (*[]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
- type BaseModel
- type Document
- type Message
- type Model
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindAllUsers ¶
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 ReceiverId string `json:"receiver_id" bson:"receiver_id,omitempty"` UserId string `json:"user_id" bson:"user_id,omitempty"` Text string `json:"text" bson:"text,omitempty"` }
func (*Message) CollectionName ¶
type User ¶
type User struct { BaseModel 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"` //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.