postgresql

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldID        = "id"
	FieldAccountID = "accountId"
	FieldFormName  = "sb_form"
)

Variables

This section is empty.

Functions

func New

Types

type Document

type Document struct {
	ID        string
	AccountID string
	OwnerID   string
	Data      JSONB
	Created   time.Time
}

type FormData

type FormData struct {
	ID      string
	Name    string
	Data    JSONB
	Created time.Time
}

type JSONB

type JSONB map[string]interface{}

func (*JSONB) Scan

func (j *JSONB) Scan(value interface{}) error

func (JSONB) Value

func (j JSONB) Value() (driver.Value, error)

type PostgreSQL

type PostgreSQL struct {
	DB              *sql.DB
	PublishDocument cache.PublishDocumentEvent
	// contains filtered or unexported fields
}

func (*PostgreSQL) ActivateTenant added in v1.4.1

func (pg *PostgreSQL) ActivateTenant(tenantID string, active bool) error

func (*PostgreSQL) AddFile

func (pg *PostgreSQL) AddFile(dbName string, f model.File) (id string, err error)

func (*PostgreSQL) AddFormSubmission

func (pg *PostgreSQL) AddFormSubmission(dbName, form string, doc map[string]interface{}) error

func (*PostgreSQL) AddFunction

func (pg *PostgreSQL) AddFunction(dbName string, data model.ExecData) (id string, err error)

func (*PostgreSQL) AddTask added in v1.5.0

func (pg *PostgreSQL) AddTask(dbName string, task model.Task) (id string, err error)

func (*PostgreSQL) BulkCreateDocument

func (pg *PostgreSQL) BulkCreateDocument(auth model.Auth, dbName, col string, docs []interface{}) error

func (*PostgreSQL) ChangeTenantPlan added in v1.4.1

func (pg *PostgreSQL) ChangeTenantPlan(tenantID string, plan int) error

func (*PostgreSQL) Count added in v1.4.3

func (pg *PostgreSQL) Count(auth model.Auth, dbName, col string, filters map[string]interface{}) (count int64, err error)

func (*PostgreSQL) CreateAccount added in v1.4.1

func (pg *PostgreSQL) CreateAccount(dbName, email string) (id string, err error)

func (*PostgreSQL) CreateDatabase added in v1.4.1

func (pg *PostgreSQL) CreateDatabase(base model.DatabaseConfig) (b model.DatabaseConfig, err error)

func (*PostgreSQL) CreateDocument

func (pg *PostgreSQL) CreateDocument(auth model.Auth, dbName, col string, doc map[string]interface{}) (inserted map[string]interface{}, err error)

func (*PostgreSQL) CreateIndex added in v1.3.0

func (pg *PostgreSQL) CreateIndex(dbName, col, field string) error

func (*PostgreSQL) CreateTenant added in v1.4.1

func (pg *PostgreSQL) CreateTenant(customer model.Tenant) (c model.Tenant, err error)

func (*PostgreSQL) CreateUser added in v1.4.1

func (pg *PostgreSQL) CreateUser(dbName string, tok model.User) (id string, err error)

func (*PostgreSQL) DatabaseExists

func (pg *PostgreSQL) DatabaseExists(name string) (exists bool, err error)

func (*PostgreSQL) DeleteDocument

func (pg *PostgreSQL) DeleteDocument(auth model.Auth, dbName, col, id string) (int64, error)

func (*PostgreSQL) DeleteDocuments added in v1.5.0

func (pg *PostgreSQL) DeleteDocuments(auth model.Auth, dbName, col string, filters map[string]any) (n int64, err error)

func (*PostgreSQL) DeleteFile

func (pg *PostgreSQL) DeleteFile(dbName, fileID string) error

func (*PostgreSQL) DeleteFunction

func (pg *PostgreSQL) DeleteFunction(dbName, name string) error

func (*PostgreSQL) DeleteTask added in v1.5.0

func (sl *PostgreSQL) DeleteTask(dbName, id string) error

func (*PostgreSQL) DeleteTenant added in v1.4.1

func (pg *PostgreSQL) DeleteTenant(dbName, email string) error

func (*PostgreSQL) EmailExists

func (pg *PostgreSQL) EmailExists(email string) (bool, error)

func (*PostgreSQL) EnableExternalLogin added in v1.4.0

func (pg *PostgreSQL) EnableExternalLogin(tenantID string, config map[string]model.OAuthConfig) error

func (*PostgreSQL) FindDatabase

func (pg *PostgreSQL) FindDatabase(baseID string) (base model.DatabaseConfig, err error)

func (*PostgreSQL) FindRootUser added in v1.4.1

func (pg *PostgreSQL) FindRootUser(dbName, userID, accountID, token string) (tok model.User, err error)

func (*PostgreSQL) FindTenant added in v1.4.1

func (pg *PostgreSQL) FindTenant(tenantID string) (customer model.Tenant, err error)

func (*PostgreSQL) FindUser added in v1.4.1

func (pg *PostgreSQL) FindUser(dbName, userID, token string) (tok model.User, err error)

func (*PostgreSQL) FindUserByEmail added in v1.4.1

func (pg *PostgreSQL) FindUserByEmail(dbName, email string) (tok model.User, err error)

func (*PostgreSQL) GetAllDatabaseSizes added in v1.4.0

func (pg *PostgreSQL) GetAllDatabaseSizes() error

func (*PostgreSQL) GetDocumentByID

func (pg *PostgreSQL) GetDocumentByID(auth model.Auth, dbName, col, id string) (map[string]interface{}, error)

func (*PostgreSQL) GetDocumentsByIDs added in v1.4.2

func (pg *PostgreSQL) GetDocumentsByIDs(auth model.Auth, dbName, col string, ids []string) (docs []map[string]interface{}, err error)

