storage

package
v0.0.0-...-77ad48c Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Name   string   //the name of the table is also the directory where entries will be stored
	Tables []string //file names of the tables
}

Struct representing how the data is held

func (*DB) AddRow

func (database *DB) AddRow(name string, entry []string, n int) error

Add a row to the nth position

func (*DB) DelRow

func (database *DB) DelRow(name string, n int) error

Delete the nth row

func (*DB) DelTable

func (database *DB) DelTable(name string) error

Deletes a table from the DB

func (*DB) MakeTable

func (database *DB) MakeTable(name string, headers []string) error

Adds a table (.csv File) to a given database

func (*DB) ReadTable

func (database *DB) ReadTable(name string) (Table, error)

Reads in the table / csv

type Schema

type Schema struct {
	Databases []*DB
}

Struct containing pointers to DB's

func (Schema) DBNames

func (s Schema) DBNames() []string

Gets an array of the DB names

func (*Schema) Deldb

func (s *Schema) Deldb(name string) error

Deletes a database from the Schema

func (*Schema) Makedb

func (s *Schema) Makedb(name string) error

Connects to the database entries and adds it to the Schema doesnt add it to the conf

type Table

type Table struct {
	Headers []string
	Entries [][]string
}

Struct to interpret CSV tables to

func (Table) String

func (t Table) String() string

Print the table in a table format

Jump to

Keyboard shortcuts

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