note

package
v0.0.0-...-a8d72de Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(db Connection, name string, userID string) (sql.Result, error)

Create adds an item.

func DeleteHard

func DeleteHard(db Connection, ID string, userID string) (sql.Result, error)

DeleteHard removes an item.

func DeleteSoft

func DeleteSoft(db Connection, ID string, userID string) (sql.Result, error)

DeleteSoft marks an item as removed.

func Update

func Update(db Connection, name string, ID string, userID string) (sql.Result, error)

Update makes changes to an existing item.

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 mysql.NullTime `db:"created_at"`
	UpdatedAt mysql.NullTime `db:"updated_at"`
	DeletedAt mysql.NullTime `db:"deleted_at"`
}

Item defines the model.

func ByID

func ByID(db Connection, ID string, userID string) (Item, bool, error)

ByID gets an item by ID.

func ByUserID

func ByUserID(db Connection, userID string) ([]Item, bool, error)

ByUserID gets all items for a user.

Jump to

Keyboard shortcuts

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