db

package
v0.0.0-...-768b685 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDB

type MongoDB struct {
	*mongo.Client
}

func Init

func Init(dataSourceName string) (*MongoDB, error)

func (*MongoDB) Create

func (db *MongoDB) Create(tutorial model.Tutorial) error

func (*MongoDB) Delete

func (db *MongoDB) Delete(id string) error

func (*MongoDB) DeleteAll

func (db *MongoDB) DeleteAll() error

func (*MongoDB) FindAll

func (db *MongoDB) FindAll(title string) ([]*model.Tutorial, error)

func (*MongoDB) FindAllPublished

func (db *MongoDB) FindAllPublished() ([]*model.Tutorial, error)

FindAllPublished func is find all published into mongodb is true

func (*MongoDB) FindOne

func (db *MongoDB) FindOne(id string) (model.Tutorial, error)

func (*MongoDB) Update

func (db *MongoDB) Update(tutorial model.Tutorial) error

type TutorialRepository

type TutorialRepository interface {
	Create(tutorial model.Tutorial) error
	FindAll(title string) ([]*model.Tutorial, error)
	FindOne(id string) (model.Tutorial, error)
	Update(tutorial model.Tutorial) error
	Delete(id string) error
	DeleteAll() error
	FindAllPublished() ([]*model.Tutorial, error)
}

TutorialRepository is contain interface

Jump to

Keyboard shortcuts

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