community: github.com/documize/community/edition/storage Index | Files

package storage

import "github.com/documize/community/edition/storage"

Package storage sets up database persistence providers.

Package storage sets up database persistence providers.

Package storage sets up database persistence providers.

Index

Package Files

mysql.go postgresql.go sqlserver.go

func SetMySQLProvider Uses

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

SetMySQLProvider creates MySQL provider

func SetPostgreSQLProvider Uses

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

SetPostgreSQLProvider creates PostgreSQL provider

func SetSQLServerProvider Uses

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

SetSQLServerProvider creates PostgreSQL provider.

Useful links:

Driver for Golang:

https://github.com/denisenkom/go-mssqldb

Docker Linux testing:

https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-2017
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Passw0rd' -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2017-latest

JSON types:

https://docs.microsoft.com/en-us/sql/relational-databases/json/json-data-sql-server?view=sql-server-2017

Supports 2016, 2017 and 2019.

type MySQLProvider Uses

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 Uses

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 Uses

func (p MySQLProvider) DatabaseName() string

DatabaseName holds the SQL database name where Documize tables live.

func (MySQLProvider) DriverName Uses

func (p MySQLProvider) DriverName() string

DriverName returns database/sql driver name.

func (MySQLProvider) Example Uses

func (p MySQLProvider) Example() string

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

func (MySQLProvider) IsFalse Uses

func (p MySQLProvider) IsFalse() string

IsFalse returns "0"

func (MySQLProvider) IsTrue Uses

func (p MySQLProvider) IsTrue() string

IsTrue returns "1"

func (MySQLProvider) JSONEmpty Uses

func (p MySQLProvider) JSONEmpty() string

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

func (MySQLProvider) JSONGetValue Uses

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 Uses

func (p MySQLProvider) MakeConnectionString() string

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

func (MySQLProvider) Params Uses

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

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

func (MySQLProvider) QueryDateInterval Uses

func (p MySQLProvider) QueryDateInterval(days int64) string

QueryDateInterval returns provider specific interval style date SQL.

func (MySQLProvider) QueryGetDatabaseVersion Uses

func (p MySQLProvider) QueryGetDatabaseVersion() string

QueryGetDatabaseVersion returns the schema version number.

func (MySQLProvider) QueryGetDatabaseVersionLegacy Uses

func (p MySQLProvider) QueryGetDatabaseVersionLegacy() string

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

func (MySQLProvider) QueryMeta Uses

func (p MySQLProvider) QueryMeta() string

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

func (MySQLProvider) QueryRecordVersionUpgrade Uses

func (p MySQLProvider) QueryRecordVersionUpgrade(version int) string

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

func (MySQLProvider) QueryRecordVersionUpgradeLegacy Uses

func (p MySQLProvider) QueryRecordVersionUpgradeLegacy(version int) string

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

func (MySQLProvider) QueryTableList Uses

func (p MySQLProvider) QueryTableList() string

QueryTableList returns a list tables in Documize database.

func (MySQLProvider) RowLimit Uses

func (p MySQLProvider) RowLimit(max int) string

RowLimit returns SQL for limiting number of rows returned.

func (MySQLProvider) Type Uses

func (p MySQLProvider) Type() env.StoreType

Type returns name of provider

func (MySQLProvider) TypeVariant Uses

func (p MySQLProvider) TypeVariant() env.StoreType

TypeVariant returns databse flavor

func (MySQLProvider) VerfiyCharacterCollation Uses

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

VerfiyCharacterCollation needs to ensure utf8/utf8mb4.

func (MySQLProvider) VerfiyVersion Uses

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

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

type PostgreSQLProvider Uses

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

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

PostgreSQLProvider supports by popular demand.

func (PostgreSQLProvider) ConvertTimestamp Uses

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 Uses

func (p PostgreSQLProvider) DatabaseName() string

DatabaseName holds the SQL database name where Documize tables live.

func (PostgreSQLProvider) DriverName Uses

func (p PostgreSQLProvider) DriverName() string

DriverName returns database/sql driver name.

func (PostgreSQLProvider) Example Uses

func (p PostgreSQLProvider) Example() string

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

func (PostgreSQLProvider) IsFalse Uses

func (p PostgreSQLProvider) IsFalse() string

IsFalse returns "false"

func (PostgreSQLProvider) IsTrue Uses

func (p PostgreSQLProvider) IsTrue() string

IsTrue returns "true"

func (PostgreSQLProvider) JSONEmpty Uses

func (p PostgreSQLProvider) JSONEmpty() string

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

func (PostgreSQLProvider) JSONGetValue Uses

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 Uses

func (p PostgreSQLProvider) MakeConnectionString() string

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

func (PostgreSQLProvider) Params Uses

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

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

func (PostgreSQLProvider) QueryDateInterval Uses

func (p PostgreSQLProvider) QueryDateInterval(days int64) string

QueryDateInterval returns provider specific interval style date SQL.

func (PostgreSQLProvider) QueryGetDatabaseVersion Uses

