Documentation
¶
Overview ¶
Package sql implements Inventory and NonceChecker backed by SQL database.
Supports at least PostgreSQL 9.5+ (github.com/lib/pq) and SQLite 3.24+ (modernc.org/sqlite, github.com/mattn/go-sqlite3).
Index ¶
- Constants
- Variables
- type Config
- type Endpoint
- func (x *Endpoint) AddModuleSource(ctx context.Context, module, source string) error
- func (x *Endpoint) CheckNonce(ctx context.Context, scope []byte, nonce string, expire time.Time) error
- func (x *Endpoint) Close() error
- func (x *Endpoint) GetSourceModule(ctx context.Context, source string) (string, error)
- func (x *Endpoint) InitInventory(ctx context.Context) error
- func (x *Endpoint) InitNonceChecker(ctx context.Context) error
Constants ¶
View Source
const InventorySchema = `
CREATE TABLE IF NOT EXISTS module_source (
module TEXT NOT NULL,
source TEXT NOT NULL,
PRIMARY KEY (source)
);
`
View Source
const NonceSchema = `` /* 198-byte string literal not displayed */
Variables ¶
View Source
var Adapter = database.Register(&database.Adapter{ Name: "sql", NewConfig: func() database.Config { return &adaptedConfig{ Config: DefaultConfig.Clone(), } }, Open: func(config database.Config) (database.Endpoint, error) { x, err := Open(config.(*adaptedConfig).Config) if err != nil { return nil, err } return x, err }, InitInventory: func(ctx context.Context, endpoint database.Endpoint) (database.Inventory, error) { x := endpoint.(*Endpoint) if err := x.InitInventory(ctx); err != nil { return nil, err } return x, nil }, InitNonceChecker: func(ctx context.Context, endpoint database.Endpoint) (database.NonceChecker, error) { x := endpoint.(*Endpoint) if err := x.InitNonceChecker(ctx); err != nil { return nil, err } return x, nil }, })
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func (*Endpoint) AddModuleSource ¶
func (*Endpoint) CheckNonce ¶
func (*Endpoint) GetSourceModule ¶
Click to show internal directories.
Click to hide internal directories.