Documentation
¶
Index ¶
- Constants
- Variables
- func NormalizeID(uid string) string
- type UserDB
- func (db *UserDB) AddHistory(entry *database.HistoryEntry) error
- func (db *UserDB) AddMapping(m *database.Mapping) error
- func (db *UserDB) Allocate() error
- func (db *UserDB) Close() error
- func (db *UserDB) DeleteMapping(id int64) error
- func (db *UserDB) GetAllMappings() ([]database.Mapping, error)
- func (db *UserDB) GetDBPath() string
- func (db *UserDB) GetEnabledMappings() ([]database.Mapping, error)
- func (db *UserDB) GetHistory(lastID int) ([]database.HistoryEntry, error)
- func (db *UserDB) GetMapping(id int64) (database.Mapping, error)
- func (db *UserDB) GetZapLinkCache(url string) (string, error)
- func (db *UserDB) GetZapLinkHost(host string) (exists, allowed bool, err error)
- func (db *UserDB) MigrateUp() error
- func (db *UserDB) Open() error
- func (db *UserDB) SetSQLForTesting(ctx context.Context, sqlDB *sql.DB, platform platforms.Platform) error
- func (db *UserDB) Truncate() error
- func (db *UserDB) UnsafeGetSQLDb() *sql.DB
- func (db *UserDB) UpdateMapping(id int64, m *database.Mapping) error
- func (db *UserDB) UpdateZapLinkCache(url, zapscript string) error
- func (db *UserDB) UpdateZapLinkHost(host string, zapscript int) error
- func (db *UserDB) Vacuum() error
Constants ¶
View Source
const ( MappingTypeID = "id" MappingTypeValue = "value" MappingTypeData = "data" MatchTypeExact = "exact" MatchTypePartial = "partial" MatchTypeRegex = "regex" LegacyMappingTypeUID = "uid" LegacyMappingTypeText = "text" )
Variables ¶
View Source
var AllowedMappingTypes = []string{ MappingTypeID, MappingTypeValue, MappingTypeData, }
View Source
var AllowedMatchTypes = []string{ MatchTypeExact, MatchTypePartial, MatchTypeRegex, }
View Source
var ErrNullSQL = errors.New("UserDB is not connected")
Functions ¶
func NormalizeID ¶
Types ¶
type UserDB ¶
type UserDB struct {
// contains filtered or unexported fields
}
func (*UserDB) AddHistory ¶
func (db *UserDB) AddHistory(entry *database.HistoryEntry) error
func (*UserDB) DeleteMapping ¶
func (*UserDB) GetEnabledMappings ¶
func (*UserDB) GetHistory ¶
func (db *UserDB) GetHistory(lastID int) ([]database.HistoryEntry, error)
func (*UserDB) GetZapLinkHost ¶
func (*UserDB) SetSQLForTesting ¶
func (db *UserDB) SetSQLForTesting(ctx context.Context, sqlDB *sql.DB, platform platforms.Platform) error
SetSQLForTesting allows injection of a sql.DB instance for testing purposes. This method should only be used in tests to set up in-memory databases.
func (*UserDB) UnsafeGetSQLDb ¶
func (*UserDB) UpdateZapLinkCache ¶
func (*UserDB) UpdateZapLinkHost ¶
Click to show internal directories.
Click to hide internal directories.