Documentation
¶
Index ¶
- Constants
- type Client
- type MongoHandler
- func (mh *MongoHandler) AddOne(c *Client) (*mongo.InsertOneResult, error)
- func (mh *MongoHandler) Get(filter interface{}) []*Client
- func (mh *MongoHandler) GetOne(c *Client, filter interface{}) error
- func (mh *MongoHandler) RemoveOne(filter interface{}) (*mongo.DeleteResult, error)
- func (mh *MongoHandler) Update(c *Client, filter interface{}, update interface{}) (*mongo.UpdateResult, error)
Constants ¶
View Source
const CollectionName = "client"
CollectionName is name of collection
View Source
const DefaultDatabase = "clientbase"
DefaultDatabase is name of database
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { FirstName string `json:"firstName" bson:"firstName"` LastName string `json:"lastName" bson:"lastName"` Email string `json:"email" bson:"email"` PhoneNumber string `json:"phoneNumber" bson:"phoneNumber"` Login string `json:"login" bson:"login"` Password string `json:"password" bson:"password"` CreatedOn time.Time `json:"createdOn" bson:"createdon"` }
Client contains information about user
type MongoHandler ¶
type MongoHandler struct {
// contains filtered or unexported fields
}
MongoHandler is type of mongoHandler struct
func NewHandler ¶
func NewHandler(address string) *MongoHandler
NewHandler is MongoHandler Constructor
func (*MongoHandler) AddOne ¶
func (mh *MongoHandler) AddOne(c *Client) (*mongo.InsertOneResult, error)
AddOne will add one element to collection
func (*MongoHandler) Get ¶
func (mh *MongoHandler) Get(filter interface{}) []*Client
Get will get all elements from collection
func (*MongoHandler) GetOne ¶
func (mh *MongoHandler) GetOne(c *Client, filter interface{}) error
GetOne will get one element from collection
func (*MongoHandler) RemoveOne ¶
func (mh *MongoHandler) RemoveOne(filter interface{}) (*mongo.DeleteResult, error)
RemoveOne will remove one element from collection
func (*MongoHandler) Update ¶
func (mh *MongoHandler) Update(c *Client, filter interface{}, update interface{}) (*mongo.UpdateResult, error)
Update will update information in collection
Click to show internal directories.
Click to hide internal directories.