Documentation
¶
Index ¶
- Variables
- func ConvertError(err error) error
- func GetDsn(user, pass, addr, dbName string) string
- func GetFieldSlice(v any, skip ...string) []string
- func GetFields(v any, skip ...string) string
- func GetFields2WithSkip(v any, skip ...string) (string, string)
- func IsCriticalErr(err error) bool
- func IsDuplicate(err error) bool
- func IsMildErr(err error) bool
- func IsNoRecord(err error) bool
- func SQLStateEqual(src [5]byte, target SQLState) bool
- func SelectFields(v any, targets ...string) string
- func SelectFields2(v any, targets ...string) (string, string)
- type DB
- func (d *DB) Close() error
- func (d *DB) Conn() sqlx.SqlConn
- func (d *DB) Exec(query string, args ...any) (sql.Result, error)
- func (d *DB) ExecCtx(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *DB) Prepare(query string) (sqlx.StmtSession, error)
- func (d *DB) PrepareCtx(ctx context.Context, query string) (sqlx.StmtSession, error)
- func (d *DB) QueryRow(v any, query string, args ...any) error
- func (d *DB) QueryRowCtx(ctx context.Context, v any, query string, args ...any) error
- func (d *DB) QueryRowPartial(v any, query string, args ...any) error
- func (d *DB) QueryRowPartialCtx(ctx context.Context, v any, query string, args ...any) error
- func (d *DB) QueryRows(v any, query string, args ...any) error
- func (d *DB) QueryRowsCtx(ctx context.Context, v any, query string, args ...any) error
- func (d *DB) QueryRowsPartial(v any, query string, args ...any) error
- func (d *DB) QueryRowsPartialCtx(ctx context.Context, v any, query string, args ...any) error
- func (d *DB) Transact(ctx context.Context, fn func(ctx context.Context) error) error
- type SQLState
- type TransactFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRecord = xerror.ErrNotFound.Msg("no record found") ErrDuplicate = xerror.ErrDuplicate.Msg("duplicate entry") ErrOutOfRange = xerror.ErrDataTooLong.Msg("out of range") )
Functions ¶
func GetFieldSlice ¶
func GetFields2WithSkip ¶
同时返回参数化参数?
func IsCriticalErr ¶
func IsDuplicate ¶
func IsNoRecord ¶
func SQLStateEqual ¶
func SelectFields ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
对db的封装
func NewFromEnv ¶
func NewFromEnv() *DB
func (*DB) PrepareCtx ¶
func (*DB) QueryRowCtx ¶
func (*DB) QueryRowPartialCtx ¶
func (*DB) QueryRowsCtx ¶
func (*DB) QueryRowsPartialCtx ¶
Click to show internal directories.
Click to hide internal directories.