repository

package
v0.0.0-...-f987350 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database is struct of database models

func NewDatabase

func NewDatabase(user, pass, host, port, dbname, option string) (Database, error)

NewDatabase is constructor

func (Database) Get

func (r Database) Get(title string) ([]SomeData, error)

Get is getter

func (Database) Save

func (r Database) Save(title, body string) error

Save is updater or inserter

type SomeData

type SomeData struct {
	ID        int       `db:"id"`
	Title     string    `db:"title"`
	Body      string    `db:"body"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

SomeData is data sample

Jump to

Keyboard shortcuts

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