card

package
v0.0.0-...-a55ffd3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package card implements all business logic regarding cards and related types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(db *sqlx.DB, id int) error

Delete card

func Update

func Update(db *sqlx.DB, id int, name, text string, now time.Time) error

Update changes Card object based on name Returns error if it was not found

func ValidateName

func ValidateName(text string) (b bool)

ValidateName checks if a name of a card is correct

Types

type Card

type Card struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Text        string    `json:"text"`
	DateCreated time.Time `db:"created" json:"dateCreated"`
	DateUpdated time.Time `db:"updated" json:"dateUpdated"`
}

Card holds unique key Name and content Text.

func Add

func Add(db *sqlx.DB, name, text string, now time.Time) (*Card, error)

Add appends new Content object

func Find

func Find(db *sqlx.DB, name string) (*Card, error)

Find returns Content object based on name

func Get

func Get(db *sqlx.DB, id int) (*Card, error)

Get one card

func GetAll

func GetAll(db *sqlx.DB) ([]Card, error)

GetAll returns all cards

Jump to

Keyboard shortcuts

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