Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLCredo ¶
type SQLCredo[T any, I comparable] interface { model.SQLExecutor model.CRUD[T, I] model.PageResolver[T] // InitSchema executes a SQL query to initialize the database schema. // Typically used for creating tables and other database objects. InitSchema(ctx context.Context, sql string) (sql.Result, error) // WithDebugFunc sets a debug function for SQL query logging. // The debug function will be called before executing any SQL query. // Returns the modified SQLCredo instance for method chaining. WithDebugFunc(newDebugFunc model.DebugFunc) SQLCredo[T, I] // GetDebugFunc returns the currently set debug function. // Returns nil if no debug function is set. GetDebugFunc() model.DebugFunc }
SQLCredo is a comprehensive interface that combines SQL execution, CRUD operations, and pagination capabilities for a specific entity type.
Type Parameters:
- T: The entity type being managed (can be any type)
- I: The type of the entity's ID field (must be comparable)
func NewSQLCredo ¶
func NewSQLCredo[T any, I comparable](db *sql.DB, driver string, tableName string, idColumn string) SQLCredo[T, I]
NewSQLCredo creates a new instance of SQLCredo for the specified entity type and ID type.
Parameters:
- db: A pointer to the underlying database connection
- driver: The database driver name (e.g., "postgres", "mysql")
- tableName: The name of the database table for the entity
- idColumn: The name of the ID column in the table
Returns a fully initialized SQLCredo instance
Click to show internal directories.
Click to hide internal directories.