database

package
v0.0.0-...-a366597 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database represents a database

func NewDatabase

func NewDatabase(dialect, url string) *Database

NewDatabase database

func (*Database) Connect

func (db *Database) Connect() error

Connect to database

type Frame

type Frame struct {
	Data interface{}
}

Frame is a Stack Frame

func (*Frame) Deserialize

func (f *Frame) Deserialize(Data []byte) (*Frame, error)

Deserialize bytes into a Frame

func (*Frame) Serialize

func (f *Frame) Serialize() ([]byte, error)

Serialize a frame into bytes

type PersistentFrame

type PersistentFrame struct {
	gorm.Model
	Stack string
	Data  []byte
}

PersistentFrame is just a fake object

type Stack

type Stack struct {
	gorm.Model

	Name   string            `gorm:"type:VARCHAR(100);PRIMARY_KEY"`
	Frames []PersistentFrame `gorm:"foreignkey:Stack"`
	// contains filtered or unexported fields
}

Stack data structure

func New

func New() *Stack

New returns a new Stack

func (*Stack) Init

func (s *Stack) Init(params ...interface{}) error

Init the Stack

func (*Stack) Peek

func (s *Stack) Peek() interface{}

Peek top frame on the stack

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop a persistent frame

func (*Stack) Push

func (s *Stack) Push(data interface{})

Push a frame on the stack

func (*Stack) Size

func (s *Stack) Size() int

Size returns the number of frames in the stack

Jump to

Keyboard shortcuts

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