dao

package
v0.0.0-...-326920e Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COLLECTION = "wonderland"
)

Constant that represents the collection at the database.

Variables

This section is empty.

Functions

func MongoConnect

func MongoConnect()

The MongoConnect function will establish the connection with the database.

Types

type MongoDB

type MongoDB struct {
	Server   string
	Database string
}

The MongoDB will store the database information address.

func (*MongoDB) Create

func (m *MongoDB) Create(wonderland model.Wonderland) error

Function to create an object in the collection.

func (*MongoDB) Delete

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

Function to delete some object in the collection.

func (*MongoDB) GetAll

func (m *MongoDB) GetAll() ([]model.Wonderland, error)

Function to get all objects stored at the collection.

func (*MongoDB) GetByID

func (m *MongoDB) GetByID(id string) (model.Wonderland, error)

Function to get an object specified by the ID.

func (*MongoDB) Update

func (m *MongoDB) Update(id string, wonderland model.Wonderland) error

Function to update some object in the collection.

Jump to

Keyboard shortcuts

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