connector

package
v0.0.0-...-5fd3f30 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: GPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base interface {
	Connect() error
	Close()
	Categories() ([]*Category, error)
	Posts(category int) ([]*Post, error)
}

func NewDatabase

func NewDatabase(ip string, user string, passwd string, db string) Base

NewDatabase make new struct

type Category

type Category struct {
	Id    int
	Title string
}

type Database

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

func (*Database) Categories

func (d *Database) Categories() ([]*Category, error)

Categories get categories list from database

func (*Database) Close

func (d *Database) Close()

Close closing database

func (*Database) Connect

func (d *Database) Connect() error

Connect connecting to database

func (*Database) Posts

func (d *Database) Posts(category int) ([]*Post, error)

Posts get posts list from database

type Post

type Post struct {
	Id       int
	Title    string
	Text     string
	Category int
	Created  string
}

Jump to

Keyboard shortcuts

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