easql

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: MIT Imports: 4 Imported by: 0

README

easql

A sqlx + squirrel wrapper

Feature

  • Provide convenient query/exec APIs.
  • Provide same query/exec APIs to DB and Tx.

Installation

$ go get github.com/adlandh/easql

Usage

Get(interface{}, squirrel.SelectBuilder) error
Select(interface{}, squirrel.SelectBuilder) error
Insert(squirrel.InsertBuilder) (sql.Result, error)
Update(squirrel.UpdateBuilder) (sql.Result, error)
Delete(squirrel.DeleteBuilder) (sql.Result, error)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Queryer
	// contains filtered or unexported fields
}

func NewDB

func NewDB(raw *sqlx.DB) *DB

func (*DB) Begin

func (db *DB) Begin() (*Tx, error)

type Queryer

type Queryer interface {
	Get(interface{}, squirrel.SelectBuilder) error
	Select(interface{}, squirrel.SelectBuilder) error
	Insert(squirrel.InsertBuilder) (sql.Result, error)
	Update(squirrel.UpdateBuilder) (sql.Result, error)
	Delete(squirrel.DeleteBuilder) (sql.Result, error)
}

type RawQueryer

type RawQueryer interface {
	Get(interface{}, string, ...interface{}) error
	Select(interface{}, string, ...interface{}) error
	Exec(string, ...interface{}) (sql.Result, error)
}

type Tx

type Tx struct {
	Queryer
	// contains filtered or unexported fields
}

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL