repository

package
v0.0.0-...-733bf9b Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 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 Repository

type Repository interface {
	FindRandom(context.Context, string) (map[string]interface{}, error)
	FindAll(context.Context) ([]*models.Xaveco, error)
	FindByTag(context.Context, string) ([]*models.Xaveco, error)
	Create(context.Context, *models.Xaveco) error
}

type XavecoMongoRepository

type XavecoMongoRepository struct {
	// contains filtered or unexported fields
}

func NewXavecoMongoRepository

func NewXavecoMongoRepository() *XavecoMongoRepository

NewXavecoMongoRepository Initializes repository; mongodb connection is required

func (*XavecoMongoRepository) Create

func (x *XavecoMongoRepository) Create(ctx context.Context, xaveco *models.Xaveco) error

Create saves a model xaveco to the database

func (*XavecoMongoRepository) FindAll

func (x *XavecoMongoRepository) FindAll(ctx context.Context) (xavecos []*models.Xaveco, err error)

FindAll returns all xavecos on database

func (*XavecoMongoRepository) FindByTag

func (x *XavecoMongoRepository) FindByTag(ctx context.Context, tag string) (xavecos []*models.Xaveco, err error)

FindByTag returns all xavecos declared with the same tag

func (*XavecoMongoRepository) FindRandom

func (x *XavecoMongoRepository) FindRandom(ctx context.Context, tag string) (xvc map[string]interface{}, err error)

FindRandom returns a random xaveco, tagged one if a tag is provided

Jump to

Keyboard shortcuts

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