data

package
v4.4.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRUDResult

type CRUDResult struct {
	Name    string
	Success bool
	Error   string
}

CRUDResult is a data structure that holds the results of all the CRUD operations run against the database from the RunCRUD method.

type Coffee

type Coffee struct {
	Name    string
	Species string
	Regions string
	Comment string
}

Coffee is a data structure used to populate PostgreSQL with dummy data.

type Connection

type Connection struct {
	DBName   string
	Host     string
	Password string
	Port     int
	SSL      string
	User     string
}

Connection is a data structure that holds all the connection info for the database.

func (*Connection) NewDB

func (c *Connection) NewDB() (*DB, error)

NewDB returns a new database entity.

type DB

type DB struct {
	*sql.DB
}

DB returns a pointer to a sql.DB entity.

func (*DB) AddCoffee

func (db *DB) AddCoffee(c Coffee) error

AddCoffee method adds an instance of Coffee to the database.

func (*DB) AllCoffee

func (db *DB) AllCoffee() ([]Coffee, error)

AllCoffee method returns all dummy data.

func (*DB) AllExtensions

func (db *DB) AllExtensions() ([]Extension, error)

/ AllExtensions method returns all extensions available.

func (*DB) CoffeeDeleteAll

func (db *DB) CoffeeDeleteAll() error

CoffeeDeleteAll method deletes all rows in the sample data table 'public.coffee'

func (*DB) Databases

func (db *DB) Databases() ([]Database, error)

Databases returns all databases.

func (*DB) GetCoffee

func (db *DB) GetCoffee(name string) (Coffee, error)

GetCoffee method returns a specific instance of Coffee by name.

func (*DB) InitDDL

func (db *DB) InitDDL() error

InitDDL method creates the necessary DDL for the dummy data.

func (*DB) InstalledExtensions

func (db *DB) InstalledExtensions() ([]Extension, error)

InstalledExtensions method returns all installed extensions in the database currently being queried.

func (*DB) Replication

func (db *DB) Replication() ([]Replication, error)

Replication returns the state of replicas from the primary.

func (*DB) Roles

func (db *DB) Roles() ([]Role, error)

Roles method returns all the roles found in the database.

func (*DB) RunCRUD

func (db *DB) RunCRUD() []CRUDResult

RunCRUD is a wrapper function that tests the database via SQL.

func (*DB) Settings

func (db *DB) Settings() ([]Setting, error)

Settings method returns all settings for the database.

type Database

type Database struct {
	Name string
}

Database is a structure that holds the name of databases.

type Extension

type Extension struct {
	DefaultVersion   string
	InstalledVersion string
	Name             string
}

Extension is a data structure that holds information about extensions found in the database.

type Replication

type Replication struct {
	Name      string
	State     string
	SyncState string
}

Replication is a data structure that holds replication state queried from the primary database.

type Role

type Role struct {
	Name        string
	Super       bool
	Inherit     bool
	CreateRole  bool
	CreateDB    bool
	Login       bool
	ConnLimit   int
	Replication bool
	BypassRLS   bool
}

Role is a data structure that describes the roles found in the database.

type Setting

type Setting struct {
	Name  string
	Value string
}

Setting is a data structure that holds the name and value of database settings.

Jump to

Keyboard shortcuts

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