database

package
v3.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: AGPL-3.0 Imports: 20 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(runtime *env.Runtime) bool

Check that the database is configured correctly and that all the required tables exist. It must be the first function called in this package.

func CurrentVersion added in v1.71.0

func CurrentVersion(runtime *env.Runtime) (version int, err error)

CurrentVersion returns number that represents the current database version number. For example 23 represents the 23rd iteration of the database.

func InstallUpgrade added in v1.71.0

func InstallUpgrade(runtime *env.Runtime, existingDB bool) (err error)

InstallUpgrade creates new database or upgrades existing database.

func RebindParams added in v1.71.0

func RebindParams(sql string, s env.StoreType) string

RebindParams changes MySQL query parameter placeholder from "?" to correct value for given database provider.

MySQL uses ?, ?, ? (default for all Documize queries) PostgreSQL uses $1, $2, $3 MS SQL Server uses @p1, @p2, @p3

func RebindPostgreSQL added in v1.71.0

func RebindPostgreSQL(sql string) string

RebindPostgreSQL is a helper method on top of RebindParams.

Types

type Handler added in v1.51.0

type Handler struct {
	Runtime *env.Runtime
	Store   *store.Store
}

Handler contains the runtime information such as logging and database.

func (*Handler) Setup added in v1.53.2

func (h *Handler) Setup(w http.ResponseWriter, r *http.Request)

Setup the tables in a blank database

type Script added in v1.71.0

type Script struct {
	Version int
	Script  []byte
}

Script holds SQL script and it's associated version number.

func SpecificScripts added in v1.71.0

func SpecificScripts(runtime *env.Runtime, all Scripts) (s []Script)

SpecificScripts returns SQL scripts for current databasse provider.

type Scripts added in v1.71.0

type Scripts struct {
	MySQL      []Script
	PostgreSQL []Script
	SQLServer  []Script
}

Scripts holds all .SQL files for all supported database providers.

func LoadScripts added in v1.71.0

func LoadScripts() (s Scripts, err error)

LoadScripts returns .SQL scripts for supported database providers.

Jump to

Keyboard shortcuts

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