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) 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) DeleteFile(dbName, fileID string) error
- func (mg *Mongo) DeleteFunction(dbName, name 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) IncrementMonthlyEmailSent(baseID string) error
- func (mg *Mongo) IncrementValue(auth model.Auth, dbName, col, id, field string, n int) 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) 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) 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 interface{} `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) DeleteFile ¶
func (*Mongo) DeleteFunction ¶
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) IncrementMonthlyEmailSent ¶
func (*Mongo) IncrementValue ¶
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) 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) 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.