storage

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2019 License: AGPL-3.0 Imports: 27 Imported by: 3

Documentation

Overview

Package storage sets up database persistence providers.

Package storage sets up database persistence providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetMySQLProvider

func SetMySQLProvider(r *env.Runtime, s *store.Store)

SetMySQLProvider creates MySQL provider

func SetPostgreSQLProvider

func SetPostgreSQLProvider(r *env.Runtime, s *store.Store)

SetPostgreSQLProvider creates PostgreSQL provider

Types

type MySQLProvider

type MySQLProvider struct {
	// User specified connection string.
	ConnectionString string

	// User specified db type (mysql, percona or mariadb).
	Variant env.StoreType
}

MySQLProvider supports MySQL 5.7.x and 8.0.x versions.

func (MySQLProvider) ConvertTimestamp added in v1.73.1

func (p MySQLProvider) ConvertTimestamp() (statement string)

ConvertTimestamp returns SQL function to correctly convert ISO 8601 format (e.g. '2016-09-08T06:37:23Z') to SQL specific timestamp value (e.g. 2016-09-08 06:37:23). Must use ? for parameter placeholder character as DB layer will convert to database specific parameter placeholder character.

func (MySQLProvider) DatabaseName

func (p MySQLProvider) DatabaseName() string

DatabaseName holds the SQL database name where Documize tables live.

func (MySQLProvider) DriverName

func (p MySQLProvider) DriverName() string

DriverName returns database/sql driver name.

func (MySQLProvider) Example

func (p MySQLProvider) Example() string

Example holds storage provider specific connection string format. used in error messages

func (MySQLProvider) JSONEmpty

func (p MySQLProvider) JSONEmpty() string

JSONEmpty returns empty SQL JSON object. Typically used as 2nd parameter to COALESCE().

func (MySQLProvider) JSONGetValue

func (p MySQLProvider) JSONGetValue(column, attribute string) string

JSONGetValue returns JSON attribute selection syntax. Typically used in SELECT <my_json_field> query.

func (MySQLProvider) MakeConnectionString

func (p MySQLProvider) MakeConnectionString() string

MakeConnectionString returns provider specific DB connection string complete with default parameters.

func (MySQLProvider) Params

func (p MySQLProvider) Params() map[string]string

Params returns connection string parameters that must be present before connecting to DB.

func (MySQLProvider) QueryDateInterval

func (p MySQLProvider) QueryDateInterval(days int64) string

QueryDateInterval returns provider specific interval style date SQL.

func (MySQLProvider) QueryGetDatabaseVersion

func (p MySQLProvider) QueryGetDatabaseVersion() string

QueryGetDatabaseVersion returns the schema version number.

func (MySQLProvider) QueryGetDatabaseVersionLegacy

func (p MySQLProvider) QueryGetDatabaseVersionLegacy() string

QueryGetDatabaseVersionLegacy returns the schema version number before The Great Schema Migration (v25, MySQL).

func (MySQLProvider) QueryMeta

func (p MySQLProvider) QueryMeta() string

QueryMeta is how to extract version number, collatio“n, character set from database provider.

func (MySQLProvider) QueryRecordVersionUpgrade

func (p MySQLProvider) QueryRecordVersionUpgrade(version int) string

QueryRecordVersionUpgrade returns database specific insert statement that records the database version number.

func (MySQLProvider) QueryRecordVersionUpgradeLegacy

func (p MySQLProvider) QueryRecordVersionUpgradeLegacy(version int) string

QueryRecordVersionUpgradeLegacy returns database specific insert statement that records the database version number.

func (MySQLProvider) QueryTableList

func (p MySQLProvider) QueryTableList() string

QueryTableList returns a list tables in Documize database.

func (MySQLProvider) Type

func (p MySQLProvider) Type() env.StoreType

Type returns name of provider

func (MySQLProvider) TypeVariant

func (p MySQLProvider) TypeVariant() env.StoreType

TypeVariant returns databse flavor

func (MySQLProvider) VerfiyCharacterCollation

func (p MySQLProvider) VerfiyCharacterCollation(charset, collation string) (charOK bool, requirements string)

VerfiyCharacterCollation needs to ensure utf8/utf8mb4.

func (MySQLProvider) VerfiyVersion

