db

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package db manages the DB part of the kjudge package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sqlx.DB

	PersistentConn *sqlite3.SQLiteConn
}

DB is an implementation of the underlying DB.

func New

func New(filename string) (*DB, error)

New creates a new DB object from the given filename.

type DBContext

type DBContext interface {
	// Get binds a single row into a struct.
	Get(result interface{}, query string, args ...interface{}) error
	// Select binds rows into an array of structs.
	Select(results interface{}, query string, args ...interface{}) error
	// Exec executes a query.
	Exec(query string, args ...interface{}) (sql.Result, error)
}

DBContext defines a slim common interface between Db and Tx.

Jump to

Keyboard shortcuts

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