storage

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadSetting = errors.New("bad setting")

ErrBadSetting is the error returned if an unknown setting is accessed

View Source
var ErrCharacterNotExist = errors.New("character does not exist")

ErrCharacterNotExist is the error returned if a character does not exist

View Source
var ErrGuildNotExist = errors.New("guild does not exist")

ErrGuildNotExist is the error returned if a guild does not exist

View Source
var ErrItemNotExist = errors.New("item does not exist")

ErrItemNotExist is the error returned if an item does not exist

View Source
var ErrSkillNotExist = errors.New("skill does not exist")

ErrSkillNotExist is the error returned if a skill does not exist

View Source
var ErrTransmuteNotExist = errors.New("transmute does not exist")

ErrTransmuteNotExist is the error returned if a transmute does not exist

View Source
var ErrUserNotExist = errors.New("user does not exist")

ErrUserNotExist is the error returned if a user does not exist

Functions

This section is empty.

Types

type Character

type Character interface {
	GetName() string
	GetNeededSkill(name string) (Skill, error)
	GetNeededSkills() []Skill
	GetNeededItem(name string) (Item, error)
	GetNeededItems() []Item
	GetNeededTransmute(name string) (Transmute, error)
	GetNeededTransmutes() []Transmute

	SetName(name string)
	IncrNeededSkill(name string, amt uint64)
	DecrNeededSkill(name string, amt uint64)
	IncrNeededItem(name string, amt uint64)
	DecrNeededItem(name string, amt uint64)
	IncrNeededTransmute(name string, amt uint64)
	DecrNeededTransmute(name string, amt uint64)
}

Character is the api for managing a user's particular character

type Guild

type Guild interface {
	GetName() string
	GetSettings() GuildSettings

	SetName(name string)
	SetSettings(s GuildSettings)

	Serialize() ([]byte, error)
}

Guild is the api for managing a particular guild

type GuildAPI

type GuildAPI interface {
	NewTransaction(writable bool) (GuildAPITx, error)
}

GuildAPI is the api for managing guilds transactions

func NewBoltGuildAPI

func NewBoltGuildAPI(db *bolt.DB) (GuildAPI, error)

NewBoltGuildAPI constructs a boltDB-backed GuildAPI

type GuildAPITx

type GuildAPITx interface {
	Commit() error
	Rollback() error

	GetGuild(name string) (Guild, error)
	AddGuild(name string) (Guild, error)
	SaveGuild(guild Guild) error
}

GuildAPITx is the api for managing guilds within a transaction

type GuildSettings

type GuildSettings struct {
	ControlSequence string
}

GuildSettings is the configuration settings set for a guild

func (*GuildSettings) GetSettingString

func (s *GuildSettings) GetSettingString(name string) (string, error)

GetSettingString returns the value of the requested setting

func (*GuildSettings) PrettyString

func (s *GuildSettings) PrettyString() string

PrettyString returns a multi-line string representation of the guild settings

func (*GuildSettings) SetSettingString

func (s *GuildSettings) SetSettingString(name, val string) error

SetSettingString sets the value of the requested setting

type Item

type Item interface {
	Name() string
	Count() uint64
}

Item is the api for managing a character's item entry

type Skill

type Skill interface {
	Name() string
	Points() uint64
}

Skill is the api for managing a character's skill entry

type Transmute

type Transmute interface {
	Name() string
	Count() uint64
}

Transmute is the api for managing a character's transmute entry

type User

type User interface {
	GetName() string
	GetCharacter(name string) (Character, error)
	GetCharacters() []Character

	SetName(name string)
	AddCharacter(name string) Character
	DeleteCharacter(name string)

	Serialize() ([]byte, error)
}

User is the api for managing a particular user

type UserAPI

type UserAPI interface {
	NewTransaction(writable bool) (UserAPITx, error)
}

UserAPI is the api for managing users transactions

func NewBoltUserAPI

func NewBoltUserAPI(db *bolt.DB) (UserAPI, error)

NewBoltUserAPI constructs a boltDB-backed UserAPI

type UserAPITx

type UserAPITx interface {
	Commit() error
	Rollback() error

	GetUser(name string) (User, error)
	GetUsers() []User

	AddUser(name string) (User, error)
	SaveUser(user User) error
}

UserAPITx is the api for managing users within a transaction

Jump to

Keyboard shortcuts

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