func (p MySQLProvider) VerfiyVersion(dbVersion string) (bool, string)

VerfiyVersion checks to see if actual database meets minimum version requirements.

type PostgreSQLProvider

type PostgreSQLProvider struct {
	// User specified connection string.
	ConnectionString string

	// Unused for this provider.
	Variant env.StoreType
}

PostgreSQLProvider supports by popular demand.

func (PostgreSQLProvider) ConvertTimestamp added in v1.73.1

func (p PostgreSQLProvider) ConvertTimestamp() (statement string)

ConvertTimestamp returns SQL function to correctly convert ISO 8601 format (e.g. '2016-09-08T06:37:23Z') to SQL specific timestamp value (e.g. 2016-09-08 06:37:23). Must use ? for parameter placeholder character as DB layer will convert to database specific parameter placeholder character.

func (PostgreSQLProvider) DatabaseName

func (p PostgreSQLProvider) DatabaseName() string

DatabaseName holds the SQL database name where Documize tables live.

func (PostgreSQLProvider) DriverName

func (p PostgreSQLProvider) DriverName() string

DriverName returns database/sql driver name.

func (PostgreSQLProvider) Example

func (p PostgreSQLProvider) Example() string

Example holds storage provider specific connection string format. used in error messages

func (PostgreSQLProvider) JSONEmpty

func (p PostgreSQLProvider) JSONEmpty() string

JSONEmpty returns empty SQL JSON object. Typically used as 2nd parameter to COALESCE().

func (PostgreSQLProvider) JSONGetValue

func (p PostgreSQLProvider) JSONGetValue(column, attribute string) string

JSONGetValue returns JSON attribute selection syntax. Typically used in SELECT <my_json_field> query.

func (PostgreSQLProvider) MakeConnectionString

func (p PostgreSQLProvider) MakeConnectionString() string

MakeConnectionString returns provider specific DB connection string complete with default parameters.

func (PostgreSQLProvider) Params

func (p PostgreSQLProvider) Params() map[string]string

Params returns connection string parameters that must be present before connecting to DB.

func (PostgreSQLProvider) QueryDateInterval

func (p PostgreSQLProvider) QueryDateInterval(days int64) string

QueryDateInterval returns provider specific interval style date SQL.

func (PostgreSQLProvider) QueryGetDatabaseVersion

func (p PostgreSQLProvider) QueryGetDatabaseVersion() string

QueryGetDatabaseVersion returns the schema version number.

func (PostgreSQLProvider) QueryGetDatabaseVersionLegacy

func (p PostgreSQLProvider) QueryGetDatabaseVersionLegacy() string

QueryGetDatabaseVersionLegacy returns the schema version number before The Great Schema Migration (v25, MySQL).

func (PostgreSQLProvider) QueryMeta

func (p PostgreSQLProvider) QueryMeta() string

QueryMeta is how to extract version number, collation, character set from database provider.

func (PostgreSQLProvider) QueryRecordVersionUpgrade

func (p PostgreSQLProvider) QueryRecordVersionUpgrade(version int) string

QueryRecordVersionUpgrade returns database specific insert statement that records the database version number.

func (PostgreSQLProvider) QueryRecordVersionUpgradeLegacy

func (p PostgreSQLProvider) QueryRecordVersionUpgradeLegacy(version int) string

QueryRecordVersionUpgradeLegacy returns database specific insert statement that records the database version number.

func (PostgreSQLProvider) QueryTableList

func (p PostgreSQLProvider) QueryTableList() string

QueryTableList returns a list tables in Documize database.

func (PostgreSQLProvider) Type

func (p PostgreSQLProvider) Type() env.StoreType

Type returns name of provider

func (PostgreSQLProvider) TypeVariant

func (p PostgreSQLProvider) TypeVariant() env.StoreType

TypeVariant returns databse flavor

func (PostgreSQLProvider) VerfiyCharacterCollation

func (p PostgreSQLProvider) VerfiyCharacterCollation(charset, collation string) (charOK bool, requirements string)

VerfiyCharacterCollation needs to ensure utf8.

func (PostgreSQLProvider) VerfiyVersion

func (p PostgreSQLProvider) VerfiyVersion(dbVersion string) (bool, string)

VerfiyVersion checks to see if actual database meets minimum version requirements.“

Jump to

Keyboard shortcuts

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