database

package
v0.1.0-DEV Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BucketList

func BucketList(p string) []string

There is no way with storm to get a list of all buckets. This uses a direct Bolt view to get the list

func CloseInstance

func CloseInstance()

func DateBucket

func DateBucket(p string, d string) storm.Node

func Find

func Find(field string, value interface{}, to interface{}) error

func GetAll

func GetAll(d interface{}) error

func GetAllByIndex

func GetAllByIndex(field string, d interface{}) error

func InitStatus

func InitStatus()

func One

func One(field string, value interface{}, to interface{}) error

Types

type DataS

type DataS interface {
	Save() error
	Delete() error
	Update() error
	Compare(DataS) bool
}

type Database

type Database struct {
	Db    string
	DbObj *storm.DB
}

func GetInstance

func GetInstance() *Database

func (*Database) Close

func (d *Database) Close()

func (*Database) Open

func (d *Database) Open()

type GroupS

type GroupS struct {
	ID      int     `json:"id"`
	Name    string  `json:"name" storm:"index,unique"`
	Members []UserS `json:"members,omitempty"`
}

func (GroupS) Compare

func (s GroupS) Compare(d DataS) bool

func (GroupS) Delete

func (s GroupS) Delete() error

func (GroupS) Save

func (s GroupS) Save() error

func (GroupS) String

func (s GroupS) String() string

func (GroupS) Update

func (s GroupS) Update() error

type StatusS

type StatusS struct {
	ID     int    `json:"id"`
	Date   string `json:"date" storm:"index"`
	Status string `json:"status"`
	User   UserS  `json:"user" storm:"index"`
}

func (*StatusS) Delete

func (s *StatusS) Delete() error

func (*StatusS) Save

func (s *StatusS) Save() error

func (*StatusS) String

func (s *StatusS) String() string

func (*StatusS) Update

func (s *StatusS) Update() error

type UserS

type UserS struct {
	ID    int    `json:"id"`
	Nick  string `json:"nick" storm:"index,unique"`
	Token string `json:"-" storm:"unique"`
}

func (UserS) Compare

func (s UserS) Compare(d DataS) bool

func (UserS) Delete

func (s UserS) Delete() error

func (UserS) GenerateToken

func (s UserS) GenerateToken() error

func (UserS) Save

func (s UserS) Save() error

func (UserS) String

func (s UserS) String() string

func (UserS) Update

func (s UserS) Update() error

Jump to

Keyboard shortcuts

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