Documentation ¶
Overview ¶
Package sqlproxy is a package that provides a sql proxy for the app.
Index ¶
- Constants
- type DBInstance
- func (d *DBInstance) Begin() (TxInstanceInterface, error)
- func (d *DBInstance) Close() error
- func (d *DBInstance) Exec(query string, args ...interface{}) (ResultInstanceInterface, error)
- func (d *DBInstance) Prepare(query string) (StmtInstanceInterface, error)
- func (d *DBInstance) Query(query string, args ...interface{}) (RowsInstanceInterface, error)
- type DBInstanceInterface
- type NullStringInstance
- type NullStringInstanceInterface
- type ResultInstance
- type ResultInstanceInterface
- type RowInstance
- type RowInstanceInterface
- type RowsInstance
- type RowsInstanceInterface
- type Sql
- type SqlProxy
- type StmtInstance
- type StmtInstanceInterface
- type TxInstance
- type TxInstanceInterface
Constants ¶
const (
// Sqlite is a constant for sqlite driver.
Sqlite = "sqlite"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBInstance ¶
DBInstance is a struct that implements DBInstanceInterface.
func (*DBInstance) Begin ¶
func (d *DBInstance) Begin() (TxInstanceInterface, error)
Begin is a proxy for sql.DB.Begin.
func (*DBInstance) Exec ¶
func (d *DBInstance) Exec(query string, args ...interface{}) (ResultInstanceInterface, error)
Exec is a proxy for sql.DB.Exec.
func (*DBInstance) Prepare ¶
func (d *DBInstance) Prepare(query string) (StmtInstanceInterface, error)
Prepare is a proxy for sql.DB.Prepare.
func (*DBInstance) Query ¶
func (d *DBInstance) Query(query string, args ...interface{}) (RowsInstanceInterface, error)
Query is a proxy for sql.DB.Query.
type DBInstanceInterface ¶
type DBInstanceInterface interface { Begin() (TxInstanceInterface, error) Close() error Exec(query string, args ...interface{}) (ResultInstanceInterface, error) Prepare(query string) (StmtInstanceInterface, error) Query(query string, args ...interface{}) (RowsInstanceInterface, error) }
DBInstanceInterface is an interface for sql.DB.
type NullStringInstance ¶
type NullStringInstance struct {
FieldNullString *sql.NullString
}
NullStringInstance is a struct that implements NullStringInstanceInterface.
func (*NullStringInstance) Scan ¶
func (n *NullStringInstance) Scan(value interface{}) error
Scan implements the sql.Scanner interface.
type NullStringInstanceInterface ¶
type NullStringInstanceInterface interface { Scan(value interface{}) error Value() (driver.Value, error) }
NullStringInstanceInterface is an interface for sql.NullString.
type ResultInstance ¶
ResultInstance is a struct that implements ResultInstanceInterface.
func (ResultInstance) LastInsertId ¶ added in v1.1.0
func (r ResultInstance) LastInsertId() (int64, error)
LastInsertId is a proxy for sql.Result.LastInsertId.
func (ResultInstance) RowsAffected ¶
func (r ResultInstance) RowsAffected() (int64, error)
RowsAffected is a proxy for sql.Result.RowsAffected.
type ResultInstanceInterface ¶
type ResultInstanceInterface interface { LastInsertId() (int64, error) RowsAffected() (int64, error) }
ResultInstanceInterface is an interface for sql.Result.
type RowInstance ¶
RowInstance is a struct that implements RowInstanceInterface.
func (*RowInstance) Scan ¶
func (r *RowInstance) Scan(dest ...interface{}) error
Scan is a proxy for sql.Row.Scan.
type RowInstanceInterface ¶
type RowInstanceInterface interface {
Scan(dest ...interface{}) error
}
RowInstanceInterface is an interface for sql.Row.
type RowsInstance ¶
RowsInstance is a struct that implements RowsInstanceInterface.
func (*RowsInstance) Close ¶
func (r *RowsInstance) Close() error
Close is a proxy for sql.Rows.Close.
func (*RowsInstance) Scan ¶
func (r *RowsInstance) Scan(dest ...any) error
Scan is a proxy for sql.Rows.Scan.
type RowsInstanceInterface ¶
RowsInstanceInterface is an interface for sql.Rows.
type Sql ¶
type Sql interface { IfNullToNullString(nullStringInstance *NullStringInstance) *NullStringInstance Open(driverName string, dataSourceName string) (DBInstanceInterface, error) StringToNullString(s string) *NullStringInstance }
Sql is an interface for sql.
type SqlProxy ¶
type SqlProxy struct{}
SqlProxy is a struct that implements Sql.
func (*SqlProxy) IfNullToNullString ¶
func (*SqlProxy) IfNullToNullString(nullStringInstance *NullStringInstance) *NullStringInstance
IfNullToNullString returns a NullStringInstance if the argument is nil.
func (*SqlProxy) Open ¶
func (*SqlProxy) Open(driverName string, dataSourceName string) (DBInstanceInterface, error)
Open is a proxy for sql.Open.
func (*SqlProxy) StringToNullString ¶
func (*SqlProxy) StringToNullString(s string) *NullStringInstance
StringToNullString returns a NullStringInstance with the argument as the String field.
type StmtInstance ¶
StmtInstance is a struct that implements StmtInstanceInterface.
func (*StmtInstance) Close ¶
func (s *StmtInstance) Close() error
Close is a proxy for sql.Stmt.Close.
func (*StmtInstance) Exec ¶
func (s *StmtInstance) Exec(args ...interface{}) (ResultInstanceInterface, error)
func (*StmtInstance) Query ¶
func (s *StmtInstance) Query(args ...interface{}) (RowsInstanceInterface, error)
type StmtInstanceInterface ¶
type StmtInstanceInterface interface { Close() error Exec(args ...interface{}) (ResultInstanceInterface, error) Query(args ...interface{}) (RowsInstanceInterface, error) }
StmtInstanceInterface is an interface for sql.Stmt.
type TxInstance ¶
TxInstance is a struct that implements TxInstanceInterface.
func (*TxInstance) Commit ¶
func (t *TxInstance) Commit() error
Commit is a proxy for sql.Tx.Commit.
func (*TxInstance) Exec ¶
func (t *TxInstance) Exec(query string, args ...interface{}) (ResultInstanceInterface, error)
Exec is a proxy for sql.Tx.Exec.
func (*TxInstance) QueryRow ¶
func (t *TxInstance) QueryRow(query string, args ...interface{}) RowInstanceInterface
QueryRow is a proxy for sql.Tx.QueryRow.
func (*TxInstance) Rollback ¶
func (t *TxInstance) Rollback() error
Rollback is a proxy for sql.Tx.Rollback.
type TxInstanceInterface ¶
type TxInstanceInterface interface { Commit() error Exec(query string, args ...interface{}) (ResultInstanceInterface, error) QueryRow(query string, args ...interface{}) RowInstanceInterface Rollback() error }
TxInstanceInterface is an interface for sql.Tx.