types

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionInfo

type ConnectionInfo struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Database string `json:"database"`
	User     string `json:"user"`
	Driver   string `json:"driver"`
	Version  string `json:"version"`
}

ConnectionInfo represents database connection information

type DatabaseFeature

type DatabaseFeature string

DatabaseFeature represents a database feature

const (
	FeatureTransactions   DatabaseFeature = "transactions"
	FeaturePreparedStmts  DatabaseFeature = "prepared_statements"
	FeatureConnectionPool DatabaseFeature = "connection_pool"
	FeatureReadReplicas   DatabaseFeature = "read_replicas"
	FeatureClustering     DatabaseFeature = "clustering"
	FeatureSharding       DatabaseFeature = "sharding"
	FeatureFullTextSearch DatabaseFeature = "full_text_search"
	FeatureJSONSupport    DatabaseFeature = "json_support"
	FeatureGeoSpatial     DatabaseFeature = "geo_spatial"
	FeatureTimeSeries     DatabaseFeature = "time_series"
	FeatureGraphDB        DatabaseFeature = "graph_db"
	FeatureKeyValue       DatabaseFeature = "key_value"
	FeatureDocumentStore  DatabaseFeature = "document_store"
	FeatureColumnFamily   DatabaseFeature = "column_family"
	FeatureInMemory       DatabaseFeature = "in_memory"
	FeaturePersistent     DatabaseFeature = "persistent"
)

type DatabaseStats

type DatabaseStats struct {
	ActiveConnections int                    `json:"active_connections"`
	IdleConnections   int                    `json:"idle_connections"`
	MaxConnections    int                    `json:"max_connections"`
	WaitCount         int64                  `json:"wait_count"`
	WaitDuration      time.Duration          `json:"wait_duration"`
	MaxIdleClosed     int64                  `json:"max_idle_closed"`
	MaxIdleTimeClosed int64                  `json:"max_idle_time_closed"`
	MaxLifetimeClosed int64                  `json:"max_lifetime_closed"`
	ProviderData      map[string]interface{} `json:"provider_data"`
}

DatabaseStats represents database statistics

type ExecResult

type ExecResult interface {
	LastInsertId() (int64, error)
	RowsAffected() (int64, error)
}

ExecResult represents the result of an execution

type PreparedStatement

type PreparedStatement interface {
	Close() error
	Query(ctx context.Context, args ...interface{}) (QueryResult, error)
	QueryRow(ctx context.Context, args ...interface{}) (Row, error)
	Exec(ctx context.Context, args ...interface{}) (ExecResult, error)
}

PreparedStatement represents a prepared statement

type QueryResult

type QueryResult interface {
	Close() error
	Next() bool
	Scan(dest ...interface{}) error
	Columns() ([]string, error)
	Err() error
}

QueryResult represents the result of a query

type Row

type Row interface {
	Scan(dest ...interface{}) error
	Err() error
}

Row represents a single row from a query

type Transaction

type Transaction interface {
	Commit() error
	Rollback() error
	Query(ctx context.Context, query string, args ...interface{}) (QueryResult, error)
	QueryRow(ctx context.Context, query string, args ...interface{}) (Row, error)
	Exec(ctx context.Context, query string, args ...interface{}) (ExecResult, error)
	Prepare(ctx context.Context, query string) (PreparedStatement, error)
}

Transaction represents a database transaction

Jump to

Keyboard shortcuts

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