mongodb

package
v0.0.0-...-b56c44a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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

func (*SampleMongo) Top

func (s *SampleMongo) Top(parameter string, limit int64) (*models.Samples, error)

Top (SampleMongo) returns the top Samples based on search field and limit

func (*SampleMongo) Update

func (s *SampleMongo) Update(id string, content string) (int64, error)

Update (SampleMongo) updates a Sample based on its ID To-do

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL