database

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 5 Imported by: 12

README

Golang database package

GoDoc

This is a wrapper on github.com/go-xorm/xorm with some additions like functional options and logging.

Documentation

Overview

Package database - general database access This is a wrapper on github.com/go-xorm/xorm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(on bool) func(db *DB) error

Debug sets sql tracing to on when "on" argument is true

Types

type DB

type DB struct {
	*xorm.Engine
	InDebug bool
}

DB stores database handle

func New

func New(driver, connect string, options ...func(db *DB) error) (*DB, error)

New creates db engine object Configuration should be set via functional options

type Flags

type Flags struct {
	Driver  string `long:"db_driver"  default:"sqlite3"   description:"Database driver"`
	Connect string `long:"db_connect" default:"./test.db" description:"Database connect string"`
	Debug   bool   `long:"db_debug"   description:"Print database debug info"`
}

Flags is a package flags sample in form ready for use with github.com/jessevdk/go-flags

Jump to

Keyboard shortcuts

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