community: github.com/documize/community/core/database Index | Files

package database

import "github.com/documize/community/core/database"

Index

Package Files

check.go installer.go lock.go params.go scripts.go setup_endpoint.go

func Check Uses

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 Uses

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 Uses

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

InstallUpgrade creates new database or upgrades existing database.

func RebindParams Uses

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 Uses

func RebindPostgreSQL(sql string) string

RebindPostgreSQL is a helper method on top of RebindParams.

type Handler Uses

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

Handler contains the runtime information such as logging and database.

func (*Handler) Setup Uses

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

Setup the tables in a blank database

type Script Uses

type Script struct {
    Version int
    Script  []byte
}

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

func SpecificScripts Uses

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

SpecificScripts returns SQL scripts for current databasse provider.

type Scripts Uses

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

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

func LoadScripts Uses

func LoadScripts() (s Scripts, err error)

LoadScripts returns .SQL scripts for supported database providers.

Package database imports 20 packages (graph) and is imported by 2 packages. Updated 2019-09-24. Refresh now. Tools for package owners.