db

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package db integrates with generic databases, so far it doesn't do much, but it's supposed to do more.

Package db integrates with generic databases, so far it doesn't do much, but it's supposed to do more.

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

DB is the main database handle used throughout the API

Functions

func Connect

func Connect() error

Connect sets up the database connection, using the configured ConnectionString, and ensures it is working.

func Insert added in v0.0.2

func Insert(table string, d interface{}) error

Insert adds the object to the table specified. It only provides the non-nil-pointer objects as fields, so it is up to the caller and the database schema to enforce default values.

func Update added in v0.0.2

func Update(table string, haystack string, needle interface{}, d interface{}) error

Update attempts to update the object in the database, using the provided string and matching the haystack with the needle. It skips fields that are nil-pointers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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