storage

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package storage contains types and functions for managing data storage in identity-api.

Index

Constants

This section is empty.

Variables

View Source
var ErrorInvalidContextTx = fmt.Errorf("invalid type for transaction context")

ErrorInvalidContextTx represents an error where the given context transaction is of the wrong type.

View Source
var ErrorMissingContextTx = fmt.Errorf("no transaction provided in context")

ErrorMissingContextTx represents an error where no context transaction was provided.

Functions

func InMemoryCRDB added in v0.0.8

func InMemoryCRDB() (testserver.TestServer, error)

InMemoryCRDB creates an in-memory CRDB test server.

func RunMigrations added in v0.0.6

func RunMigrations(config crdbx.Config) error

RunMigrations runs all migrations using the given storage config.

func SeedDatabase added in v0.0.6

func SeedDatabase(config crdbx.Config, path string) error

SeedDatabase seeds the database using the data at the given path

func WithHTTPClient

func WithHTTPClient(client *http.Client) func(svc *userInfoService)

WithHTTPClient allows configuring the HTTP client used by userInfoService to call out to userinfo endpoints.

Types

type Engine

Engine represents a storage engine.

func NewEngine

func NewEngine(config crdbx.Config, opts ...EngineOption) (Engine, error)

NewEngine creates a new storage engine based on the given config.

type EngineOption added in v0.0.8

type EngineOption func(*engine) error

EngineOption defines an initialization option for a storage engine.

func WithMigrations added in v0.0.8

func WithMigrations() EngineOption

WithMigrations runs migrations on the storage engine.

func WithSeedData added in v0.0.8

func WithSeedData(data SeedData) EngineOption

WithSeedData adds seed data to the storage engine.

func WithTracing added in v0.0.8

func WithTracing(config crdbx.Config) EngineOption

WithTracing enables tracing for the storage engine.

type SeedData

type SeedData struct {
	Issuers []SeedIssuer
}

SeedData represents the seed data for an identity-api instance on startup.

type SeedIssuer

type SeedIssuer struct {
	TenantID      string            `yaml:"tenantID"`
	ID            string            `yaml:"id"`
	Name          string            `yaml:"name"`
	URI           string            `yaml:"uri"`
	JWKSURI       string            `yaml:"jwksURI"`
	ClaimMappings map[string]string `yaml:"claimMappings"`
}

SeedIssuer represents the seed data for a single issuer.

type TransactionManager

type TransactionManager interface {
	BeginContext(context.Context) (context.Context, error)
	CommitContext(context.Context) error
	RollbackContext(context.Context) error
}

TransactionManager manages the state of sql transactions within a context

Jump to

Keyboard shortcuts

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