Documentation
¶
Index ¶
- type ConfigType
- type DatabaseConfigWrapper
- type DeviceConfigWrapper
- type MpesaConfigWrapper
- type RadiusConfigWrapper
- type StorableConfig
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteConfig(configType ConfigType, id string) error
- func (s *Store) DeleteSessionValue(sessionID, key string) error
- func (s *Store) GetConfig(configType ConfigType, id string, out interface{}) error
- func (s *Store) GetSessionValue(sessionID, key string) ([]byte, error)
- func (s *Store) ListConfigsByISP(ispID string, configType ConfigType, outSlice interface{}) error
- func (s *Store) ListDatabaseConfigsByISP(ispID string) ([]DatabaseConfigWrapper, error)
- func (s *Store) ListDeviceConfigsByISP(ispID string) ([]gconfig.DeviceConfig, error)
- func (s *Store) ListMpesaConfigsByISP(ispID string) ([]MpesaConfigWrapper, error)
- func (s *Store) ListRadiusConfigsByISP(ispID string) ([]RadiusConfigWrapper, error)
- func (s *Store) SaveConfig(config StorableConfig) error
- func (s *Store) SaveSessionValue(sessionID, key string, value []byte, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigType ¶
type ConfigType string
ConfigType is an enum to represent different configuration types
const ( DeviceConfigType ConfigType = "device" MpesaConfigType ConfigType = "mpesa" RadiusConfigType ConfigType = "radius" DatabaseConfigType ConfigType = "database" )
type DatabaseConfigWrapper ¶
type DatabaseConfigWrapper struct {
// databaseconfig.DatabaseConfig
ID string
ISPID string
Host string
Port int
Username string
Password string
Database string
Description string
}
DatabaseConfigWrapper wraps the hypothetical databaseconfig.DatabaseConfig
func (DatabaseConfigWrapper) GetID ¶
func (w DatabaseConfigWrapper) GetID() string
GetID implements StorableConfig
func (DatabaseConfigWrapper) GetISPID ¶
func (w DatabaseConfigWrapper) GetISPID() string
GetISPID implements StorableConfig
func (DatabaseConfigWrapper) GetType ¶
func (w DatabaseConfigWrapper) GetType() ConfigType
GetType implements StorableConfig
type DeviceConfigWrapper ¶
type DeviceConfigWrapper struct {
gconfig.DeviceConfig
}
DeviceConfigWrapper wraps the gconfig.DeviceConfig to implement StorableConfig
func (DeviceConfigWrapper) GetID ¶
func (w DeviceConfigWrapper) GetID() string
GetID implements StorableConfig
func (DeviceConfigWrapper) GetISPID ¶
func (w DeviceConfigWrapper) GetISPID() string
GetISPID implements StorableConfig
func (DeviceConfigWrapper) GetType ¶
func (w DeviceConfigWrapper) GetType() ConfigType
GetType implements StorableConfig
type MpesaConfigWrapper ¶
MpesaConfigWrapper wraps the hypothetical mpesaconfig.MpesaConfig
func (MpesaConfigWrapper) GetID ¶
func (w MpesaConfigWrapper) GetID() string
GetID implements StorableConfig
func (MpesaConfigWrapper) GetISPID ¶
func (w MpesaConfigWrapper) GetISPID() string
GetISPID implements StorableConfig
func (MpesaConfigWrapper) GetType ¶
func (w MpesaConfigWrapper) GetType() ConfigType
GetType implements StorableConfig
type RadiusConfigWrapper ¶
type RadiusConfigWrapper struct {
// radiusconfig.RadiusConfig
ID string
ISPID string
Server string
Port int
Secret string
Description string
}
RadiusConfigWrapper wraps the hypothetical radiusconfig.RadiusConfig
func (RadiusConfigWrapper) GetID ¶
func (w RadiusConfigWrapper) GetID() string
GetID implements StorableConfig
func (RadiusConfigWrapper) GetISPID ¶
func (w RadiusConfigWrapper) GetISPID() string
GetISPID implements StorableConfig
func (RadiusConfigWrapper) GetType ¶
func (w RadiusConfigWrapper) GetType() ConfigType
GetType implements StorableConfig
type StorableConfig ¶
type StorableConfig interface {
GetID() string
GetISPID() string // Optional, but useful for organization
GetType() ConfigType
}
StorableConfig is an interface that all configuration types should implement
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store represents the generic storage layer
func (*Store) DeleteConfig ¶
func (s *Store) DeleteConfig(configType ConfigType, id string) error
DeleteConfig deletes a configuration by its type and ID
func (*Store) DeleteSessionValue ¶
DeleteSessionValue deletes a value associated with a session ID
func (*Store) GetConfig ¶
func (s *Store) GetConfig(configType ConfigType, id string, out interface{}) error
GetConfig retrieves a configuration by its type and ID
func (*Store) GetSessionValue ¶
GetSessionValue retrieves a value associated with a session ID
func (*Store) ListConfigsByISP ¶
func (s *Store) ListConfigsByISP(ispID string, configType ConfigType, outSlice interface{}) error
ListConfigsByISP lists all configurations of a specific type for a given ISP
func (*Store) ListDatabaseConfigsByISP ¶
func (s *Store) ListDatabaseConfigsByISP(ispID string) ([]DatabaseConfigWrapper, error)
func (*Store) ListDeviceConfigsByISP ¶
func (s *Store) ListDeviceConfigsByISP(ispID string) ([]gconfig.DeviceConfig, error)
func (*Store) ListMpesaConfigsByISP ¶
func (s *Store) ListMpesaConfigsByISP(ispID string) ([]MpesaConfigWrapper, error)
func (*Store) ListRadiusConfigsByISP ¶
func (s *Store) ListRadiusConfigsByISP(ispID string) ([]RadiusConfigWrapper, error)
func (*Store) SaveConfig ¶
func (s *Store) SaveConfig(config StorableConfig) error
SaveConfig saves a configuration of any supported type