database

package
v0.0.0-...-d076d71 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(a []map[string]string, x string) bool

Types

type CampaignFieldList

type CampaignFieldList []struct {
	Type      string `json:"type"`
	FieldType string `json:"fieldType"`
	Name      string `json:"name"`
	State     string `json:"state"`
	Deleted   bool   `json:"deleted"`
}

type ColumnMeta

type ColumnMeta struct {
	Name string
	Type string
	Len  int32
}

type DBConnection

type DBConnection struct {
	DB          *sql.DB
	DBType      string
	TablePrefix string
	TableMeta   map[string]map[string]*ColumnMeta // table | column | metadata of column
}

func Open

func Open(dbType string, uri string, tablePrefix string, l *logging.Logger) (*DBConnection, error)

URIs: MYSQL: user:password@/{TABLE_PREFIX}ml_camp?charset=utf8mb4&collation=utf8mb4_bin POSTGRES: postgres://user:password@localhost:5432/{TABLE_PREFIX}ml_camp MSSQL: sqlserver://user:password@localhost:1433?database={TABLE_PREFIX}ml_camp

func (*DBConnection) AddColumnsMySQL

func (con *DBConnection) AddColumnsMySQL(tableName string, columnMaps []map[string]string, b *bytes.Buffer)

func (*DBConnection) AddColumnsPostgres

func (con *DBConnection) AddColumnsPostgres(tableName string, columnMaps []map[string]string, b *bytes.Buffer)

func (*DBConnection) AddColumnsSQLServer

func (con *DBConnection) AddColumnsSQLServer(tableName string, columnMaps []map[string]string, b *bytes.Buffer)

func (*DBConnection) ChangeColumnsMySQL

func (con *DBConnection) ChangeColumnsMySQL(tableName string, columns map[string]string, b *bytes.Buffer)

func (*DBConnection) ChangeColumnsPostgres

func (con *DBConnection) ChangeColumnsPostgres(tableName string, columns map[string]string, b *bytes.Buffer)

func (*DBConnection) ChangeColumnsSQLServer

func (con *DBConnection) ChangeColumnsSQLServer(tableName string, columns map[string]string, b *bytes.Buffer)

func (*DBConnection) CreateIndexMySQL

func (con *DBConnection) CreateIndexMySQL(tableName string, columns []string, b *bytes.Buffer)

func (*DBConnection) CreateIndexPostgres

func (con *DBConnection) CreateIndexPostgres(tableName string, columns []string, b *bytes.Buffer)

func (*DBConnection) CreateIndexSQLServer

func (con *DBConnection) CreateIndexSQLServer(tableName string, columns []string, b *bytes.Buffer)

func (*DBConnection) CreateTableMySQL

func (con *DBConnection) CreateTableMySQL(tableName string, columnMaps []map[string]string, b *bytes.Buffer)

func (*DBConnection) CreateTablePostgres

func (con *DBConnection) CreateTablePostgres(tableName string, columnMaps []map[string]string, b *bytes.Buffer)

func (*DBConnection) CreateTableSQLServer

func (con *DBConnection) CreateTableSQLServer(tableName string, columnMaps []map[string]string, b *bytes.Buffer)

func (*DBConnection) DescribeTableColumns

func (con *DBConnection) DescribeTableColumns(tableName string) map[string]*ColumnMeta

func (*DBConnection) DescribeTableColumnsMySQL

func (con *DBConnection) DescribeTableColumnsMySQL(tableName string, b *bytes.Buffer)

func (*DBConnection) DescribeTableColumnsPostgres

func (con *DBConnection) DescribeTableColumnsPostgres(tableName string, b *bytes.Buffer)

func (*DBConnection) DescribeTableColumnsSQLServer

func (con *DBConnection) DescribeTableColumnsSQLServer(tableName string, b *bytes.Buffer)

func (*DBConnection) GetContactMD5MySQL

func (con *DBConnection) GetContactMD5MySQL(tableName string, ids []string, b *bytes.Buffer)

func (*DBConnection) GetContactMD5Postgres

func (con *DBConnection) GetContactMD5Postgres(tableName string, ids []string, b *bytes.Buffer)

func (*DBConnection) GetContactMD5SQLServer

func (con *DBConnection) GetContactMD5SQLServer(tableName string, ids []string, b *bytes.Buffer)

func (*DBConnection) PrepareUpsertMySQL

func (con *DBConnection) PrepareUpsertMySQL(tableName string, columns []string, b *bytes.Buffer)

func (*DBConnection) PrepareUpsertPostgres

func (con *DBConnection) PrepareUpsertPostgres(tableName string, columns []string, b *bytes.Buffer)

func (*DBConnection) PrepareUpsertSQLServer

func (con *DBConnection) PrepareUpsertSQLServer(tableName string, columns []string, b *bytes.Buffer)

func (*DBConnection) PrepareUpsertStatement

func (con *DBConnection) PrepareUpsertStatement(tableName string, data []string) (*sql.Stmt, error)

func (*DBConnection) QueryMD5

func (con *DBConnection) QueryMD5(ids []string) map[string]string

func (*DBConnection) RefreshTableMetadata

func (con *DBConnection) RefreshTableMetadata(entityType string)

func (*DBConnection) UpdateTables

func (con *DBConnection) UpdateTables(fieldList CampaignFieldList) error

func (*DBConnection) Upsert

func (con *DBConnection) Upsert(entity Entity) error

type Entity

type Entity struct {
	Type string
	Data map[string]interface{}
}

func (*Entity) GetID

func (e *Entity) GetID() string

func (*Entity) GetPrimaryKeyName

func (e *Entity) GetPrimaryKeyName() string

Jump to

Keyboard shortcuts

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