note

package
v0.0.0-...-d81d3ea Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2016 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package note provides access to the note table in the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Get(dest interface{}, query string, args ...interface{}) error
	Select(dest interface{}, query string, args ...interface{}) error
}

Connection is an interface for making queries.

type Item

type Item struct {
	ID        uint32    `db:"id"`
	Name      string    `db:"name"`
	UserID    uint32    `db:"user_id"`
	CreatedAt null.Time `db:"created_at"`
	UpdatedAt null.Time `db:"updated_at"`
	DeletedAt null.Time `db:"deleted_at"`
}

Item defines the model.

type Service

type Service struct {
	DB Connection
}

Service defines the database connection.

func (Service) ByID

func (s Service) ByID(ID string, userID string) (Item, bool, error)

ByID gets an item by ID.

func (Service) ByUserID

func (s Service) ByUserID(userID string) ([]Item, bool, error)

ByUserID gets all entities for a user.

func (Service) Create

func (s Service) Create(name string, userID string) (sql.Result, error)

Create adds an item.

func (Service) DeleteHard

func (s Service) DeleteHard(ID string, userID string) (sql.Result, error)

DeleteHard removes an item.

func (Service) DeleteSoft

func (s Service) DeleteSoft(ID string, userID string) (sql.Result, error)

DeleteSoft marks an item as removed.

func (Service) Update

func (s Service) Update(name string, ID string, userID string) (sql.Result, error)

Update makes changes to an existing item.

Jump to

Keyboard shortcuts

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