models

package
v0.0.0-...-39835e7 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MONGO_URL = "mongodb://root:rootpassword@localhost:27017"
	DATA_BASE = "todo-list"
)
View Source
const (
	COLLECTION = "tasks"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbClient

type DbClient struct {
	Client *mongo.Client
	// contains filtered or unexported fields
}

func NewDbClient

func NewDbClient() (DbClient, interface{})

func (*DbClient) Connect

func (db *DbClient) Connect() error

func (*DbClient) GetCollection

func (db *DbClient) GetCollection(collection string) *mongo.Collection

type Task

type Task struct {
	Id          string
	Status      string    `json:"status"`
	Text        string    `json:"text"`
	CreatedDate time.Time `json:"created_date"`
}

func GetAll

func GetAll() ([]Task, error)

func (*Task) Del

func (t *Task) Del() (bool, error)

func (*Task) Get

func (t *Task) Get() (Task, error)

func (*Task) Save

func (t *Task) Save() (interface{}, error)

Jump to

Keyboard shortcuts

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