{"modulePath":"github.com/bitechdev/ResolveSpec","version":"v1.3.14","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package database\n\n## Functions\n\n```go\nfunc ExampleCompleteWorkflow() error\n```\nExampleCompleteWorkflow demonstrates a complete workflow with preloading\n\n```go\nfunc ExampleJoinRelation() error\n```\nExampleJoinRelation demonstrates explicit JOIN loading\n\n```go\nfunc ExamplePgSQLAdapter() error\n```\nExample demonstrates how to use the PgSQL adapter\n\n```go\nfunc ExamplePreload() error\n```\nExamplePreload demonstrates the Preload functionality\n\n```go\nfunc ExamplePreloadRelation() error\n```\nExamplePreloadRelation demonstrates smart PreloadRelation with auto-detection\n\n```go\nfunc ExampleScanModel() error\n```\nExampleScanModel demonstrates ScanModel with struct destinations\n\n```go\nfunc ExampleWithModel() error\n```\nExampleWithModel demonstrates using models with the PgSQL adapter\n\n```go\nfunc GetMSSQLDialect() *mssqldialect.Dialect\n```\nGetMSSQLDialect returns a Bun MSSQL dialect\n\n```go\nfunc GetMSSQLDialector(db *sql.DB) gorm.Dialector\n```\nGetMSSQLDialector returns a GORM MSSQL dialector\n\n```go\nfunc GetPostgresDialect() *pgdialect.Dialect\n```\nGetPostgresDialect returns a Bun PostgreSQL dialect\n\n```go\nfunc GetPostgresDialector(db *sql.DB) gorm.Dialector\n```\nGetPostgresDialector returns a GORM PostgreSQL dialector\n\n```go\nfunc GetSQLiteDialect() *sqlitedialect.Dialect\n```\nGetSQLiteDialect returns a Bun SQLite dialect\n\n```go\nfunc GetSQLiteDialector(db *sql.DB) gorm.Dialector\n```\nGetSQLiteDialector returns a GORM SQLite dialector\n\n## Types\n\n```go\ntype Author struct {\n\tID    int     `db:\"id\"`\n\tName  string  `db:\"name\"`\n\tEmail string  `db:\"email\"`\n\tPosts []*Post `bun:\"rel:has-many,join:id=author_id\"`\n}\n```\nAuthor model - has many Posts\n\n```go\nfunc (a Author) TableName() string\n```\n\n```go\ntype BunAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nBunAdapter adapts Bun to work with our Database interface This demonstrates how the abstraction works with different ORMs\n\n```go\nfunc NewBunAdapter(db *bun.DB) *BunAdapter\n```\nNewBunAdapter creates a new Bun adapter\n\n```go\nfunc (b *BunAdapter) BeginTx(ctx context.Context) (common.Database, error)\n```\n\n```go\nfunc (b *BunAdapter) CommitTx(ctx context.Context) error\n```\n\n```go\nfunc (b *BunAdapter) DisableQueryDebug()\n```\nDisableQueryDebug removes all query hooks\n\n```go\nfunc (b *BunAdapter) DriverName() string\n```\n\n```go\nfunc (b *BunAdapter) EnableDetailedScanDebug()\n```\nEnableDetailedScanDebug enables verbose logging of scan operations WARNING: This generates a LOT of log output. Use only for debugging specific issues.\n\n```go\nfunc (b *BunAdapter) EnableQueryDebug()\n```\nEnableQueryDebug enables query debugging which logs all SQL queries including preloads This is useful for debugging preload queries that may be failing\n\n```go\nfunc (b *BunAdapter) Exec(ctx context.Context, query string, args ...interface{}) (res common.Result, err error)\n```\n\n```go\nfunc (b *BunAdapter) GetUnderlyingDB() interface{}\n```\n\n```go\nfunc (b *BunAdapter) NewDelete() common.DeleteQuery\n```\n\n```go\nfunc (b *BunAdapter) NewInsert() common.InsertQuery\n```\n\n```go\nfunc (b *BunAdapter) NewSelect() common.SelectQuery\n```\n\n```go\nfunc (b *BunAdapter) NewUpdate() common.UpdateQuery\n```\n\n```go\nfunc (b *BunAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) (err error)\n```\n\n```go\nfunc (b *BunAdapter) RollbackTx(ctx context.Context) error\n```\n\n```go\nfunc (b *BunAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) (err error)\n```\n\n```go\nfunc (b *BunAdapter) SQLDB() *sql.DB\n```\nSQLDB implements common.SQLDBProvider.\n\n```go\nfunc (b *BunAdapter) SetMetricsEnabled(enabled bool) *BunAdapter\n```\nSetMetricsEnabled enables or disables query metrics for this adapter.\n\n```go\nfunc (b *BunAdapter) WithDBFactory(factory func() (*bun.DB, error)) *BunAdapter\n```\nWithDBFactory configures a factory used to reopen the database connection if it is closed.\n\n```go\ntype BunDeleteQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nBunDeleteQuery implements DeleteQuery for Bun\n\n```go\nfunc (b *BunDeleteQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (b *BunDeleteQuery) Model(model interface{}) common.DeleteQuery\n```\n\n```go\nfunc (b *BunDeleteQuery) Table(table string) common.DeleteQuery\n```\n\n```go\nfunc (b *BunDeleteQuery) Where(query string, args ...interface{}) common.DeleteQuery\n```\n\n```go\ntype BunInsertQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nBunInsertQuery implements InsertQuery for Bun\n\n```go\nfunc (b *BunInsertQuery) ExcludeColumn(columns ...string) common.InsertQuery\n```\n\n```go\nfunc (b *BunInsertQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (b *BunInsertQuery) Model(model interface{}) common.InsertQuery\n```\n\n```go\nfunc (b *BunInsertQuery) OnConflict(action string) common.InsertQuery\n```\n\n```go\nfunc (b *BunInsertQuery) Returning(columns ...string) common.InsertQuery\n```\n\n```go\nfunc (b *BunInsertQuery) Scan(ctx context.Context, dest interface{}) (err error)\n```\n\n```go\nfunc (b *BunInsertQuery) Table(table string) common.InsertQuery\n```\n\n```go\nfunc (b *BunInsertQuery) Value(column string, value interface{}) common.InsertQuery\n```\n\n```go\ntype BunResult struct {\n\t// contains filtered or unexported fields\n}\n```\nBunResult implements Result for Bun\n\n```go\nfunc (b *BunResult) LastInsertId() (int64, error)\n```\n\n```go\nfunc (b *BunResult) RowsAffected() int64\n```\n\n```go\ntype BunSelectQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nBunSelectQuery implements SelectQuery for Bun\n\n```go\nfunc (b *BunSelectQuery) Column(columns ...string) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) ColumnExpr(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Count(ctx context.Context) (count int, err error)\n```\n\n```go\nfunc (b *BunSelectQuery) Exists(ctx context.Context) (exists bool, err error)\n```\n\n```go\nfunc (b *BunSelectQuery) Group(group string) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Having(having string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Join(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) JoinRelation(relation string, apply ...func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) LeftJoin(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Limit(n int) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Model(model interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Offset(n int) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Order(order string) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) OrderExpr(order string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Preload(relation string, conditions ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) PreloadRelation(relation string, apply ...func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Scan(ctx context.Context, dest interface{}) (err error)\n```\n\n```go\nfunc (b *BunSelectQuery) ScanModel(ctx context.Context) (err error)\n```\n\n```go\nfunc (b *BunSelectQuery) Table(table string) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) Where(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (b *BunSelectQuery) WhereGroup(fn func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\nWhereGroup wraps the conditions added by fn in one parenthesised group ANDed with the rest.\n\n```go\nfunc (b *BunSelectQuery) WhereOr(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\ntype BunTxAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nBunTxAdapter wraps a Bun transaction to implement the Database interface\n\n```go\nfunc (b *BunTxAdapter) BeginTx(ctx context.Context) (common.Database, error)\n```\n\n```go\nfunc (b *BunTxAdapter) CommitTx(ctx context.Context) error\n```\n\n```go\nfunc (b *BunTxAdapter) DriverName() string\n```\n\n```go\nfunc (b *BunTxAdapter) Exec(ctx context.Context, query string, args ...interface{}) (common.Result, error)\n```\n\n```go\nfunc (b *BunTxAdapter) GetUnderlyingDB() interface{}\n```\n\n```go\nfunc (b *BunTxAdapter) NewDelete() common.DeleteQuery\n```\n\n```go\nfunc (b *BunTxAdapter) NewInsert() common.InsertQuery\n```\n\n```go\nfunc (b *BunTxAdapter) NewSelect() common.SelectQuery\n```\n\n```go\nfunc (b *BunTxAdapter) NewUpdate() common.UpdateQuery\n```\n\n```go\nfunc (b *BunTxAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\n\n```go\nfunc (b *BunTxAdapter) RollbackTx(ctx context.Context) error\n```\n\n```go\nfunc (b *BunTxAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) error\n```\n\n```go\ntype BunUpdateQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nBunUpdateQuery implements UpdateQuery for Bun\n\n```go\nfunc (b *BunUpdateQuery) ExcludeColumn(columns ...string) common.UpdateQuery\n```\n\n```go\nfunc (b *BunUpdateQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (b *BunUpdateQuery) Model(model interface{}) common.UpdateQuery\n```\n\n```go\nfunc (b *BunUpdateQuery) Returning(columns ...string) common.UpdateQuery\n```\n\n```go\nfunc (b *BunUpdateQuery) Set(column string, value interface{}) common.UpdateQuery\n```\n\n```go\nfunc (b *BunUpdateQuery) SetMap(values map[string]interface{}) common.UpdateQuery\n```\n\n```go\nfunc (b *BunUpdateQuery) Table(table string) common.UpdateQuery\n```\n\n```go\nfunc (b *BunUpdateQuery) Where(query string, args ...interface{}) common.UpdateQuery\n```\n\n```go\ntype Comment struct {\n\tID      int    `db:\"id\"`\n\tContent string `db:\"content\"`\n\tPostID  int    `db:\"post_id\"`\n\tPost    *Post  `bun:\"rel:belongs-to,join:post_id=id\"`\n}\n```\nComment model - belongs to Post\n\n```go\nfunc (c Comment) TableName() string\n```\n\n```go\ntype GormAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nGormAdapter adapts GORM to work with our Database interface\n\n```go\nfunc NewGormAdapter(db *gorm.DB) *GormAdapter\n```\nNewGormAdapter creates a new GORM adapter\n\n```go\nfunc (g *GormAdapter) BeginTx(ctx context.Context) (common.Database, error)\n```\n\n```go\nfunc (g *GormAdapter) CommitTx(ctx context.Context) error\n```\n\n```go\nfunc (g *GormAdapter) DisableQueryDebug() *GormAdapter\n```\nDisableQueryDebug disables query debugging\n\n```go\nfunc (g *GormAdapter) DriverName() string\n```\n\n```go\nfunc (g *GormAdapter) EnableQueryDebug() *GormAdapter\n```\nEnableQueryDebug enables query debugging which logs all SQL queries including preloads This is useful for debugging preload queries that may be failing\n\n```go\nfunc (g *GormAdapter) Exec(ctx context.Context, query string, args ...interface{}) (res common.Result, err error)\n```\n\n```go\nfunc (g *GormAdapter) GetUnderlyingDB() interface{}\n```\n\n```go\nfunc (g *GormAdapter) NewDelete() common.DeleteQuery\n```\n\n```go\nfunc (g *GormAdapter) NewInsert() common.InsertQuery\n```\n\n```go\nfunc (g *GormAdapter) NewSelect() common.SelectQuery\n```\n\n```go\nfunc (g *GormAdapter) NewUpdate() common.UpdateQuery\n```\n\n```go\nfunc (g *GormAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) (err error)\n```\n\n```go\nfunc (g *GormAdapter) RollbackTx(ctx context.Context) error\n```\n\n```go\nfunc (g *GormAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) (err error)\n```\n\n```go\nfunc (g *GormAdapter) SQLDB() *sql.DB\n```\nSQLDB implements common.SQLDBProvider. It returns nil when GORM has no \\*sql.DB (for example a ConnPool that is not database/sql).\n\n```go\nfunc (g *GormAdapter) SetMetricsEnabled(enabled bool) *GormAdapter\n```\nSetMetricsEnabled enables or disables query metrics for this adapter.\n\n```go\nfunc (g *GormAdapter) WithDBFactory(factory func() (*gorm.DB, error)) *GormAdapter\n```\nWithDBFactory configures a factory used to reopen the database connection if it is closed.\n\n```go\ntype GormDeleteQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nGormDeleteQuery implements DeleteQuery for GORM\n\n```go\nfunc (g *GormDeleteQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (g *GormDeleteQuery) Model(model interface{}) common.DeleteQuery\n```\n\n```go\nfunc (g *GormDeleteQuery) Table(table string) common.DeleteQuery\n```\n\n```go\nfunc (g *GormDeleteQuery) Where(query string, args ...interface{}) common.DeleteQuery\n```\n\n```go\ntype GormInsertQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nGormInsertQuery implements InsertQuery for GORM\n\n```go\nfunc (g *GormInsertQuery) ExcludeColumn(columns ...string) common.InsertQuery\n```\n\n```go\nfunc (g *GormInsertQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (g *GormInsertQuery) Model(model interface{}) common.InsertQuery\n```\n\n```go\nfunc (g *GormInsertQuery) OnConflict(action string) common.InsertQuery\n```\n\n```go\nfunc (g *GormInsertQuery) Returning(columns ...string) common.InsertQuery\n```\n\n```go\nfunc (g *GormInsertQuery) Scan(ctx context.Context, dest interface{}) (err error)\n```\n\n```go\nfunc (g *GormInsertQuery) Table(table string) common.InsertQuery\n```\n\n```go\nfunc (g *GormInsertQuery) Value(column string, value interface{}) common.InsertQuery\n```\n\n```go\ntype GormResult struct {\n\t// contains filtered or unexported fields\n}\n```\nGormResult implements Result for GORM\n\n```go\nfunc (g *GormResult) LastInsertId() (int64, error)\n```\n\n```go\nfunc (g *GormResult) RowsAffected() int64\n```\n\n```go\ntype GormSelectQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nGormSelectQuery implements SelectQuery for GORM\n\n```go\nfunc (g *GormSelectQuery) Column(columns ...string) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) ColumnExpr(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Count(ctx context.Context) (count int, err error)\n```\n\n```go\nfunc (g *GormSelectQuery) Exists(ctx context.Context) (exists bool, err error)\n```\n\n```go\nfunc (g *GormSelectQuery) Group(group string) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Having(having string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Join(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) JoinRelation(relation string, apply ...func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) LeftJoin(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Limit(n int) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Model(model interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Offset(n int) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Order(order string) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) OrderExpr(order string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Preload(relation string, conditions ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) PreloadRelation(relation string, apply ...func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Scan(ctx context.Context, dest interface{}) (err error)\n```\n\n```go\nfunc (g *GormSelectQuery) ScanModel(ctx context.Context) (err error)\n```\n\n```go\nfunc (g *GormSelectQuery) Table(table string) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) Where(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (g *GormSelectQuery) WhereGroup(fn func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\nWhereGroup wraps the conditions added by fn in one parenthesised group ANDed with the rest.\n\n```go\nfunc (g *GormSelectQuery) WhereOr(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\ntype GormUpdateQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nGormUpdateQuery implements UpdateQuery for GORM\n\n```go\nfunc (g *GormUpdateQuery) ExcludeColumn(columns ...string) common.UpdateQuery\n```\n\n```go\nfunc (g *GormUpdateQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (g *GormUpdateQuery) Model(model interface{}) common.UpdateQuery\n```\n\n```go\nfunc (g *GormUpdateQuery) Returning(columns ...string) common.UpdateQuery\n```\n\n```go\nfunc (g *GormUpdateQuery) Set(column string, value interface{}) common.UpdateQuery\n```\n\n```go\nfunc (g *GormUpdateQuery) SetMap(values map[string]interface{}) common.UpdateQuery\n```\n\n```go\nfunc (g *GormUpdateQuery) Table(table string) common.UpdateQuery\n```\n\n```go\nfunc (g *GormUpdateQuery) Where(query string, args ...interface{}) common.UpdateQuery\n```\n\n```go\ntype PgSQLAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nPgSQLAdapter adapts standard database/sql to work with our Database interface This provides a lightweight PostgreSQL adapter without ORM overhead\n\n```go\nfunc NewPgSQLAdapter(db *sql.DB, driverName ...string) *PgSQLAdapter\n```\nNewPgSQLAdapter creates a new adapter wrapping a standard sql.DB. An optional driverName (e.g. \"postgres\", \"sqlite\", \"mssql\") can be provided; it defaults to \"postgres\" when omitted.\n\n```go\nfunc (p *PgSQLAdapter) BeginTx(ctx context.Context) (common.Database, error)\n```\n\n```go\nfunc (p *PgSQLAdapter) CommitTx(ctx context.Context) error\n```\n\n```go\nfunc (p *PgSQLAdapter) DriverName() string\n```\n\n```go\nfunc (p *PgSQLAdapter) EnableQueryDebug()\n```\nEnableQueryDebug enables query debugging for development\n\n```go\nfunc (p *PgSQLAdapter) Exec(ctx context.Context, query string, args ...interface{}) (res common.Result, err error)\n```\n\n```go\nfunc (p *PgSQLAdapter) GetUnderlyingDB() interface{}\n```\n\n```go\nfunc (p *PgSQLAdapter) NewDelete() common.DeleteQuery\n```\n\n```go\nfunc (p *PgSQLAdapter) NewInsert() common.InsertQuery\n```\n\n```go\nfunc (p *PgSQLAdapter) NewSelect() common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLAdapter) NewUpdate() common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) (err error)\n```\n\n```go\nfunc (p *PgSQLAdapter) RollbackTx(ctx context.Context) error\n```\n\n```go\nfunc (p *PgSQLAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) (err error)\n```\n\n```go\nfunc (p *PgSQLAdapter) SQLDB() *sql.DB\n```\nSQLDB implements common.SQLDBProvider.\n\n```go\nfunc (p *PgSQLAdapter) SetMetricsEnabled(enabled bool) *PgSQLAdapter\n```\nSetMetricsEnabled enables or disables query metrics for this adapter.\n\n```go\nfunc (p *PgSQLAdapter) WithDBFactory(factory func() (*sql.DB, error)) *PgSQLAdapter\n```\nWithDBFactory configures a factory used to reopen the database connection if it is closed.\n\n```go\ntype PgSQLDeleteQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nPgSQLDeleteQuery implements DeleteQuery for PostgreSQL\n\n```go\nfunc (p *PgSQLDeleteQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (p *PgSQLDeleteQuery) Model(model interface{}) common.DeleteQuery\n```\n\n```go\nfunc (p *PgSQLDeleteQuery) Table(table string) common.DeleteQuery\n```\n\n```go\nfunc (p *PgSQLDeleteQuery) Where(query string, args ...interface{}) common.DeleteQuery\n```\n\n```go\ntype PgSQLInsertQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nPgSQLInsertQuery implements InsertQuery for PostgreSQL\n\n```go\nfunc (p *PgSQLInsertQuery) ExcludeColumn(columns ...string) common.InsertQuery\n```\n\n```go\nfunc (p *PgSQLInsertQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (p *PgSQLInsertQuery) Model(model interface{}) common.InsertQuery\n```\n\n```go\nfunc (p *PgSQLInsertQuery) OnConflict(action string) common.InsertQuery\n```\n\n```go\nfunc (p *PgSQLInsertQuery) Returning(columns ...string) common.InsertQuery\n```\n\n```go\nfunc (p *PgSQLInsertQuery) Scan(ctx context.Context, dest interface{}) (err error)\n```\n\n```go\nfunc (p *PgSQLInsertQuery) Table(table string) common.InsertQuery\n```\n\n```go\nfunc (p *PgSQLInsertQuery) Value(column string, value interface{}) common.InsertQuery\n```\n\n```go\ntype PgSQLResult struct {\n\t// contains filtered or unexported fields\n}\n```\nPgSQLResult implements Result for PostgreSQL\n\n```go\nfunc (p *PgSQLResult) LastInsertId() (int64, error)\n```\n\n```go\nfunc (p *PgSQLResult) RowsAffected() int64\n```\n\n```go\ntype PgSQLSelectQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nPgSQLSelectQuery implements SelectQuery for PostgreSQL\n\n```go\nfunc (p *PgSQLSelectQuery) Column(columns ...string) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) ColumnExpr(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Count(ctx context.Context) (count int, err error)\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Exists(ctx context.Context) (exists bool, err error)\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Group(group string) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Having(having string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Join(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) JoinRelation(relation string, apply ...func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) LeftJoin(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Limit(n int) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Model(model interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Offset(n int) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Order(order string) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) OrderExpr(order string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Preload(relation string, conditions ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) PreloadRelation(relation string, apply ...func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Scan(ctx context.Context, dest interface{}) (err error)\n```\n\n```go\nfunc (p *PgSQLSelectQuery) ScanModel(ctx context.Context) error\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Table(table string) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) Where(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLSelectQuery) WhereGroup(fn func(common.SelectQuery) common.SelectQuery) common.SelectQuery\n```\nWhereGroup wraps the conditions added by fn (Where = AND, WhereOr = OR) in one parenthesised group ANDed with the rest of the query. Inside the group the semantics match Bun: \\`w1 AND w2 OR o1 OR o2\\`.\n\n```go\nfunc (p *PgSQLSelectQuery) WhereOr(query string, args ...interface{}) common.SelectQuery\n```\n\n```go\ntype PgSQLTxAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nPgSQLTxAdapter wraps a PostgreSQL transaction\n\n```go\nfunc (p *PgSQLTxAdapter) BeginTx(ctx context.Context) (common.Database, error)\n```\n\n```go\nfunc (p *PgSQLTxAdapter) CommitTx(ctx context.Context) error\n```\n\n```go\nfunc (p *PgSQLTxAdapter) DriverName() string\n```\n\n```go\nfunc (p *PgSQLTxAdapter) Exec(ctx context.Context, query string, args ...interface{}) (common.Result, error)\n```\n\n```go\nfunc (p *PgSQLTxAdapter) GetUnderlyingDB() interface{}\n```\n\n```go\nfunc (p *PgSQLTxAdapter) NewDelete() common.DeleteQuery\n```\n\n```go\nfunc (p *PgSQLTxAdapter) NewInsert() common.InsertQuery\n```\n\n```go\nfunc (p *PgSQLTxAdapter) NewSelect() common.SelectQuery\n```\n\n```go\nfunc (p *PgSQLTxAdapter) NewUpdate() common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLTxAdapter) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\n\n```go\nfunc (p *PgSQLTxAdapter) RollbackTx(ctx context.Context) error\n```\n\n```go\nfunc (p *PgSQLTxAdapter) RunInTransaction(ctx context.Context, fn func(common.Database) error) error\n```\n\n```go\ntype PgSQLUpdateQuery struct {\n\t// contains filtered or unexported fields\n}\n```\nPgSQLUpdateQuery implements UpdateQuery for PostgreSQL\n\n```go\nfunc (p *PgSQLUpdateQuery) ExcludeColumn(columns ...string) common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLUpdateQuery) Exec(ctx context.Context) (res common.Result, err error)\n```\n\n```go\nfunc (p *PgSQLUpdateQuery) Model(model interface{}) common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLUpdateQuery) Returning(columns ...string) common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLUpdateQuery) Set(column string, value interface{}) common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLUpdateQuery) SetMap(values map[string]interface{}) common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLUpdateQuery) Table(table string) common.UpdateQuery\n```\n\n```go\nfunc (p *PgSQLUpdateQuery) Where(query string, args ...interface{}) common.UpdateQuery\n```\n\n```go\ntype Post struct {\n\tID       int        `db:\"id\"`\n\tTitle    string     `db:\"title\"`\n\tContent  string     `db:\"content\"`\n\tAuthorID int        `db:\"author_id\"`\n\tAuthor   *Author    `bun:\"rel:belongs-to,join:author_id=id\"`\n\tComments []*Comment `bun:\"rel:has-many,join:id=post_id\"`\n}\n```\nPost model - belongs to Author, has many Comments\n\n```go\nfunc (p Post) TableName() string\n```\n\n```go\ntype QueryDebugHook struct{}\n```\nQueryDebugHook is a Bun query hook that logs all SQL queries including preloads\n\n```go\nfunc (h *QueryDebugHook) AfterQuery(ctx context.Context, event *bun.QueryEvent)\n```\n\n```go\nfunc (h *QueryDebugHook) BeforeQuery(ctx context.Context, event *bun.QueryEvent) context.Context\n```\n\n```go\ntype TestHelper struct {\n\tDB      *sql.DB\n\tAdapter *PgSQLAdapter\n\t// contains filtered or unexported fields\n}\n```\nTestHelper provides utilities for database testing\n\n```go\nfunc NewTestHelper(t *testing.T, db *sql.DB) *TestHelper\n```\nNewTestHelper creates a new test helper\n\n```go\nfunc (h *TestHelper) AssertUserCount(expected int)\n```\nAssertUserCount asserts the number of users\n\n```go\nfunc (h *TestHelper) AssertUserExists(email string)\n```\nAssertUserExists checks if a user exists by email\n\n```go\nfunc (h *TestHelper) BeginTestTransaction() (*PgSQLTxAdapter, func())\n```\nBeginTestTransaction starts a transaction for testing\n\n```go\nfunc (h *TestHelper) CleanupTables()\n```\nCleanupTables truncates all test tables\n\n```go\nfunc (h *TestHelper) GetUserByEmail(email string) map[string]interface{}\n```\nGetUserByEmail retrieves a user by email\n\n```go\nfunc (h *TestHelper) InsertComment(postID int, content string) int\n```\nInsertComment inserts a test comment and returns the ID\n\n```go\nfunc (h *TestHelper) InsertPost(userID int, title, content string, published bool) int\n```\nInsertPost inserts a test post and returns the ID\n\n```go\nfunc (h *TestHelper) InsertUser(name, email string, age int) int\n```\nInsertUser inserts a test user and returns the ID\n\n```go\ntype User struct {\n\tID    int    `json:\"id\"`\n\tName  string `json:\"name\"`\n\tEmail string `json:\"email\"`\n\tAge   int    `json:\"age\"`\n}\n```\nUser is an example model\n\n```go\nfunc (u User) TableName() string\n```\nTableName implements common.TableNameProvider\n\n","path":"github.com/bitechdev/ResolveSpec/pkg/common/adapters/database","name":"database","synopsis":"","isRedistributable":true}
