database

package
v0.0.0-...-eef89a0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTable

func CreateTable(db *sql.DB) error

CreateTable creates a table in 'db' if table doesn't exits

func Open

func Open(p string) (*sql.DB, error)

Open opens database specified in 'p'

func PutItem

func PutItem(db *sql.DB, id int, fact string) error

PutItem puts item in database

Types

type Item

type Item struct {
	ID   int    `json:"id"`
	Fact string `json:"fact"`
}

Item is a model for fact item

func GetItem

func GetItem(db *sql.DB, id int) (*Item, error)

GetItem returns item from database

Jump to

Keyboard shortcuts

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