storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 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 Question

type Question struct {
	ID          int       `json:"id"`
	Title       string    `json:"title,omitempty"`
	Description string    `json:"description,omitempty"`
	Query       string    `json:"query,omitempty"`
	DataSource  string    `json:"dataSource,omitempty"`
	Variables   string    `json:"variables,omitempty"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

Question stores q&a

type Storage

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

Storage is a struct for deloominator own database

func NewStorage

func NewStorage(source string) (*Storage, error)

NewStorage initializes deloominator own storage using source

func (*Storage) AllQuestions

func (s *Storage) AllQuestions() (questions []*Question, err error)

AllQuestions returns all the questions stored in the given storage ordered by created_at and title

func (*Storage) AutoUpgrade

func (s *Storage) AutoUpgrade() error

AutoUpgrade migrates the DB if needed

func (*Storage) Close

func (s *Storage) Close()

Close closes the underlining DB connection

func (*Storage) FindQuestion

func (s *Storage) FindQuestion(id int) (*Question, error)

FindQuestion returns a single question using its id

func (*Storage) InsertQuestion

func (s *Storage) InsertQuestion(q *Question) (*Question, error)

InsertQuestion stores a question into the storage

func (*Storage) String

func (s *Storage) String() string

Jump to

Keyboard shortcuts

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