Documentation
¶
Index ¶
- Constants
- func New(client *mongo.Client, pubdoc cache.PublishDocumentEvent, log *logger.Logger) database.Persister
- type Base
- type LocalAccount
- type LocalBase
- type LocalCustomer
- type LocalExecData
- type LocalExecHistory
- type LocalFile
- type LocalMetaMessage
- type LocalTask
- type LocalToken
- type Mongo
- func (mg *Mongo) ActivateTenant(tenantID string, active bool) error
- func (mg *Mongo) AddFile(dbName string, f model.File) (id string, err error)
- func (mg *Mongo) AddFormSubmission(dbName, form string, doc map[string]interface{}) error
- func (mg *Mongo) AddFunction(dbName string, data model.ExecData) (string, error)
- func (mg *Mongo) AddTask(dbName string, task model.Task) (string, error)
- func (mg *Mongo) BulkCreateDocument(auth model.Auth, dbName, col string, docs []interface{}) error
- func (mg *Mongo) ChangeTenantPlan(tenantID string, plan int) error
- func (mg *Mongo) Count(auth model.Auth, dbName, col string, filter map[string]interface{}) (count int64, err error)
- func (mg *Mongo) CreateAccount(dbName, email string) (id string, err error)
- func (mg *Mongo) CreateDatabase(base model.DatabaseConfig) (model.DatabaseConfig, error)
- func (mg *Mongo) CreateDocument(auth model.Auth, dbName, col string, doc map[string]interface{}) (map[string]interface{}, error)
- func (mg *Mongo) CreateIndex(dbName, col, field string) error
- func (mg *Mongo) CreateTenant(customer model.Tenant) (model.Tenant, error)
- func (mg *Mongo) CreateUser(dbName string, tok model.User) (id string, err error)
- func (mg *Mongo) DatabaseExists(name string) (bool, error)
- func (mg *Mongo) DeleteDocument(auth model.Auth, dbName, col, id string) (int64, error)
- func (mg *Mongo) DeleteDocuments(auth model.Auth, dbName, col string, filters map[string]any) (int64, error)
- func (mg *Mongo) DeleteFile(dbName, fileID string) error
- func (mg *Mongo) DeleteFunction(dbName, name string) error
- func (mg *Mongo) DeleteTask(dbName, id string) error
- func (mg *Mongo) DeleteTenant(dbName, email string) error
- func (mg *Mongo) EmailExists(email string) (bool, error)
- func (mg *Mongo) EnableExternalLogin(tenantID string, config map[string]model.OAuthConfig) error
- func (mg *Mongo) FindDatabase(baseID string) (conf model.DatabaseConfig, err error)
- func (mg *Mongo) FindRootUser(dbName, userID, accountID, token string) (tok model.User, err error)
- func (mg *Mongo) FindTenant(tenantID string) (cus model.Tenant, err error)
- func (mg *Mongo) FindUser(dbName, userID, token string) (tok model.User, err error)
- func (mg *Mongo) FindUserByEmail(dbName, email string) (tok model.User, err error)
- func (mg *Mongo) GetDocumentByID(auth model.Auth, dbName, col, id string) (map[string]interface{}, error)
- func (mg *Mongo) GetDocumentsByIDs(auth model.Auth, dbName, col string, ids []string) (docs []map[string]interface{}, err error)
- func (mg *Mongo) GetFileByID(dbName, fileID string) (f model.File, err error)
- func (mg *Mongo) GetFirstUserFromAccountID(dbName, accountID string) (tok model.User, err error)
- func (mg *Mongo) GetForms(dbName string) ([]string, error)
- func (mg *Mongo) GetFunctionByID(dbName, id string) (result model.ExecData, err error)
- func (mg *Mongo) GetFunctionByName(dbName, name string) (result model.ExecData, err error)
- func (mg *Mongo) GetFunctionForExecution(dbName, name string) (result model.ExecData, err error)
- func (mg *Mongo) GetRootForBase(dbName string) (tok model.User, err error)
- func (mg *Mongo) GetTenantByStripeID(stripeID string) (cus model.Tenant, err error)
- func (mg *Mongo) GetUserByID(dbName, accountID, userID string) (user model.User, err error)
- func (mg *Mongo) IncrementMonthlyEmailSent(baseID string) error
- func (mg *Mongo) IncrementValue(auth model.Auth, dbName, col, id, field string, n int) error
- func (mg *Mongo) ListAccounts(dbName string) ([]model.Account, error)
- func (mg *Mongo) ListAllFiles(dbName, accountID string) ([]model.File, error)
- func (mg *Mongo) ListCollections(dbName string) ([]string, error)
- func (mg *Mongo) ListDatabases() (results []model.DatabaseConfig, err error)
- func (mg *Mongo) ListDocuments(auth model.Auth, dbName, col string, params model.ListParams) (model.PagedResult, error)
- func (mg *Mongo) ListFormSubmissions(dbName, name string) (results []map[string]interface{}, err error)
- func (mg *Mongo) ListFunctions(dbName string) (results []model.ExecData, err error)
- func (mg *Mongo) ListFunctionsByTrigger(dbName, trigger string) (results []model.ExecData, err error)
- func (mg *Mongo) ListTasks() ([]model.Task, error)
- func (mg *Mongo) ListTasksByBase(dbName string) ([]model.Task, error)
- func (mg *Mongo) ListUsers(dbName, accountID string) ([]model.User, error)
- func (mg *Mongo) NewID() string
- func (mg *Mongo) ParseQuery(clauses [][]interface{}) (map[string]interface{}, error)
- func (mg *Mongo) Ping() error
- func (mg *Mongo) QueryDocuments(auth model.Auth, dbName, col string, filter map[string]interface{}, ...) (model.PagedResult, error)
- func (mg *Mongo) RanFunction(dbName, id string, rh model.ExecHistory) error
- func (mg *Mongo) RemoveUser(auth model.Auth, dbName, userID string) error
- func (mg *Mongo) ResetPassword(dbName, email, code, password string) error
- func (mg *Mongo) SetPasswordResetCode(dbName, tokenID, code string) error
- func (mg *Mongo) SetUserRole(dbName, email string, role int) error
- func (mg *Mongo) UpdateDocument(auth model.Auth, dbName, col, id string, doc map[string]interface{}) (map[string]interface{}, error)
- func (mg *Mongo) UpdateDocuments(auth model.Auth, dbName, col string, filters map[string]interface{}, ...) (n int64, err error)
- func (mg *Mongo) UpdateFunction(dbName, id, code, trigger string) error
- func (mg *Mongo) UserEmailExists(dbName, email string) (exists bool, err error)
- func (mg *Mongo) UserSetPassword(dbName, tokenID, password string) error
Constants ¶
View Source
const ( FieldID = "_id" FieldAccountID = "accountId" FieldOwnerID = "sb_owner" FieldToken = "token" FieldIsActive = "active" FieldRole = "role" FieldFormName = "form" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LocalAccount ¶
type LocalCustomer ¶
type LocalCustomer struct { ID primitive.ObjectID `bson:"_id" json:"id"` Email string `bson:"email" json:"email"` StripeID string `bson:"stripeId" json:"stripeId"` SubscriptionID string `bson:"subId" json:"subId"` Plan int `bson:"plan" json:"plan"` ExternalLogins []byte `bson:"et" json:"-"` IsActive bool `bson:"active" json:"-"` Created time.Time `bson:"created" json:"created"` }
type LocalExecData ¶
type LocalExecData struct { ID primitive.ObjectID `bson:"_id" json:"id"` FunctionName string `bson:"name" json:"name"` TriggerTopic string `bson:"tr" json:"trigger"` Code string `bson:"code" json:"code"` Version int `bson:"v" json:"version"` LastUpdated time.Time `bson:"lu" json:"lastUpdated"` LastRun time.Time `bson:"lr" json:"lastRun"` History []LocalExecHistory `bson:"h" json:"history"` }
type LocalExecHistory ¶
type LocalMetaMessage ¶
type LocalTask ¶
type LocalTask struct { ID primitive.ObjectID `bson:"_id" json:"id"` Name string `bson:"name" json:"name"` Type string `bson:"type" json:"type"` Value string `bson:"value" json:"value"` Meta string `bson:"meta" json:"meta"` Interval string `bson:"invertal" json:"interval"` LastRun time.Time `bson:"last" json:"last"` BaseName string `bson:"-" json:"base"` }
type LocalToken ¶
type LocalToken struct { ID primitive.ObjectID `bson:"_id" json:"id"` AccountID primitive.ObjectID `bson:"accountId" json:"accountId"` Token string `bson:"token" json:"token"` Email string `bson:"email" json:"email"` Password string `bson:"pw" json:"-"` Role int `bson:"role" json:"role"` ResetCode string `bson:"resetCode" json:"-"` Created time.Time `bson:"created" json:"created"` }
type Mongo ¶
type Mongo struct { Client *mongo.Client Ctx context.Context PublishDocument cache.PublishDocumentEvent // contains filtered or unexported fields }
func (*Mongo) ActivateTenant ¶ added in v1.4.1
func (*Mongo) AddFormSubmission ¶
func (*Mongo) AddFunction ¶
func (*Mongo) BulkCreateDocument ¶
func (*Mongo) ChangeTenantPlan ¶ added in v1.4.1
func (*Mongo) CreateAccount ¶ added in v1.4.1
func (*Mongo) CreateDatabase ¶ added in v1.4.1
func (mg *Mongo) CreateDatabase(base model.DatabaseConfig) (model.DatabaseConfig, error)
func (*Mongo) CreateDocument ¶
func (*Mongo) CreateIndex ¶ added in v1.3.0
func (*Mongo) CreateTenant ¶ added in v1.4.1
func (*Mongo) CreateUser ¶ added in v1.4.1
func (*Mongo) DeleteDocument ¶
func (*Mongo) DeleteDocuments ¶ added in v1.5.0
func (*Mongo) DeleteFile ¶
func (*Mongo) DeleteFunction ¶
func (*Mongo) DeleteTask ¶ added in v1.5.0
func (*Mongo) DeleteTenant ¶ added in v1.4.1
func (*Mongo) EnableExternalLogin ¶ added in v1.4.0
func (*Mongo) FindDatabase ¶
func (mg *Mongo) FindDatabase(baseID string) (conf model.DatabaseConfig, err error)
func (*Mongo) FindRootUser ¶ added in v1.4.1
func (*Mongo) FindTenant ¶ added in v1.4.1
func (*Mongo) FindUserByEmail ¶ added in v1.4.1
func (*Mongo) GetDocumentByID ¶
func (*Mongo) GetDocumentsByIDs ¶ added in v1.4.2
func (*Mongo) GetFileByID ¶
func (*Mongo) GetFirstUserFromAccountID ¶ added in v1.4.1
func (*Mongo) GetFunctionByID ¶
func (*Mongo) GetFunctionByName ¶
func (*Mongo) GetFunctionForExecution ¶
func (*Mongo) GetRootForBase ¶
func (*Mongo) GetTenantByStripeID ¶ added in v1.4.1
func (*Mongo) GetUserByID ¶ added in v1.5.0
func (*Mongo) IncrementMonthlyEmailSent ¶
func (*Mongo) IncrementValue ¶
func (*Mongo) ListAccounts ¶ added in v1.5.0
func (*Mongo) ListAllFiles ¶ added in v1.4.0
func (*Mongo) ListDatabases ¶
func (mg *Mongo) ListDatabases() (results []model.DatabaseConfig, err error)
func (*Mongo) ListDocuments ¶
func (mg *Mongo) ListDocuments(auth model.Auth, dbName, col string, params model.ListParams) (model.PagedResult, error)
func (*Mongo) ListFormSubmissions ¶
func (*Mongo) ListFunctions ¶
func (*Mongo) ListFunctionsByTrigger ¶
func (*Mongo) ListTasksByBase ¶ added in v1.5.0
func (*Mongo) ParseQuery ¶
func (*Mongo) QueryDocuments ¶
func (mg *Mongo) QueryDocuments(auth model.Auth, dbName, col string, filter map[string]interface{}, params model.ListParams) (model.PagedResult, error)
func (*Mongo) RanFunction ¶
func (mg *Mongo) RanFunction(dbName, id string, rh model.ExecHistory) error
func (*Mongo) RemoveUser ¶ added in v1.5.0
func (*Mongo) ResetPassword ¶
func (*Mongo) SetPasswordResetCode ¶
func (*Mongo) UpdateDocument ¶
func (*Mongo) UpdateDocuments ¶ added in v1.4.0
func (*Mongo) UpdateFunction ¶
func (*Mongo) UserEmailExists ¶
func (*Mongo) UserSetPassword ¶
Click to show internal directories.
Click to hide internal directories.