db

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

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

Go to latest
Published: May 2, 2020 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func Connect

func Connect(dbPath string) error

Connect starts the SQLite connection

func CreateTables

func CreateTables() error

func DeleteTable

func DeleteTable(tablename string) error

DeleteTable drops table from instance

func DropAllTables

func DropAllTables() error

DropAllTables will drop, all of the tables. Shocker.

func Test

func Test()

Types

type Channel

type Channel struct {
	ID        int    `sql:"id"`
	Name      string `sql:"name"`
	Type      int    `sql:"type"`
	Project   int64  `sql:"project"`
	Device    int64  `sql:"device"`
	Color     string `sql:"color"`
	MaxLength int    `sql:"max_length"`
}

Channel pixelpusher object for DB

func (Channel) Insert

func (c Channel) Insert() (int64, error)

Insert a channel into the database

type Device

type Device struct {
	ID        int64  `sql:"id"`
	Name      string `sql:"name"`
	Project   int64  `sql:"project"`
	LongID    string `sql:"longID"`
	Hostname  string `sql:"hostname"`
	Port      int    `sql:"port"`
	Connector bool   `sql:"connector"`
	Key       string `sql:"key"`
	UseKey    bool   `sql:"use_key"`
}

Device pixelpusher object for DB

func QueryAllDevices

func QueryAllDevices() ([]Device, error)

QueryAllDevices returns every device that is registered in the database

func QueryDevice

func QueryDevice(deviceID int64) (Device, error)

QueryDevice by the SQL ID

func (Device) Insert

func (d Device) Insert() (int64, error)

Insert a device into the database

type Matrix

type Matrix struct {
	ID         int64  `sql:"id"`
	Device     int64  `sql:"device"`
	Channel    int64  `sql:"channel"`
	Project    int64  `sql:"project"`
	Width      int    `sql:"width"`
	Height     int    `sql:"height"`
	Type       int    `sql:"type"`
	Coloring   string `sql:"coloring"`
	Offset     int    `sql:"offset"`
	Brightness int    `sql:"brightness"`
}

Matrix pixelpusher object for DB

func (Matrix) Insert

func (m Matrix) Insert() (int64, error)

Insert a matrix into the database

type Project

type Project struct {
	ID            int       `sql:"id"`
	Name          string    `sql:"name"`
	Created       time.Time `sql:"created"`
	LastUpdate    time.Time `sql:"last_update"`
	Client        string    `sql:"client"`
	Active        bool      `sql:"active"`
	FrontendState string    `sql:"frontend_state"`
}

Project pixelpusher object for DB

func (Project) Insert

func (p Project) Insert() (int64, error)

Insert project into the database

type User

type User struct {
	ID        int       `sql:"id"`
	Name      string    `sql:"name"`
	Username  string    `sql:"username"`
	Password  string    `sql:"password"`
	Created   time.Time `sql:"created"`
	LastLogin time.Time `sql:"last_login"`
}

User pixelpusher object for DB

func QueryUserFromID

func QueryUserFromID(id int64) (User, error)

func QueryUserFromUsername

func QueryUserFromUsername(username string) (User, error)

func (User) Insert

func (u User) Insert() (int64, error)

Insert user into the database

Jump to

Keyboard shortcuts

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