Versions in this module Expand all Collapse all v0 v0.1.2 May 27, 2026 v0.1.1 May 27, 2026 v0.1.0 May 27, 2026 Changes in this version + const DefaultMaxIdleConns + const DefaultMaxOpenConns + var ErrNotImplementation error = errors.New("not implementation") + func Coalesce(str ...string) string + func ColumnDoc(tableName string, colDesc *ColumnDesc) string + func Columns(rows pgx.Rows) ([]string, error) + func QueryExecType(prefix, sqlstr string) (string, bool) + func RegisterFactory(name dialect.DatabaseDriver, factory Factory) + func RegisterOpen(name dialect.DatabaseDriver, opener Opener) + func Registered(name dialect.DatabaseDriver) bool + func ScanRows(rows pgx.Rows, columnLength int) ([][]string, error) + func SubqueryColumnDoc(identName string, views []*parseutil.SubQueryView, dbCache *DBCache) string + func SubqueryDoc(name string, views []*parseutil.SubQueryView, dbCache *DBCache) string + func TableDoc(tableName string, cols []*ColumnDesc) string + type ColumnBase struct + Name string + Schema string + Table string + type ColumnDesc struct + Default sql.NullString + Extra string + Key string + Null string + Type string + func (cd *ColumnDesc) OnelineDesc() string + type DBCache struct + ColumnsWithParent map[string][]*ColumnDesc + ForeignKeys map[string]map[string][]*ForeignKey + SchemaTables map[string][]string + Schemas map[string]string + func (dc *DBCache) Column(tableName, colName string) (*ColumnDesc, bool) + func (dc *DBCache) ColumnDatabase(dbName, tableName string) (cols []*ColumnDesc, ok bool) + func (dc *DBCache) ColumnDescs(tableName string) (cols []*ColumnDesc, ok bool) + func (dc *DBCache) Database(dbName string) (db string, ok bool) + func (dc *DBCache) SortedSchemas() []string + func (dc *DBCache) SortedTables() []string + func (dc *DBCache) SortedTablesByDBName(dbName string) (tbls []string, ok bool) + type DBCacheGenerator struct + func NewDBCacheUpdater(repo DBRepository) *DBCacheGenerator + func (u *DBCacheGenerator) GenerateDBCachePrimary(ctx context.Context) (*DBCache, error) + func (u *DBCacheGenerator) GenerateDBCacheSecondary(ctx context.Context) (map[string][]*ColumnDesc, error) + type DBConfig struct + Alias string + DBName string + DataSourceName string + Driver dialect.DatabaseDriver + Host string + Params map[string]string + Passwd string + Path string + Port int + Proto Proto + SSHCfg *SSHConfig + User string + func (c *DBConfig) Validate() error + type DBConnection struct + Conn *pgx.Conn + Driver dialect.DatabaseDriver + SSHConn *ssh.Client + func Open(cfg *DBConfig) (*DBConnection, error) + func (db *DBConnection) Close() error + type DBOption struct + MaxIdleConns int + MaxOpenConns int + type DBRepository interface + CurrentDatabase func(ctx context.Context) (string, error) + CurrentSchema func(ctx context.Context) (string, error) + Databases func(ctx context.Context) ([]string, error) + DescribeDatabaseTable func(ctx context.Context) ([]*ColumnDesc, error) + DescribeDatabaseTableBySchema func(ctx context.Context, schemaName string) ([]*ColumnDesc, error) + DescribeForeignKeysBySchema func(ctx context.Context, schemaName string) ([]*ForeignKey, error) + Driver func() dialect.DatabaseDriver + Exec func(ctx context.Context, query string) (pgconn.CommandTag, error) + Query func(ctx context.Context, query string) (pgx.Rows, error) + SchemaTables func(ctx context.Context) (map[string][]string, error) + Schemas func(ctx context.Context) ([]string, error) + func CreateRepository(driver dialect.DatabaseDriver, db *pgx.Conn) (DBRepository, error) + func NewMockDBRepository(_ *pgx.Conn) DBRepository + func NewPostgreSQLDBRepository(conn *pgx.Conn) DBRepository + type Factory func(*pgx.Conn) DBRepository + type ForeignKey [][2]*ColumnBase + type MockDBRepository struct + MockDatabase func(context.Context) (string, error) + MockDatabaseTables func(context.Context) (map[string][]string, error) + MockDatabases func(context.Context) ([]string, error) + MockDescribeDatabaseTable func(context.Context) ([]*ColumnDesc, error) + MockDescribeDatabaseTableBySchema func(context.Context, string) ([]*ColumnDesc, error) + MockDescribeForeignKeysBySchema func(context.Context, string) ([]*ForeignKey, error) + MockDescribeTable func(context.Context, string) ([]*ColumnDesc, error) + MockExec func(context.Context, string) (pgconn.CommandTag, error) + MockQuery func(context.Context, string) (pgx.Rows, error) + MockTables func(context.Context) ([]string, error) + func (m *MockDBRepository) CurrentDatabase(ctx context.Context) (string, error) + func (m *MockDBRepository) CurrentSchema(ctx context.Context) (string, error) + func (m *MockDBRepository) Databases(ctx context.Context) ([]string, error) + func (m *MockDBRepository) DescribeDatabaseTable(ctx context.Context) ([]*ColumnDesc, error) + func (m *MockDBRepository) DescribeDatabaseTableBySchema(ctx context.Context, schemaName string) ([]*ColumnDesc, error) + func (m *MockDBRepository) DescribeForeignKeysBySchema(ctx context.Context, schemaName string) ([]*ForeignKey, error) + func (m *MockDBRepository) Driver() dialect.DatabaseDriver + func (m *MockDBRepository) Exec(ctx context.Context, query string) (pgconn.CommandTag, error) + func (m *MockDBRepository) Query(ctx context.Context, query string) (pgx.Rows, error) + func (m *MockDBRepository) SchemaTables(ctx context.Context) (map[string][]string, error) + func (m *MockDBRepository) Schemas(ctx context.Context) ([]string, error) + func (m *MockDBRepository) Tables(ctx context.Context) ([]string, error) + type MockRows struct + func (m *MockRows) Close() + func (m *MockRows) CommandTag() pgconn.CommandTag + func (m *MockRows) Conn() *pgx.Conn + func (m *MockRows) Err() error + func (m *MockRows) FieldDescriptions() []pgconn.FieldDescription + func (m *MockRows) Next() bool + func (m *MockRows) RawValues() [][]byte + func (m *MockRows) Scan(dest ...any) error + func (m *MockRows) Values() ([]any, error) + type Opener func(*DBConfig) (*DBConnection, error) + type PostgreSQLDBRepository struct + Conn *pgx.Conn + func (db *PostgreSQLDBRepository) CurrentDatabase(ctx context.Context) (string, error) + func (db *PostgreSQLDBRepository) CurrentSchema(ctx context.Context) (string, error) + func (db *PostgreSQLDBRepository) Databases(ctx context.Context) ([]string, error) + func (db *PostgreSQLDBRepository) DescribeDatabaseTable(ctx context.Context) ([]*ColumnDesc, error) + func (db *PostgreSQLDBRepository) DescribeDatabaseTableBySchema(ctx context.Context, schemaName string) ([]*ColumnDesc, error) + func (db *PostgreSQLDBRepository) DescribeForeignKeysBySchema(ctx context.Context, schemaName string) ([]*ForeignKey, error) + func (db *PostgreSQLDBRepository) Driver() dialect.DatabaseDriver + func (db *PostgreSQLDBRepository) Exec(ctx context.Context, query string) (pgconn.CommandTag, error) + func (db *PostgreSQLDBRepository) Query(ctx context.Context, query string) (pgx.Rows, error) + func (db *PostgreSQLDBRepository) SchemaTables(ctx context.Context) (map[string][]string, error) + func (db *PostgreSQLDBRepository) Schemas(ctx context.Context) ([]string, error) + func (db *PostgreSQLDBRepository) Tables(ctx context.Context) ([]string, error) + type Proto string + const ProtoHTTP + const ProtoTCP + const ProtoUDP + const ProtoUnix + type SSHConfig struct + Host string + PassPhrase string + Port int + PrivateKey string + User string + func (s *SSHConfig) ClientConfig() (*ssh.ClientConfig, error) + func (s *SSHConfig) Endpoint() string + func (s *SSHConfig) Validate() error + type Worker struct + func NewWorker() *Worker + func (w *Worker) Cache() *DBCache + func (w *Worker) ReCache(ctx context.Context, repo DBRepository) error + func (w *Worker) Start() + func (w *Worker) Stop()