Documentation
¶
Index ¶
- Variables
- func BuildKey(username, password string) string
- func DecryptPayload(key []byte, value string) (map[string]interface{}, error)
- func DecryptText(key []byte, value string) (string, error)
- func EncryptPayload(key []byte, value map[string]interface{}) (string, error)
- func EncryptText(key []byte, value string) (string, error)
- func GenerateOTP(onlyDigits bool, len int) (otp string)
- type Auth
- type Cache
- type DriverArango
- func (instance *DriverArango) AuthGet(key string) (payload string, err error)
- func (instance *DriverArango) AuthOverwrite(key, payload string) error
- func (instance *DriverArango) AuthRegister(key, payload string) error
- func (instance *DriverArango) AuthRemove(key string) error
- func (instance *DriverArango) CacheAdd(key, token string, duration time.Duration) error
- func (instance *DriverArango) CacheGet(key string) (string, error)
- func (instance *DriverArango) CacheRemove(key string) error
- func (instance *DriverArango) Close() error
- func (instance *DriverArango) Collection(name string, createIfDoesNotExists bool) (*DriverArangoCollection, error)
- func (instance *DriverArango) Count(query string, bindVars map[string]interface{}) (int64, error)
- func (instance *DriverArango) Delete(collectionName string, item interface{}) (map[string]interface{}, error)
- func (instance *DriverArango) EnableCache(value bool)
- func (instance *DriverArango) Enabled() bool
- func (instance *DriverArango) Exec(query string, bindVars map[string]interface{}) (interface{}, error)
- func (instance *DriverArango) Insert(collectionName string, item map[string]interface{}) (map[string]interface{}, error)
- func (instance *DriverArango) OTPNew(key string, len int, onlyDigits bool, duration time.Duration) (response string, err error)
- func (instance *DriverArango) OTPVerify(key, otp string) (response bool, err error)
- func (instance *DriverArango) Open() error
- func (instance *DriverArango) Query(query string, bindVars map[string]interface{}) ([]interface{}, error)
- func (instance *DriverArango) Update(collectionName string, item map[string]interface{}) (map[string]interface{}, error)
- func (instance *DriverArango) Upsert(collectionName string, item map[string]interface{}) (map[string]interface{}, error)
- type DriverArangoCollection
- func (instance *DriverArangoCollection) Count() (int64, error)
- func (instance *DriverArangoCollection) EnsureIndex(typeName string, fields []string, unique bool) (bool, error)
- func (instance *DriverArangoCollection) Exists(key string) (bool, error)
- func (instance *DriverArangoCollection) Name() string
- func (instance *DriverArangoCollection) Read(key string) (map[string]interface{}, driver.DocumentMeta, error)
- func (instance *DriverArangoCollection) Remove(key string) (driver.DocumentMeta, error)
- func (instance *DriverArangoCollection) RemoveIndex(typeName string, fields []string) (bool, error)
- func (instance *DriverArangoCollection) Upsert(doc map[string]interface{}) (map[string]interface{}, driver.DocumentMeta, error)
- type DriverBolt
- func (instance *DriverBolt) AuthGet(key string) (payload string, err error)
- func (instance *DriverBolt) AuthOverwrite(key, payload string) error
- func (instance *DriverBolt) AuthRegister(key, payload string) error
- func (instance *DriverBolt) AuthRemove(key string) (err error)
- func (instance *DriverBolt) CacheAdd(key, token string, duration time.Duration) error
- func (instance *DriverBolt) CacheGet(key string) (string, error)
- func (instance *DriverBolt) CacheRemove(key string) error
- func (instance *DriverBolt) Close() error
- func (instance *DriverBolt) EnableCache(value bool)
- func (instance *DriverBolt) Enabled() bool
- func (instance *DriverBolt) OTPNew(key string, len int, onlyDigits bool, duration time.Duration) (response string, err error)
- func (instance *DriverBolt) OTPVerify(key, otp string) (response bool, err error)
- func (instance *DriverBolt) Open() error
- type DriverGorm
- func (instance *DriverGorm) AuthGet(key string) (payload string, err error)
- func (instance *DriverGorm) AuthOverwrite(key, payload string) error
- func (instance *DriverGorm) AuthRegister(key, payload string) error
- func (instance *DriverGorm) AuthRemove(key string) (err error)
- func (instance *DriverGorm) CacheAdd(key, token string, duration time.Duration) error
- func (instance *DriverGorm) CacheGet(key string) (string, error)
- func (instance *DriverGorm) CacheRemove(key string) error
- func (instance *DriverGorm) Close() error
- func (instance *DriverGorm) EnableCache(value bool)
- func (instance *DriverGorm) Enabled() bool
- func (instance *DriverGorm) GetMode() string
- func (instance *DriverGorm) OTPNew(key string, long int, onlyDigits bool, duration time.Duration) (response string, err error)
- func (instance *DriverGorm) OTPVerify(key, otp string) (response bool, err error)
- func (instance *DriverGorm) Open() error
- func (instance *DriverGorm) SetMode(value string) *DriverGorm
- type Dsn
- type IDatabase
- type Otp
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorInvalidDsn = errors.New("invalid_dsn") ErrorDriverNotImplemented = errors.New("driver_not_implemented") ErrorDatabaseDoesNotExists = errors.New("database_does_not_exists") ErrorCollectionDoesNotExists = errors.New("collection_does_not_exists") ErrorDatabaseCacheCannotAuthenticate = errors.New("database_cache_cannot_authenticate") ErrorDatabaseCacheNotEnabled = errors.New("database_cache_not_enabled") ErrorEntityAlreadyRegistered = errors.New("entity_already_registered") ErrorEntityDoesNotExists = errors.New("entity_does_not_exists") ErrorTokenDoesNotExists = errors.New("token_does_not_exists") ErrorTokenExpired = errors.New("token_expired") )
View Source
var ( CollectionAuth = "auth" // users authentication CollectionCache = "cache" // tokens cache CollectionOTP = "otp" )
View Source
var ( ArangoConst = struct { FieldKey string FieldExpire string FieldOTP string IndexPersist string IndexGeo string IndexGeoJson string }{ FieldKey: "_key", FieldExpire: "_expire", FieldOTP: "otp", IndexPersist: "persist", IndexGeo: "geo", IndexGeoJson: "geojson", } )
View Source
var ( BoltConst = struct { FieldKey string FieldExpire string FieldOTP string }{ FieldKey: "_key", FieldExpire: "_expire", FieldOTP: "otp", } )
Functions ¶
func GenerateOTP ¶
Types ¶
type DriverArango ¶
type DriverArango struct {
// contains filtered or unexported fields
}
func NewDriverArango ¶
func NewDriverArango(dsn *Dsn) *DriverArango
func (*DriverArango) AuthGet ¶
func (instance *DriverArango) AuthGet(key string) (payload string, err error)
func (*DriverArango) AuthOverwrite ¶
func (instance *DriverArango) AuthOverwrite(key, payload string) error
func (*DriverArango) AuthRegister ¶
func (instance *DriverArango) AuthRegister(key, payload string) error
func (*DriverArango) AuthRemove ¶
func (instance *DriverArango) AuthRemove(key string) error
func (*DriverArango) CacheAdd ¶
func (instance *DriverArango) CacheAdd(key, token string, duration time.Duration) error
func (*DriverArango) CacheRemove ¶
func (instance *DriverArango) CacheRemove(key string) error
func (*DriverArango) Close ¶
func (instance *DriverArango) Close() error
func (*DriverArango) Collection ¶
func (instance *DriverArango) Collection(name string, createIfDoesNotExists bool) (*DriverArangoCollection, error)
func (*DriverArango) Count ¶
func (instance *DriverArango) Count(query string, bindVars map[string]interface{}) (int64, error)
func (*DriverArango) Delete ¶
func (instance *DriverArango) Delete(collectionName string, item interface{}) (map[string]interface{}, error)
func (*DriverArango) EnableCache ¶
func (instance *DriverArango) EnableCache(value bool)
func (*DriverArango) Enabled ¶
func (instance *DriverArango) Enabled() bool
func (*DriverArango) Exec ¶
func (instance *DriverArango) Exec(query string, bindVars map[string]interface{}) (interface{}, error)
func (*DriverArango) Insert ¶
func (instance *DriverArango) Insert(collectionName string, item map[string]interface{}) (map[string]interface{}, error)
func (*DriverArango) OTPVerify ¶
func (instance *DriverArango) OTPVerify(key, otp string) (response bool, err error)
func (*DriverArango) Open ¶
func (instance *DriverArango) Open() error
func (*DriverArango) Query ¶
func (instance *DriverArango) Query(query string, bindVars map[string]interface{}) ([]interface{}, error)
type DriverArangoCollection ¶
type DriverArangoCollection struct {
// contains filtered or unexported fields
}
func (*DriverArangoCollection) Count ¶
func (instance *DriverArangoCollection) Count() (int64, error)
func (*DriverArangoCollection) EnsureIndex ¶
func (*DriverArangoCollection) Exists ¶
func (instance *DriverArangoCollection) Exists(key string) (bool, error)
func (*DriverArangoCollection) Name ¶
func (instance *DriverArangoCollection) Name() string
func (*DriverArangoCollection) Read ¶
func (instance *DriverArangoCollection) Read(key string) (map[string]interface{}, driver.DocumentMeta, error)
func (*DriverArangoCollection) Remove ¶
func (instance *DriverArangoCollection) Remove(key string) (driver.DocumentMeta, error)
func (*DriverArangoCollection) RemoveIndex ¶
func (instance *DriverArangoCollection) RemoveIndex(typeName string, fields []string) (bool, error)
type DriverBolt ¶
type DriverBolt struct {
// contains filtered or unexported fields
}
func NewDriverBolt ¶
func NewDriverBolt(dsn ...interface{}) *DriverBolt
func (*DriverBolt) AuthGet ¶
func (instance *DriverBolt) AuthGet(key string) (payload string, err error)
func (*DriverBolt) AuthOverwrite ¶
func (instance *DriverBolt) AuthOverwrite(key, payload string) error
func (*DriverBolt) AuthRegister ¶
func (instance *DriverBolt) AuthRegister(key, payload string) error
func (*DriverBolt) AuthRemove ¶
func (instance *DriverBolt) AuthRemove(key string) (err error)
func (*DriverBolt) CacheAdd ¶
func (instance *DriverBolt) CacheAdd(key, token string, duration time.Duration) error
func (*DriverBolt) CacheRemove ¶
func (instance *DriverBolt) CacheRemove(key string) error
func (*DriverBolt) Close ¶
func (instance *DriverBolt) Close() error
func (*DriverBolt) EnableCache ¶
func (instance *DriverBolt) EnableCache(value bool)
func (*DriverBolt) Enabled ¶
func (instance *DriverBolt) Enabled() bool
func (*DriverBolt) OTPVerify ¶
func (instance *DriverBolt) OTPVerify(key, otp string) (response bool, err error)
func (*DriverBolt) Open ¶
func (instance *DriverBolt) Open() error
type DriverGorm ¶
type DriverGorm struct {
// contains filtered or unexported fields
}
func NewDriverGorm ¶
func NewDriverGorm(driverName string, dsn ...interface{}) *DriverGorm
func (*DriverGorm) AuthGet ¶
func (instance *DriverGorm) AuthGet(key string) (payload string, err error)
func (*DriverGorm) AuthOverwrite ¶
func (instance *DriverGorm) AuthOverwrite(key, payload string) error
func (*DriverGorm) AuthRegister ¶
func (instance *DriverGorm) AuthRegister(key, payload string) error
func (*DriverGorm) AuthRemove ¶
func (instance *DriverGorm) AuthRemove(key string) (err error)
func (*DriverGorm) CacheAdd ¶
func (instance *DriverGorm) CacheAdd(key, token string, duration time.Duration) error
func (*DriverGorm) CacheRemove ¶
func (instance *DriverGorm) CacheRemove(key string) error
func (*DriverGorm) Close ¶
func (instance *DriverGorm) Close() error
func (*DriverGorm) EnableCache ¶
func (instance *DriverGorm) EnableCache(value bool)
func (*DriverGorm) Enabled ¶
func (instance *DriverGorm) Enabled() bool
func (*DriverGorm) GetMode ¶
func (instance *DriverGorm) GetMode() string
func (*DriverGorm) OTPVerify ¶
func (instance *DriverGorm) OTPVerify(key, otp string) (response bool, err error)
func (*DriverGorm) Open ¶
func (instance *DriverGorm) Open() error
func (*DriverGorm) SetMode ¶
func (instance *DriverGorm) SetMode(value string) *DriverGorm
type Dsn ¶
type Dsn struct { User string Password string Protocol string Host string Port int Database string }
"admin:xxxxxxxxx@tcp(localhost:3306)/test"
type IDatabase ¶
type IDatabase interface { Enabled() bool Open() error Close() error EnableCache(value bool) AuthRegister(key, payload string) error AuthGet(key string) (string, error) AuthRemove(key string) error AuthOverwrite(key, payload string) error CacheGet(key string) (string, error) CacheRemove(key string) error CacheAdd(key, token string, duration time.Duration) error // add new or update existing OTPNew(key string, len int, onlyDigits bool, duration time.Duration) (string, error) OTPVerify(key, otp string) (bool, error) }
Click to show internal directories.
Click to hide internal directories.