func (*PostgreSQL) GetFileByID

func (pg *PostgreSQL) GetFileByID(dbName, fileID string) (f model.File, err error)

func (*PostgreSQL) GetFirstUserFromAccountID added in v1.4.1

func (pg *PostgreSQL) GetFirstUserFromAccountID(dbName, accountID string) (tok model.User, err error)

func (*PostgreSQL) GetForms

func (pg *PostgreSQL) GetForms(dbName string) (results []string, err error)

func (*PostgreSQL) GetFunctionByID

func (pg *PostgreSQL) GetFunctionByID(dbName, id string) (result model.ExecData, err error)

func (*PostgreSQL) GetFunctionByName

func (pg *PostgreSQL) GetFunctionByName(dbName, name string) (result model.ExecData, err error)

func (*PostgreSQL) GetFunctionForExecution

func (pg *PostgreSQL) GetFunctionForExecution(dbName, name string) (result model.ExecData, err error)

func (*PostgreSQL) GetRootForBase

func (pg *PostgreSQL) GetRootForBase(dbName string) (tok model.User, err error)

func (*PostgreSQL) GetTenantByStripeID added in v1.4.1

func (pg *PostgreSQL) GetTenantByStripeID(stripeID string) (cus model.Tenant, err error)

func (*PostgreSQL) GetUserByID added in v1.5.0

func (pg *PostgreSQL) GetUserByID(dbName, accountID, userID string) (user model.User, err error)

func (*PostgreSQL) IncrementMonthlyEmailSent

func (pg *PostgreSQL) IncrementMonthlyEmailSent(baseID string) error

func (*PostgreSQL) IncrementValue

func (pg *PostgreSQL) IncrementValue(auth model.Auth, dbName, col, id, field string, n int) error

func (*PostgreSQL) ListAccounts added in v1.5.0

func (pg *PostgreSQL) ListAccounts(dbName string) ([]model.Account, error)

func (*PostgreSQL) ListAllFiles added in v1.4.0

func (pg *PostgreSQL) ListAllFiles(dbName, accountID string) (results []model.File, err error)

func (*PostgreSQL) ListCollections

func (pg *PostgreSQL) ListCollections(dbName string) (results []string, err error)

func (*PostgreSQL) ListDatabases

func (pg *PostgreSQL) ListDatabases() (results []model.DatabaseConfig, err error)

func (*PostgreSQL) ListDocuments

func (pg *PostgreSQL) ListDocuments(auth model.Auth, dbName, col string, params model.ListParams) (result model.PagedResult, err error)

func (*PostgreSQL) ListFormSubmissions

func (pg *PostgreSQL) ListFormSubmissions(dbName, name string) (results []map[string]interface{}, err error)

func (*PostgreSQL) ListFunctions

func (pg *PostgreSQL) ListFunctions(dbName string) (results []model.ExecData, err error)

func (*PostgreSQL) ListFunctionsByTrigger

func (pg *PostgreSQL) ListFunctionsByTrigger(dbName, trigger string) (results []model.ExecData, err error)

func (*PostgreSQL) ListTasks

func (pg *PostgreSQL) ListTasks() (results []model.Task, err error)

func (*PostgreSQL) ListTasksByBase

func (pg *PostgreSQL) ListTasksByBase(dbName string) (results []model.Task, err error)

func (*PostgreSQL) ListUsers added in v1.5.0

func (pg *PostgreSQL) ListUsers(dbName, accountID string) ([]model.User, error)

func (*PostgreSQL) NewID

func (pg *PostgreSQL) NewID() string

func (*PostgreSQL) ParseQuery

func (mg *PostgreSQL) ParseQuery(clauses [][]interface{}) (map[string]interface{}, error)

func (*PostgreSQL) Ping

func (pg *PostgreSQL) Ping() error

func (*PostgreSQL) QueryDocuments

func (pg *PostgreSQL) QueryDocuments(auth model.Auth, dbName, col string, filters map[string]interface{}, params model.ListParams) (result model.PagedResult, err error)

func (*PostgreSQL) RanFunction

func (pg *PostgreSQL) RanFunction(dbName, id string, rh model.ExecHistory) error

func (*PostgreSQL) RemoveUser added in v1.5.0

func (pg *PostgreSQL) RemoveUser(auth model.Auth, dbName, userID string) error

func (*PostgreSQL) ResetPassword

func (pg *PostgreSQL) ResetPassword(dbName, email, code, password string) error

func (*PostgreSQL) SetPasswordResetCode

func (pg *PostgreSQL) SetPasswordResetCode(dbName, userID, code string) error

func (*PostgreSQL) SetUserRole

func (pg *PostgreSQL) SetUserRole(dbName, email string, role int) error

func (*PostgreSQL) UpdateDocument

func (pg *PostgreSQL) UpdateDocument(auth model.Auth, dbName, col, id string, doc map[string]interface{}) (map[string]interface{}, error)

func (*PostgreSQL) UpdateDocuments added in v1.4.0

func (pg *PostgreSQL) UpdateDocuments(auth model.Auth, dbName, col string, filters map[string]interface{}, updateFields map[string]interface{}) (n int64, err error)

func (*PostgreSQL) UpdateFunction

func (pg *PostgreSQL) UpdateFunction(dbName, id, code, trigger string) error

func (*PostgreSQL) UserEmailExists

func (pg *PostgreSQL) UserEmailExists(dbName, email string) (exists bool, err error)

func (*PostgreSQL) UserSetPassword

func (pg *PostgreSQL) UserSetPassword(dbName, tokenID, password string) error

type Scanner

type Scanner interface {
	Scan(dest ...interface{}) error
}

Jump to

Keyboard shortcuts

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