sql

package module
v0.0.0-...-fc4206c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package sql provides utilities for working with package database/sql.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

DB is a minimal interface that is implemented by both *sql.DB and *sql.Tx.

type Dialect

type Dialect interface {
	BuildSelect(columns ...string) string
	BuildInsert(columns ...string) string
	BuildUpdate(columns ...string) string
	BuildPlaceholders(start, end int) string
}
var MySQL Dialect = mySQL{}

MySQL is the MySQL dialect.

var PostgreSQL Dialect = postgreSQL{}

PostgreSQL is the PostgreSQL dialect.

type Row

type Row interface {
	Scan(dest ...interface{}) error
}

Row is a minimal interface around *sql.Row.

type Rows

type Rows interface {
	Row
	Next() bool
	Close() error
}

Rows is a minimal interface around *sql.Rows.

type TxDB

type TxDB interface {
	DB
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

TxDB extends DB with transactions..

Directories

Path Synopsis
sqlgen module

Jump to

Keyboard shortcuts

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