Documentation ¶
Index ¶
- type PostgresDB
- func (p *PostgresDB) Close() error
- func (p *PostgresDB) CreateTable(table Table) error
- func (p *PostgresDB) DeleteRows(tableName, condition string, args ...interface{}) (sql.Result, error)
- func (p *PostgresDB) DropTable(tableName string) error
- func (p *PostgresDB) InsertRow(tableName string, values ...interface{}) error
- func (p *PostgresDB) SelectRows(tableName, condition string, args ...interface{}) (*sql.Rows, error)
- type Table
- type TableColumn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresDB ¶
type PostgresDB struct {
// contains filtered or unexported fields
}
PostgresDB represents a PostgreSQL database connection.
func NewPostgresDB ¶
func NewPostgresDB(connectionString string) (*PostgresDB, error)
NewPostgresDB creates a new instance of PostgresDB with the provided connection string.
func (*PostgresDB) CreateTable ¶
func (p *PostgresDB) CreateTable(table Table) error
CreateTable creates a table in the database based on the provided Table.
func (*PostgresDB) DeleteRows ¶
func (p *PostgresDB) DeleteRows(tableName, condition string, args ...interface{}) (sql.Result, error)
DeleteRows deletes rows from the table based on the provided condition.
func (*PostgresDB) DropTable ¶
func (p *PostgresDB) DropTable(tableName string) error
DropTable drops a table from the database.
func (*PostgresDB) InsertRow ¶
func (p *PostgresDB) InsertRow(tableName string, values ...interface{}) error
InsertRow inserts a new row into the table.
func (*PostgresDB) SelectRows ¶
func (p *PostgresDB) SelectRows(tableName, condition string, args ...interface{}) (*sql.Rows, error)
SelectRows selects rows from the table based on the provided condition.
type Table ¶
type Table struct { Name string Columns []TableColumn }
Table represents a database table.
type TableColumn ¶
TableColumn represents a column in a database table.
Click to show internal directories.
Click to hide internal directories.