oracle

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Universal         characterSet = unicode.UTF8
	EuroSymbolSupport characterSet = charmap.Windows1252
	QueryTemplates                 = map[string]string{
		`GetSingle`: `SELECT * ` +
			`FROM "{{.TableName}}" "_{{.TableName}}"` +
			`{{range .Relations}}` +
			`   LEFT JOIN "{{.Relationship.WithTable}}"` +
			`   ON "{{.Relationship.WithTable}}"."{{.Relationship.ForeignTableUniqueIDColumn}}"` +
			`   = "_{{$.TableName}}"."{{.Relationship.LocalTableUniqueIDColumn}}"` +
			`{{end}}` +
			` WHERE "_{{$.TableName}}"."{{.UniqueIDColumn}}" = :1`,
		`GetSingleAsOption`: `SELECT "{{.UniqueIDColumn}}", "{{.ColumnAsOptionName}}" ` +
			`FROM "{{.TableName}}" ` +
			`WHERE "{{.UniqueIDColumn}}" = :1`,
		`GetCollection`: `SELECT * ` +
			`FROM "{{.TableName}}"`,
		`GetCollectionFilterable`: `SELECT * ` +
			`FROM "{{.TableName}}" ` +
			`WHERE "{{.FilterOnColumn}}" {{$.Operator}} {{(format -1 .FilterOnColumn)}}`,
		`GetCollectionAsOptions`: `SELECT "{{.UniqueIDColumn}}", "{{.ColumnAsOptionName}}" ` +
			`FROM "{{.TableName}}"`,
		`GetCollectionAsOptionsFilterable`: `SELECT "{{.UniqueIDColumn}}", "{{.ColumnAsOptionName}}" ` +
			`FROM "{{.TableName}}" ` +
			`WHERE UPPER("{{.ColumnAsOptionName}}") LIKE '%'||UPPER(:1)||'%'`,
		`GetCollectionAsOptionsWithParams`: `SELECT "{{.UniqueIDColumn}}", "{{.ColumnAsOptionName}}" ` +
			`FROM "{{.TableName}}" ` +
			`WHERE UPPER("{{.ColumnAsOptionName}}") LIKE '%'||UPPER(:1)||'%' ` +
			`{{range $index, $element := .ColumnNames}}` +
			`AND "{{$element}}" = {{(format $index $element)}} ` +
			`{{end}}`,
		`UpdateSingle`: `UPDATE "{{.TableName}}" ` +
			`{{with $firstColumn := .ColumnNames | head}}` +
			`SET "{{$firstColumn}}" = {{(format -1 $firstColumn)}}` +
			`{{end}}` +
			`{{range $index, $element := .ColumnNames | tail}},` +
			`  "{{$element}}" = {{(format $index $element)}}` +
			`{{end}} ` +
			`WHERE "{{.UniqueIDColumn}}"= :{{(lenPlus1 .ColumnNames)}}`,
		`CreateSingle`: `DECLARE "l_{{.UniqueIDColumn}}" nvarchar2(256); ` +
			`BEGIN ` +
			`INSERT INTO "{{.TableName}}"` +
			`("{{.ColumnNames | head}}"` +
			`{{range .ColumnNames | tail}},` +
			`  "{{.}}"` +
			`{{end}}) ` +
			`{{with $firstColumn := .ColumnNames | head}}` +
			`VALUES({{(format -1 $firstColumn)}}` +
			`{{end}}` +
			`{{range $index, $element := .ColumnNames | tail}},` +
			`  {{format $index $element}}` +
			`{{end}}) RETURNING "{{.UniqueIDColumn}}" INTO "l_{{.UniqueIDColumn}}"; ` +
			`DBMS_OUTPUT.PUT_LINE("l_{{.UniqueIDColumn}}"); ` +
			"END;",
		`DeleteSingle`: `DELETE FROM "{{.TableName}}" WHERE "{{.UniqueIDColumn}}" = :1`,
		`GetTableSchema`: `SELECT * ` +
			`FROM "{{.TableName}}" ` +
			`WHERE ROWNUM <= 1`,
		`GetTableWithRelationshipsSchema`: `SELECT * FROM "{{.TableName}}" "_{{.TableName}}"` +
			`{{range .Relations}}` +
			` LEFT JOIN "{{.Relationship.WithTable}}"` +
			` ON "{{.Relationship.WithTable}}"."{{.Relationship.ForeignTableUniqueIDColumn}}"` +
			` = "_{{$.TableName}}"."{{.Relationship.LocalTableUniqueIDColumn}}"{{end}} WHERE ROWNUM <= 1`,
	}
)

Functions

func New

func New() endpoint.Endpoint

Types

type Oracle

type Oracle struct {
	*sqlBackend.SqlBackend
	// contains filtered or unexported fields
}

func (*Oracle) Open

func (o *Oracle) Open(args ...interface{}) error

Jump to

Keyboard shortcuts

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