repository

package
v0.0.0-...-0452e27 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTrainerNotFound = errors.New("trainer not found")

Functions

func InitializeMongo

func InitializeMongo(uri, username, password string) (*mongo.Client, error)

Types

type MongoRepo

type MongoRepo interface {
	Create(ctx context.Context, trainer *model.Trainer) (string, error)
	FindOne(ctx context.Context, id string) (*model.Trainer, error)
	List(ctx context.Context) (*[]model.Trainer, error)
	Update(ctx context.Context, trainer *model.Trainer) (*model.Trainer, error)
}

type MongoRepository

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

func NewMongoRepository

func NewMongoRepository(collection *mongo.Collection) *MongoRepository

func (MongoRepository) Create

func (m MongoRepository) Create(ctx context.Context, trainer *model.Trainer) (string, error)

func (MongoRepository) FindOne

func (m MongoRepository) FindOne(ctx context.Context, id string) (*model.Trainer, error)

func (MongoRepository) List

func (m MongoRepository) List(ctx context.Context) (*[]model.Trainer, error)

func (MongoRepository) Update

func (m MongoRepository) Update(ctx context.Context, trainer *model.Trainer) (*model.Trainer, error)

Jump to

Keyboard shortcuts

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