userdb

package
v2.6.0-beta10 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: GPL-3.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MappingTypeID         = "id"
	MappingTypeValue      = "value"
	MappingTypeData       = "data"
	MatchTypeExact        = "exact"
	MatchTypePartial      = "partial"
	MatchTypeRegex        = "regex"
	LegacyMappingTypeUID  = "uid"
	LegacyMappingTypeText = "text"
)

Variables

View Source
var ErrNullSQL = errors.New("UserDB is not connected")

Functions

func NormalizeID

func NormalizeID(uid string) string

Types

type UserDB

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

func OpenUserDB

func OpenUserDB(ctx context.Context, pl platforms.Platform) (*UserDB, error)

func (*UserDB) AddHistory

func (db *UserDB) AddHistory(entry *database.HistoryEntry) error

func (*UserDB) AddMapping

func (db *UserDB) AddMapping(m *database.Mapping) error

func (*UserDB) Allocate

func (db *UserDB) Allocate() error

func (*UserDB) Close

func (db *UserDB) Close() error

func (*UserDB) DeleteMapping

func (db *UserDB) DeleteMapping(id int64) error

func (*UserDB) GetAllMappings

func (db *UserDB) GetAllMappings() ([]database.Mapping, error)

func (*UserDB) GetDBPath

func (db *UserDB) GetDBPath() string

func (*UserDB) GetEnabledMappings

func (db *UserDB) GetEnabledMappings() ([]database.Mapping, error)

func (*UserDB) GetHistory

func (db *UserDB) GetHistory(lastID int) ([]database.HistoryEntry, error)

func (*UserDB) GetMapping

func (db *UserDB) GetMapping(id int64) (database.Mapping, error)

func (*UserDB) GetZapLinkCache

func (db *UserDB) GetZapLinkCache(url string) (string, error)

func (*UserDB) GetZapLinkHost

func (db *UserDB) GetZapLinkHost(host string) (exists, allowed bool, err error)

func (*UserDB) MigrateUp

func (db *UserDB) MigrateUp() error

func (*UserDB) Open

func (db *UserDB) Open() error

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) Truncate

func (db *UserDB) Truncate() error

func (*UserDB) UnsafeGetSQLDb

func (db *UserDB) UnsafeGetSQLDb() *sql.DB

func (*UserDB) UpdateMapping

func (db *UserDB) UpdateMapping(id int64, m *database.Mapping) error

func (*UserDB) UpdateZapLinkCache

func (db *UserDB) UpdateZapLinkCache(url, zapscript string) error

func (*UserDB) UpdateZapLinkHost

func (db *UserDB) UpdateZapLinkHost(host string, zapscript int) error

func (*UserDB) Vacuum

func (db *UserDB) Vacuum() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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