models

package
v0.0.0-...-b6f969d Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package models include db conection and todo model to persist with database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDatabase

func ConnectDatabase() error

ConnectDatabase Connect to database, read/create sqlite file db

func Init

func Init()

Init the connection with database

Types

type Todo

type Todo struct {
	gorm.Model
	Title       string `gorm:"size:100" json:"title"`
	Description string `gorm:"size:500" json:"description"`
}

Todo Item to add

func ListTodos

func ListTodos() ([]Todo, error)

ListTodos wrapper

func (*Todo) Insert

func (s *Todo) Insert() error

Insert wrapper

func (*Todo) Read

func (s *Todo) Read(id int) error

Read wrapper

func (*Todo) Update

func (s *Todo) Update() error

Update wrapper

Jump to

Keyboard shortcuts

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