func (p PostgreSQLProvider) QueryGetDatabaseVersion() string

QueryGetDatabaseVersion returns the schema version number.

func (PostgreSQLProvider) QueryGetDatabaseVersionLegacy Uses

func (p PostgreSQLProvider) QueryGetDatabaseVersionLegacy() string

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

func (PostgreSQLProvider) QueryMeta Uses

func (p PostgreSQLProvider) QueryMeta() string

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

func (PostgreSQLProvider) QueryRecordVersionUpgrade Uses

func (p PostgreSQLProvider) QueryRecordVersionUpgrade(version int) string

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

func (PostgreSQLProvider) QueryRecordVersionUpgradeLegacy Uses

func (p PostgreSQLProvider) QueryRecordVersionUpgradeLegacy(version int) string

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

func (PostgreSQLProvider) QueryTableList Uses

func (p PostgreSQLProvider) QueryTableList() string

QueryTableList returns a list tables in Documize database.

func (PostgreSQLProvider) RowLimit Uses

func (p PostgreSQLProvider) RowLimit(max int) string

RowLimit returns SQL for limiting number of rows returned.

func (PostgreSQLProvider) Type Uses

func (p PostgreSQLProvider) Type() env.StoreType

Type returns name of provider

func (PostgreSQLProvider) TypeVariant Uses

func (p PostgreSQLProvider) TypeVariant() env.StoreType

TypeVariant returns databse flavor

func (PostgreSQLProvider) VerfiyCharacterCollation Uses

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

VerfiyCharacterCollation needs to ensure utf8.

func (PostgreSQLProvider) VerfiyVersion Uses

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

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

type SQLServerProvider Uses

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

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

SQLServerProvider supports Microsoft SQl Server.

func (SQLServerProvider) ConvertTimestamp Uses

func (p SQLServerProvider) 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).

We must use ? for parameter placeholder character as DB layer will convert to database specific parameter placeholder character.

func (SQLServerProvider) DatabaseName Uses

func (p SQLServerProvider) DatabaseName() string

DatabaseName holds the SQL database name where Documize tables live.

func (SQLServerProvider) DriverName Uses

func (p SQLServerProvider) DriverName() string

DriverName returns database/sql driver name.

func (SQLServerProvider) Example Uses

func (p SQLServerProvider) Example() string

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

func (SQLServerProvider) IsFalse Uses

func (p SQLServerProvider) IsFalse() string

IsFalse returns "0"

func (SQLServerProvider) IsTrue Uses

func (p SQLServerProvider) IsTrue() string

IsTrue returns "1"

func (SQLServerProvider) JSONEmpty Uses

func (p SQLServerProvider) JSONEmpty() string

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

func (SQLServerProvider) JSONGetValue Uses

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

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

func (SQLServerProvider) MakeConnectionString Uses

func (p SQLServerProvider) MakeConnectionString() string

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

func (SQLServerProvider) Params Uses

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

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

func (SQLServerProvider) QueryDateInterval Uses

func (p SQLServerProvider) QueryDateInterval(days int64) string

QueryDateInterval returns provider specific interval style date SQL.

func (SQLServerProvider) QueryGetDatabaseVersion Uses

func (p SQLServerProvider) QueryGetDatabaseVersion() string

QueryGetDatabaseVersion returns the schema version number.

func (SQLServerProvider) QueryGetDatabaseVersionLegacy Uses

func (p SQLServerProvider) QueryGetDatabaseVersionLegacy() string

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

func (SQLServerProvider) QueryMeta Uses

func (p SQLServerProvider) QueryMeta() string

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

func (SQLServerProvider) QueryRecordVersionUpgrade Uses

func (p SQLServerProvider) QueryRecordVersionUpgrade(version int) string

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

func (SQLServerProvider) QueryRecordVersionUpgradeLegacy Uses

func (p SQLServerProvider) QueryRecordVersionUpgradeLegacy(version int) string

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

func (SQLServerProvider) QueryTableList Uses

func (p SQLServerProvider) QueryTableList() string

QueryTableList returns a list tables in Documize database.

func (SQLServerProvider) RowLimit Uses

func (p SQLServerProvider) RowLimit(max int) string

RowLimit returns SQL for limiting number of rows returned.

func (SQLServerProvider) Type Uses

func (p SQLServerProvider) Type() env.StoreType

Type returns name of provider

func (SQLServerProvider) TypeVariant Uses

func (p SQLServerProvider) TypeVariant() env.StoreType

TypeVariant returns databse flavor

func (SQLServerProvider) VerfiyCharacterCollation Uses

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

VerfiyCharacterCollation needs to ensure utf8. https://www.red-gate.com/simple-talk/sql/sql-development/questions-sql-server-collations-shy-ask/

func (SQLServerProvider) VerfiyVersion Uses

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

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

See: http://sqlserverbuilds.blogspot.com

Package storage imports 29 packages (graph) and is imported by 1 packages. Updated 2019-08-26. Refresh now. Tools for package owners.