Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CleanupFunc ¶
type CleanupFunc func()
CleanupFunc deletes the schema and all database objects.
func NewPostgresSchema ¶
func NewPostgresSchema(t *testing.T, sqlFiles []string, opts ...Option) (*pgx.Conn, CleanupFunc)
NewPostgresSchema opens a connection with search_path set to a randomly named, new schema and loads all sqlFiles.
func NewPostgresSchemaString ¶
func NewPostgresSchemaString(t *testing.T, sql string, opts ...Option) (*pgx.Conn, CleanupFunc)
NewPostgresSchemaString opens a connection with search_path set to a randomly named, new schema and loads the sql string.
type GuardedStmtCache ¶
GuardedStmtCache errors if any name in names is used to get a cached statement. Allows verifying that PrepareAllQueries works by creating prepared statements ahead of time. pgx accesses a map of prepared statements directly rather than calling Get.
func NewGuardedStmtCache ¶
func NewGuardedStmtCache(conn *pgconn.PgConn, names ...string) *GuardedStmtCache
func (*GuardedStmtCache) Get ¶
func (sc *GuardedStmtCache) Get(ctx context.Context, sql string) (*pgconn.StatementDescription, error)
type Option ¶
type Option func(config *pgx.ConnConfig)
func WithGuardedStmtCache ¶
WithGuardedStmtCache is a functional option to initialize a the pgtest conn with a guarded cache that fails if pgx attempts to cache any SQL query in names. The names are typically SQL statements.