sqlite

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: 21 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      JSON
	Created   time.Time
}

type FormData

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

type JSON

type JSON map[string]interface{}

func (*JSON) Scan

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

func (JSON) Value

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

type SQLite

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

func (*SQLite) ActivateTenant

func (sl *SQLite) ActivateTenant(tenantID string, active bool) error

func (*SQLite) AddFile

func (sl *SQLite) AddFile(dbName string, f model.File) (id string, err error)

func (*SQLite) AddFormSubmission

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

func (*SQLite) AddFunction

func (sl *SQLite) AddFunction(dbName string, data model.ExecData) (id string, err error)

func (*SQLite) AddTask

func (sl *SQLite) AddTask(dbName string, task model.Task) (id string, err error)

func (*SQLite) BulkCreateDocument

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

func (*SQLite) ChangeTenantPlan

func (sl *SQLite) ChangeTenantPlan(tenantID string, plan int) error

func (*SQLite) Count

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

func (*SQLite) CreateAccount

func (sl *SQLite) CreateAccount(dbName, email string) (id string, err error)

func (*SQLite) CreateDatabase

func (sl *SQLite) CreateDatabase(base model.DatabaseConfig) (b model.DatabaseConfig, err error)

func (*SQLite) CreateDocument

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

func (*SQLite) CreateIndex

func (sl *SQLite) CreateIndex(dbName, col, field string) error

func (*SQLite) CreateTenant

func (sl *SQLite) CreateTenant(customer model.Tenant) (c model.Tenant, err error)

func (*SQLite) CreateUser

func (sl *SQLite) CreateUser(dbName string, tok model.User) (id string, err error)

func (*SQLite) DatabaseExists

func (sl *SQLite) DatabaseExists(name string) (exists bool, err error)

func (*SQLite) DeleteDocument

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

func (*SQLite) DeleteDocuments

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

func (*SQLite) DeleteFile

func (sl *SQLite) DeleteFile(dbName, fileID string) error

func (*SQLite) DeleteFunction

func (sl *SQLite) DeleteFunction(dbName, name string) error

func (*SQLite) DeleteTask

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

func (*SQLite) DeleteTenant

func (sl *SQLite) DeleteTenant(dbName, email string) error

func (*SQLite) EmailExists

func (sl *SQLite) EmailExists(email string) (bool, error)

func (*SQLite) EnableExternalLogin

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

func (*SQLite) FindDatabase

func (sl *SQLite) FindDatabase(baseID string) (base model.DatabaseConfig, err error)

func (*SQLite) FindRootUser

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

func (*SQLite) FindTenant

func (sl *SQLite) FindTenant(tenantID string) (customer model.Tenant, err error)

func (*SQLite) FindUser

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

func (*SQLite) FindUserByEmail

func (sl *SQLite) FindUserByEmail(dbName, email string) (tok model.User, err error)

func (*SQLite) GetAllDatabaseSizes

func (sl *SQLite) GetAllDatabaseSizes() error

func (*SQLite) GetDocumentByID

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

func (*SQLite) GetDocumentsByIDs

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

func (*SQLite) GetFileByID

func (sl *SQLite) GetFileByID(dbName, fileID string) (f model.File, err error)

func (*SQLite) GetFirstUserFromAccountID

func (sl *SQLite) GetFirstUserFromAccountID(dbName, accountID string) (tok model.User, err error)

func (*SQLite) GetForms

func (sl *SQLite) GetForms(dbName string) (results []string, err error)

func (*SQLite) GetFunctionByID

func (sl *SQLite) GetFunctionByID(dbName, id string) (result model.ExecData, err error)

func (*SQLite) GetFunctionByName

func (sl *SQLite) GetFunctionByName(dbName, name string) (result model.ExecData, err error)

func (*SQLite) GetFunctionForExecution

func (sl *SQLite) GetFunctionForExecution(dbName, name string) (result model.ExecData, err error)

func (*SQLite) GetRootForBase

func (sl *SQLite) GetRootForBase(dbName string) (tok model.User, err error)

func (*SQLite) GetTenantByStripeID

func (sl *SQLite) GetTenantByStripeID(stripeID string) (cus model.Tenant, err error)

func (*SQLite) GetUserByID

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

func (*SQLite) IncrementMonthlyEmailSent

func (sl *SQLite) IncrementMonthlyEmailSent(baseID string) error

func (*SQLite) IncrementValue

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

func (*SQLite) ListAccounts

func (sl *SQLite) ListAccounts(dbName string) ([]model.Account, error)

func (*SQLite) ListAllFiles

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

func (*SQLite) ListCollections

func (sl *SQLite) ListCollections(dbName string) (results []string, err error)

func (*SQLite) ListDatabases

func (sl *SQLite) ListDatabases() (results []model.DatabaseConfig, err error)

func (*SQLite) ListDocuments

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

func (*SQLite) ListFormSubmissions

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

func (*SQLite) ListFunctions

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

func (*SQLite) ListFunctionsByTrigger

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

func (*SQLite) ListTasks

func (sl *SQLite) ListTasks() (results []model.Task, err error)

func (*SQLite) ListTasksByBase

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

func (*SQLite) ListUsers

func (sl *SQLite) ListUsers(dbName, accountID string) ([]model.User, error)

func (*SQLite) NewID

func (sl *SQLite) NewID() string

func (*SQLite) ParseQuery

func (sl *SQLite) ParseQuery(clauses [][]interface{}) (map[string]interface{}, error)

func (*SQLite) Ping

func (sl *SQLite) Ping() error

func (*SQLite) QueryDocuments

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

func (*SQLite) RanFunction

func (sl *SQLite) RanFunction(dbName, id string, rh model.ExecHistory) error

func (*SQLite) RemoveUser

func (sl *SQLite) RemoveUser(auth model.Auth, dbName, userID string) error

func (*SQLite) ResetPassword

func (sl *SQLite) ResetPassword(dbName, email, code, password string) error

func (*SQLite) SetPasswordResetCode

func (sl *SQLite) SetPasswordResetCode(dbName, userID, code string) error

func (*SQLite) SetUserRole

func (sl *SQLite) SetUserRole(dbName, email string, role int) error

func (*SQLite) UpdateDocument

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

func (*SQLite) UpdateDocuments

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

func (*SQLite) UpdateFunction

func (sl *SQLite) UpdateFunction(dbName, id, code, trigger string) error

func (*SQLite) UserEmailExists

func (sl *SQLite) UserEmailExists(dbName, email string) (exists bool, err error)

func (*SQLite) UserSetPassword

func (sl *SQLite) 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