Versions in this module Expand all Collapse all v0 v0.9.0 Jan 7, 2025 Changes in this version + const ConfigAuth + const ConfigEnabled + const ConfigLevel + const ConfigLogger + const ConfigMemory + const ConfigMetrics + const ConfigMySQL + const ConfigPort + const ConfigPostgresql + const ConfigPrometheus + const ConfigQuery + const ConfigSQLite + const ConfigStore + const ConfigTLS + const ConfigTracer + const DatabaseDefaultFilename + const DatabaseFilenameExt + const DefaultPrometheusConnectionTimeout + const DefaultPrometheusPort + const ProductName + var ErrExist = errors.New("exist") + var ErrInvalid = errors.New("invalid") + var ErrNotEqual = errors.New("not equal") + var ErrNotExist = errors.New("not exist") + var ErrNotSupported = errors.New("not supported") + func NewResultSet(opts ...ResultSetOption) (sql.ResultSet, error) + func NewResultSetColumnFrom(name string, ct *dbsql.ColumnType) (sql.Column, error) + func NewResultSetDataTypeFrom(ct *dbsql.ColumnType) (sql.DataType, error) type Config + func NewConfig() (Config, error) + func NewConfigWithFile(confFile string) (Config, error) + func NewConfigWithPath(path string) (Config, error) + func NewConfigWithPaths(paths ...string) (Config, error) + func NewConfigWithString(conString string) (Config, error) + IsLoggerEnabled func() (bool, error) + IsMemoryStoreEnabled func() (bool, error) + IsPrometheusEnabled func() (bool, error) + IsTLSEnabled func() (bool, error) + LoggerLevel func() (string, error) + MySQLPort func() (int, error) + PostgresqlPort func() (int, error) + PrometheusPort func() (int, error) + TLSConfig func() (*tls.Config, error) + type Database struct + func NewDatabaseWith(opt ...DatabaseOption) (*Database, error) + func (db *Database) Begin() error + func (db *Database) Commit() error + func (db *Database) DB() *sql.DB + func (db *Database) Exec(query string, args ...any) (sql.Result, error) + func (db *Database) Name() string + func (db *Database) Query(query string, args ...any) (*sql.Rows, error) + func (db *Database) Rollback() error + func (db *Database) SetOptions(opts ...DatabaseOption) error + type DatabaseOption func(*Database) error + func WithDatabaseFilename(filename string) DatabaseOption + func WithDatabaseName(name string) DatabaseOption + type Databases struct + func NewDatabases() *Databases + func (dbs *Databases) AddDatabase(db *Database) error + func (dbs *Databases) DropDatabase(db *Database) error + func (dbs *Databases) LookupDatabase(name string) (*Database, error) + type PrometheusExporter struct + Addr string + Port int + func NewPrometheusExporter() *PrometheusExporter + func (expoter *PrometheusExporter) SetAddress(addr string) + func (expoter *PrometheusExporter) SetPort(port int) + func (expoter *PrometheusExporter) Start() error + func (expoter *PrometheusExporter) Stop() error + type ResultSetOption func(*resultset) error + func WithResultSetResult(result dbsql.Result) ResultSetOption + func WithResultSetRows(rows *dbsql.Rows) ResultSetOption + type SQLExecutor = sql.Executor type Server + MySQLServer func() mysql.Server + PostgreSQLServer func() postgresql.Server + SetConfig func(Config) + SetSQLExecutor func(SQLExecutor) + SetTracer func(tracer.Tracer) v0.0.0 Nov 6, 2024 Changes in this version + const Version + type Config struct + func NewDefaultConfig() *Config + func (config *Config) Address() string + func (config *Config) SetAddress(addr string) + type Conn interface + type ConnID = sql.ConnID + type Server struct + func NewServer() *Server + func (server *Server) Restart() error + func (server *Server) Start() error + func (server *Server) Stop() error + type TLSConf struct + ClientAuthType tls.ClientAuthType + RootCerts [][]byte + ServerCert []byte + ServerKey []byte + func NewTLSConf() *TLSConf + func (config *TLSConf) IsTLSEnabled() bool + func (config *TLSConf) SetClientAuthType(authType tls.ClientAuthType) + func (config *TLSConf) SetRootCertFiles(files ...string) error + func (config *TLSConf) SetRootCerts(certs ...[]byte) + func (config *TLSConf) SetServerCert(cert []byte) + func (config *TLSConf) SetServerCertFile(file string) error + func (config *TLSConf) SetServerKey(key []byte) + func (config *TLSConf) SetServerKeyFile(file string) error + func (config *TLSConf) SetTLSConfig(tlsConfig *tls.Config) + func (config *TLSConf) SetTLSEnabled(enabled bool) + func (config *TLSConf) TLSConfig() (*tls.Config, error)