sql

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: BSD-3-Clause-Clear Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Database connection configuration
	Driver   string `mapstructure:"driver"` // "postgres", "mysql", "sqlite"
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Database string `mapstructure:"database"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	SSLMode  string `mapstructure:"ssl_mode"`

	// Connection pool settings
	MaxOpenConnections int           `mapstructure:"max_open_connections"`
	MaxIdleConnections int           `mapstructure:"max_idle_connections"`
	ConnMaxLifetime    time.Duration `mapstructure:"connection_max_lifetime"`
	ConnMaxIdleTime    time.Duration `mapstructure:"connection_max_idle_time"`

	// Query settings
	QueryTimeout time.Duration `mapstructure:"query_timeout"`

	// Health check settings
	HealthCheckQuery string        `mapstructure:"health_check_query"`
	HealthCheckTime  time.Duration `mapstructure:"health_check_timeout"`

	// Description for this SQL provider instance
	Description string `mapstructure:"description"`
}

SQLConfig defines configuration for SQL database providers

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default SQL configuration

type Mapper

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

Mapper handles mapping for SQL providers

func NewMapper

func NewMapper() *Mapper

NewMapper creates a new SQL mapper

func (*Mapper) ApplyTransformation

func (m *Mapper) ApplyTransformation(value interface{}, transformationName string) (interface{}, error)

ApplyTransformation applies SQL-specific transformations

func (*Mapper) ExtractParameters

func (m *Mapper) ExtractParameters(jwtClaims types.JWTClaims, inputMapping []types.InputMapping) (map[string]interface{}, error)

ExtractParameters extracts parameters for SQL queries with proper validation

func (*Mapper) GetSupportedTransformations

func (m *Mapper) GetSupportedTransformations() []string

GetSupportedTransformations returns SQL-specific transformations

func (*Mapper) TransformResults

func (m *Mapper) TransformResults(rawData map[string]interface{}, outputMapping []types.OutputMapping) (map[string]interface{}, error)

TransformResults transforms SQL query results to standardized claims

func (*Mapper) ValidateInputMapping

func (m *Mapper) ValidateInputMapping(inputMapping []types.InputMapping) error

ValidateInputMapping validates SQL-specific input mapping requirements

func (*Mapper) ValidateOutputMapping

func (m *Mapper) ValidateOutputMapping(outputMapping []types.OutputMapping) error

ValidateOutputMapping validates SQL-specific output mapping requirements

type Provider

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

Provider implements the Provider interface for SQL databases

func NewProvider

func NewProvider(ctx context.Context, name string, config Config) (*Provider, error)

NewProvider creates a new SQL provider

func (*Provider) Close

func (p *Provider) Close() error

Close closes the database connection

func (*Provider) GetMapper

func (p *Provider) GetMapper() types.Mapper

GetMapper returns the provider's mapper implementation

func (*Provider) HealthCheck

func (p *Provider) HealthCheck(ctx context.Context) error

HealthCheck verifies the SQL database is accessible

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider instance name

func (*Provider) ResolveEntity

func (p *Provider) ResolveEntity(ctx context.Context, strategy types.MappingStrategy, params map[string]interface{}) (*types.RawResult, error)

ResolveEntity executes SQL query to resolve entity information

func (*Provider) Type

func (p *Provider) Type() string

Type returns the provider type

Jump to

Keyboard shortcuts

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