Documentation ¶
Index ¶
- type SampleMongo
- func (s *SampleMongo) Delete(id string) (int64, error)
- func (s *SampleMongo) Get(id string) (*models.Sample, error)
- func (s *SampleMongo) Insert(content string) (string, error)
- func (s *SampleMongo) Search(keywords string) (*models.Samples, error)
- func (s *SampleMongo) Top(parameter string, limit int64) (*models.Samples, error)
- func (s *SampleMongo) Update(id string, content string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SampleMongo ¶
type SampleMongo struct {
Collection *mongo.Collection
}
SampleMongo is a an implementation for the SampleModel interface to interact with Samples in MongoDB
func NewSampleMongo ¶
func NewSampleMongo(client *mongo.Client) (*SampleMongo, error)
NewSampleMongo initializes the Mongo connection
func (*SampleMongo) Delete ¶
func (s *SampleMongo) Delete(id string) (int64, error)
Delete (SampleMongo) deletes a Sample based on its ID To-do
func (*SampleMongo) Get ¶
func (s *SampleMongo) Get(id string) (*models.Sample, error)
Get (SampleMongo) gets a Sample based on the ID
func (*SampleMongo) Insert ¶
func (s *SampleMongo) Insert(content string) (string, error)
Insert (SampleMongo) inserts a new Sample into the database returns the id of new entry and an error
func (*SampleMongo) Search ¶
func (s *SampleMongo) Search(keywords string) (*models.Samples, error)
Search (SampleMongo) returns Samples based on keywords
Click to show internal directories.
Click to hide internal directories.