datastore

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode added in v1.1.0

func Encode(user User) ([]byte, error)

Types

type DataStore

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

func New

func New(path string) (DataStore, error)

func NewEmpty

func NewEmpty() (DataStore, error)

func NewWithDatabase

func NewWithDatabase(db *database.Database) DataStore

func (DataStore) All

func (ds DataStore) All() (Users, error)

func (DataStore) Delete added in v1.2.0

func (ds DataStore) Delete(uuid string) error

func (DataStore) Get

func (ds DataStore) Get(uuid string) (User, error)

func (DataStore) Import

func (ds DataStore) Import(filename string, outstream io.Writer) error

func (DataStore) Put

func (ds DataStore) Put(user User) error

type User

type User struct {
	UUID      string `json:"uuid,omitempty" bson:"uuid,omitempty"`
	Name      string `json:"name,omitempty" bson:"name,omitempty"`
	TimeOfBan int64  `json:"timeofban,omitempty" bson:"timeofban,omitempty"`
}

User struct

func Decode added in v1.1.0

func Decode(byts []byte) (User, error)

type Users

type Users []User

Users type

Jump to

Keyboard shortcuts

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