models

package
v0.0.0-...-a98f8e9 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 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 Todo

type Todo struct {
	ID        primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Task      string             `json:"task" bson:"task" validate:"required"`
	Completed bool               `json:"completed" bson:"copleted" validate:"required"`
}

Todo is the basic todo struct

func (*Todo) Delete

func (todo *Todo) Delete(id string) error

Delete removes an entry

func (*Todo) GetAll

func (todo *Todo) GetAll() ([]Todo, error)

GetAll searchs all todos in the database

func (*Todo) InsertOne

func (todo *Todo) InsertOne() error

InsertOne handle the insertion of a new entry

func (*Todo) Update

func (todo *Todo) Update(id string) error

Update updatse an element

func (*Todo) Validate

func (todo *Todo) Validate() error

Validate runs govalidator for the struct

Jump to

Keyboard shortcuts

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