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.