Documentation
¶
Index ¶
- Constants
- func New(client *mongo.Client, pubdoc internal.PublishDocumentEvent) internal.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) ActivateCustomer(customerID string, active bool) error
- func (mg *Mongo) AddFile(dbName string, f internal.File) (id string, err error)
- func (mg *Mongo) AddFormSubmission(dbName, form string, doc map[string]interface{}) error
- func (mg *Mongo) AddFunction(dbName string, data internal.ExecData) (string, error)
- func (mg *Mongo) BulkCreateDocument(auth internal.Auth, dbName, col string, docs []interface{}) error
- func (mg *Mongo) ChangeCustomerPlan(customerID string, plan int) error
- func (mg *Mongo) CreateBase(base internal.BaseConfig) (internal.BaseConfig, error)
- func (mg *Mongo) CreateCustomer(customer internal.Customer) (internal.Customer, error)
- func (mg *Mongo) CreateDocument(auth internal.Auth, dbName, col string, doc map[string]interface{}) (map[string]interface{}, error)
- func (mg *Mongo) CreateIndex(dbName, col, field string) error
- func (mg *Mongo) CreateUserAccount(dbName, email string) (id string, err error)
- func (mg *Mongo) CreateUserToken(dbName string, tok internal.Token) (id string, err error)
- func (mg *Mongo) DatabaseExists(name string) (bool, error)
- func (mg *Mongo) DeleteCustomer(dbName, email string) error
- func (mg *Mongo) DeleteDocument(auth internal.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) EmailExists(email string) (bool, error)
- func (mg *Mongo) EnableExternalLogin(customerID string, config map[string]internal.OAuthConfig) error
- func (mg *Mongo) FindAccount(customerID string) (cus internal.Customer, err error)
- func (mg *Mongo) FindDatabase(baseID string) (conf internal.BaseConfig, err error)
- func (mg *Mongo) FindRootToken(dbName, tokenID, accountID, token string) (tok internal.Token, err error)
- func (mg *Mongo) FindToken(dbName, tokenID, token string) (tok internal.Token, err error)
- func (mg *Mongo) FindTokenByEmail(dbName, email string) (tok internal.Token, err error)
- func (mg *Mongo) GetCustomerByStripeID(stripeID string) (cus internal.Customer, err error)
- func (mg *Mongo) GetDocumentByID(auth internal.Auth, dbName, col, id string) (map[string]interface{}, error)
- func (mg *Mongo) GetFileByID(dbName, fileID string) (f internal.File, err error)
- func (mg *Mongo) GetFirstTokenFromAccountID(dbName, accountID string) (tok internal.Token, err error)
- func (mg *Mongo) GetForms(dbName string) ([]string, error)
- func (mg *Mongo) GetFunctionByID(dbName, id string) (result internal.ExecData, err error)
- func (mg *Mongo) GetFunctionByName(dbName, name string) (result internal.ExecData, err error)
- func (mg *Mongo) GetFunctionForExecution(dbName, name string) (result internal.ExecData, err error)
- func (mg *Mongo) GetRootForBase(dbName string) (tok internal.Token, err error)
- func (mg *Mongo) IncrementMonthlyEmailSent(baseID string) error
- func (mg *Mongo) IncrementValue(auth internal.Auth, dbName, col, id, field string, n int) error
- func (mg *Mongo) ListAllFiles(dbName, accountID string) ([]internal.File, error)
- func (mg *Mongo) ListCollections(dbName string) ([]string, error)
- func (mg *Mongo) ListDatabases() (results []internal.BaseConfig, err error)
- func (mg *Mongo) ListDocuments(auth internal.Auth, dbName, col string, params internal.ListParams) (internal.PagedResult, error)
- func (mg *Mongo) ListFormSubmissions(dbName, name string) (results []map[string]interface{}, err error)
- func (mg *Mongo) ListFunctions(dbName string) (results []internal.ExecData, err error)
- func (mg *Mongo) ListFunctionsByTrigger(dbName, trigger string) (results []internal.ExecData, err error)
- func (mg *Mongo) ListTasks() ([]internal.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 internal.Auth, dbName, col string, filter map[string]interface{}, ...) (internal.PagedResult, error)
- func (mg *Mongo) RanFunction(dbName, id string, rh internal.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 internal.Auth, dbName, col, id string, doc map[string]interface{}) (map[string]interface{}, error)
- func (mg *Mongo) UpdateDocuments(auth internal.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 internal.PublishDocumentEvent
}
func (*Mongo) ActivateCustomer ¶
func (*Mongo) AddFormSubmission ¶
func (*Mongo) AddFunction ¶
func (*Mongo) BulkCreateDocument ¶
func (*Mongo) ChangeCustomerPlan ¶ added in v1.4.0
func (*Mongo) CreateBase ¶
func (mg *Mongo) CreateBase(base internal.BaseConfig) (internal.BaseConfig, error)
func (*Mongo) CreateCustomer ¶
func (*Mongo) CreateDocument ¶
func (*Mongo) CreateIndex ¶ added in v1.3.0
func (*Mongo) CreateUserAccount ¶
func (*Mongo) CreateUserToken ¶
func (*Mongo) DeleteCustomer ¶
func (*Mongo) DeleteDocument ¶
func (*Mongo) DeleteFile ¶
func (*Mongo) DeleteFunction ¶
func (*Mongo) EnableExternalLogin ¶ added in v1.4.0
func (*Mongo) FindAccount ¶
func (*Mongo) FindDatabase ¶
func (mg *Mongo) FindDatabase(baseID string) (conf internal.BaseConfig, err error)
func (*Mongo) FindRootToken ¶
func (*Mongo) FindTokenByEmail ¶
func (*Mongo) GetCustomerByStripeID ¶
func (*Mongo) GetDocumentByID ¶
func (*Mongo) GetFileByID ¶
func (*Mongo) GetFirstTokenFromAccountID ¶
func (*Mongo) GetFunctionByID ¶
func (*Mongo) GetFunctionByName ¶
func (*Mongo) GetFunctionForExecution ¶
func (*Mongo) GetRootForBase ¶
func (*Mongo) IncrementMonthlyEmailSent ¶
func (*Mongo) IncrementValue ¶
func (*Mongo) ListAllFiles ¶ added in v1.4.0
func (*Mongo) ListDatabases ¶
func (mg *Mongo) ListDatabases() (results []internal.BaseConfig, err error)
func (*Mongo) ListDocuments ¶
func (mg *Mongo) ListDocuments(auth internal.Auth, dbName, col string, params internal.ListParams) (internal.PagedResult, error)
func (*Mongo) ListFormSubmissions ¶
func (*Mongo) ListFunctions ¶
func (*Mongo) ListFunctionsByTrigger ¶
func (*Mongo) ParseQuery ¶
func (*Mongo) QueryDocuments ¶
func (mg *Mongo) QueryDocuments(auth internal.Auth, dbName, col string, filter map[string]interface{}, params internal.ListParams) (internal.PagedResult, error)
func (*Mongo) RanFunction ¶
func (mg *Mongo) RanFunction(dbName, id string, rh internal.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.