// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.13.0 package mysqlcore import ( "context" "database/sql" "fmt" ) type DBTX interface { ExecContext(context.Context, string, ...interface{}) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row } func New(db DBTX) *Queries { return &Queries{db: db} } func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error if q.deleteAllScopeMembersStmt, err = db.PrepareContext(ctx, deleteAllScopeMembers); err != nil { return nil, fmt.Errorf("error preparing query DeleteAllScopeMembers: %w", err) } if q.deleteScopeStmt, err = db.PrepareContext(ctx, deleteScope); err != nil { return nil, fmt.Errorf("error preparing query DeleteScope: %w", err) } if q.deleteScopeMemberStmt, err = db.PrepareContext(ctx, deleteScopeMember); err != nil { return nil, fmt.Errorf("error preparing query DeleteScopeMember: %w", err) } if q.getScopeStmt, err = db.PrepareContext(ctx, getScope); err != nil { return nil, fmt.Errorf("error preparing query GetScope: %w", err) } if q.getScopeDisplayNameStmt, err = db.PrepareContext(ctx, getScopeDisplayName); err != nil { return nil, fmt.Errorf("error preparing query GetScopeDisplayName: %w", err) } if q.getScopeWithDisplayNameStmt, err = db.PrepareContext(ctx, getScopeWithDisplayName); err != nil { return nil, fmt.Errorf("error preparing query GetScopeWithDisplayName: %w", err) } if q.insertScopeStmt, err = db.PrepareContext(ctx, insertScope); err != nil { return nil, fmt.Errorf("error preparing query InsertScope: %w", err) } if q.listProjectEntriesStmt, err = db.PrepareContext(ctx, listProjectEntries); err != nil { return nil, fmt.Errorf("error preparing query ListProjectEntries: %w", err) } if q.listScopeMembersStmt, err = db.PrepareContext(ctx, listScopeMembers); err != nil { return nil, fmt.Errorf("error preparing query ListScopeMembers: %w", err) } if q.listScopesStmt, err = db.PrepareContext(ctx, listScopes); err != nil { return nil, fmt.Errorf("error preparing query ListScopes: %w", err) } if q.listScopesByUserStmt, err = db.PrepareContext(ctx, listScopesByUser); err != nil { return nil, fmt.Errorf("error preparing query ListScopesByUser: %w", err) } if q.listStatsStmt, err = db.PrepareContext(ctx, listStats); err != nil { return nil, fmt.Errorf("error preparing query ListStats: %w", err) } if q.updateScopeStmt, err = db.PrepareContext(ctx, updateScope); err != nil { return nil, fmt.Errorf("error preparing query UpdateScope: %w", err) } if q.updateScopeMemberStmt, err = db.PrepareContext(ctx, updateScopeMember); err != nil { return nil, fmt.Errorf("error preparing query UpdateScopeMember: %w", err) } return &q, nil } func (q *Queries) Close() error { var err error if q.deleteAllScopeMembersStmt != nil { if cerr := q.deleteAllScopeMembersStmt.Close(); cerr != nil { err = fmt.Errorf("error closing deleteAllScopeMembersStmt: %w", cerr) } } if q.deleteScopeStmt != nil { if cerr := q.deleteScopeStmt.Close(); cerr != nil { err = fmt.Errorf("error closing deleteScopeStmt: %w", cerr) } } if q.deleteScopeMemberStmt != nil { if cerr := q.deleteScopeMemberStmt.Close(); cerr != nil { err = fmt.Errorf("error closing deleteScopeMemberStmt: %w", cerr) } } if q.getScopeStmt != nil { if cerr := q.getScopeStmt.Close(); cerr != nil { err = fmt.Errorf("error closing getScopeStmt: %w", cerr) } } if q.getScopeDisplayNameStmt != nil { if cerr := q.getScopeDisplayNameStmt.Close(); cerr != nil { err = fmt.Errorf("error closing getScopeDisplayNameStmt: %w", cerr) } } if q.getScopeWithDisplayNameStmt != nil { if cerr := q.getScopeWithDisplayNameStmt.Close(); cerr != nil { err = fmt.Errorf("error closing getScopeWithDisplayNameStmt: %w", cerr) } } if q.insertScopeStmt != nil { if cerr := q.insertScopeStmt.Close(); cerr != nil { err = fmt.Errorf("error closing insertScopeStmt: %w", cerr) } } if q.listProjectEntriesStmt != nil { if cerr := q.listProjectEntriesStmt.Close(); cerr != nil { err = fmt.Errorf("error closing listProjectEntriesStmt: %w", cerr) } } if q.listScopeMembersStmt != nil { if cerr := q.listScopeMembersStmt.Close(); cerr != nil { err = fmt.Errorf("error closing listScopeMembersStmt: %w", cerr) } } if q.listScopesStmt != nil { if cerr := q.listScopesStmt.Close(); cerr != nil { err = fmt.Errorf("error closing listScopesStmt: %w", cerr) } } if q.listScopesByUserStmt != nil { if cerr := q.listScopesByUserStmt.Close(); cerr != nil { err = fmt.Errorf("error closing listScopesByUserStmt: %w", cerr) } } if q.listStatsStmt != nil { if cerr := q.listStatsStmt.Close(); cerr != nil { err = fmt.Errorf("error closing listStatsStmt: %w", cerr) } } if q.updateScopeStmt != nil { if cerr := q.updateScopeStmt.Close(); cerr != nil { err = fmt.Errorf("error closing updateScopeStmt: %w", cerr) } } if q.updateScopeMemberStmt != nil { if cerr := q.updateScopeMemberStmt.Close(); cerr != nil { err = fmt.Errorf("error closing updateScopeMemberStmt: %w", cerr) } } return err } func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) case stmt != nil: return stmt.ExecContext(ctx, args...) default: return q.db.ExecContext(ctx, query, args...) } } func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) case stmt != nil: return stmt.QueryContext(ctx, args...) default: return q.db.QueryContext(ctx, query, args...) } } func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) case stmt != nil: return stmt.QueryRowContext(ctx, args...) default: return q.db.QueryRowContext(ctx, query, args...) } } type Queries struct { db DBTX tx *sql.Tx deleteAllScopeMembersStmt *sql.Stmt deleteScopeStmt *sql.Stmt deleteScopeMemberStmt *sql.Stmt getScopeStmt *sql.Stmt getScopeDisplayNameStmt *sql.Stmt getScopeWithDisplayNameStmt *sql.Stmt insertScopeStmt *sql.Stmt listProjectEntriesStmt *sql.Stmt listScopeMembersStmt *sql.Stmt listScopesStmt *sql.Stmt listScopesByUserStmt *sql.Stmt listStatsStmt *sql.Stmt updateScopeStmt *sql.Stmt updateScopeMemberStmt *sql.Stmt } func (q *Queries) WithTx(tx *sql.Tx) *Queries { return &Queries{ db: tx, tx: tx, deleteAllScopeMembersStmt: q.deleteAllScopeMembersStmt, deleteScopeStmt: q.deleteScopeStmt, deleteScopeMemberStmt: q.deleteScopeMemberStmt, getScopeStmt: q.getScopeStmt, getScopeDisplayNameStmt: q.getScopeDisplayNameStmt, getScopeWithDisplayNameStmt: q.getScopeWithDisplayNameStmt, insertScopeStmt: q.insertScopeStmt, listProjectEntriesStmt: q.listProjectEntriesStmt, listScopeMembersStmt: q.listScopeMembersStmt, listScopesStmt: q.listScopesStmt, listScopesByUserStmt: q.listScopesByUserStmt, listStatsStmt: q.listStatsStmt, updateScopeStmt: q.updateScopeStmt, updateScopeMemberStmt: q.updateScopeMemberStmt, } }