db

package
v0.0.0-...-6312dd6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AddonTable = "settings"
View Source
const SettingsTable = "settings"
View Source
const ThingTable = "things"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Reset    bool
	FileName string
}

type Storage

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

func NewStorage

func NewStorage(filePath string, conf ...Config) (*Storage, error)

func (*Storage) CreateJSONWebToken

func (s *Storage) CreateJSONWebToken(t *TokeDataStorage) error

func (*Storage) CreateRule

func (s *Storage) CreateRule(description rules_engine.Rule) (int64, error)

func (*Storage) CreateThing

func (s *Storage) CreateThing(id string, thing *container.Thing) error

func (*Storage) CreateUser

func (s *Storage) CreateUser(u *User) (int64, error)

func (*Storage) DeleteRule

func (s *Storage) DeleteRule(ruleId int64) error

func (*Storage) DeleteThing

func (s *Storage) DeleteThing(id string) error

func (*Storage) DeleteUser

func (s *Storage) DeleteUser(id int64) error

func (*Storage) GetJSONWebTokenByKeyId

func (s *Storage) GetJSONWebTokenByKeyId(keyId string) (*TokeDataStorage, error)

func (*Storage) GetRules

func (s *Storage) GetRules() map[int64]rules_engine.RuleDescription

func (*Storage) GetSetting

func (s *Storage) GetSetting(key string) (value string, err error)

func (*Storage) GetThings

func (s *Storage) GetThings() map[string][]byte

func (*Storage) GetUsers

func (s *Storage) GetUsers() []*User

func (*Storage) LoadAddonConfig

func (s *Storage) LoadAddonConfig(key string) (value string, err error)

func (*Storage) LoadAddonSetting

func (s *Storage) LoadAddonSetting(key string) (value string, err error)

func (*Storage) RemoveAddonSettingAndConfig

func (s *Storage) RemoveAddonSettingAndConfig(key string) error

func (*Storage) RemoveSetting

func (s *Storage) RemoveSetting(key string) error

func (*Storage) SetSetting

func (s *Storage) SetSetting(key, value string) error

func (*Storage) StoreAddonSetting

func (s *Storage) StoreAddonSetting(key, value string) error

func (*Storage) StoreAddonsConfig

func (s *Storage) StoreAddonsConfig(key string, v any) error

func (*Storage) UpdateAddonConfig

func (s *Storage) UpdateAddonConfig(id, value string) (err error)

func (*Storage) UpdateAddonSetting

func (s *Storage) UpdateAddonSetting(id, value string) (err error)

func (*Storage) UpdateRule

func (s *Storage) UpdateRule(ruleId int64, r rules_engine.Rule) error

func (*Storage) UpdateThing

func (s *Storage) UpdateThing(id string, thing *container.Thing) (err error)

func (*Storage) UpdateUser

func (s *Storage) UpdateUser(u *User) error

type TokeDataStorage

type TokeDataStorage struct {
	KeyId     string
	User      int64
	IssuedAt  time.Time
	PublicKey []byte
	PayLoad   []byte
}

type User

type User struct {
	ID              int64
	Name            string
	Email           string
	Hash            string
	MfaSharedSecret string
	MfaEnrolled     bool
	MfaBackupCodes  string
}

Jump to

Keyboard shortcuts

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