Documentation ¶
Index ¶
- type Datastore
- type MockProjectAPIKeysDatastore
- func (m *MockProjectAPIKeysDatastore) CreateAPIKey(projectID, hash, description string, read, write bool, role string) (*models.ProjectAPIKey, error)
- func (m *MockProjectAPIKeysDatastore) DeleteAPIKey(projectID, keyID string) error
- func (m *MockProjectAPIKeysDatastore) DropProjectKeys(projectID string) error
- func (m *MockProjectAPIKeysDatastore) GetAPIKeyByKey(projectID, hash string) (*models.ProjectAPIKey, error)
- func (m *MockProjectAPIKeysDatastore) ListAPIKeys(projectID string) ([]*models.ProjectAPIKey, error)
- func (m *MockProjectAPIKeysDatastore) UpdateAPIKey(projectID, keyID string, read, write bool, role string) error
- type ProjectAPIKeysDatastore
- type ProjectHooksDatastore
- type ProjectJSONDatastore
- type ProjectLogsDatastore
- type ProjectSessionsDatastore
- type ProjectUsersDatastore
- type ProjectsDatastore
- type ResourcesDatastore
- type SessionsDatastore
- type TiersDatastore
- type UsersDatastore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Datastore ¶
type Datastore interface { // Project resources/definitions ResourcesDatastore // JSON Key/val ProjectJSONDatastore // Project users ProjectUsersDatastore // Project apikeys ProjectAPIKeysDatastore // Project logs ProjectLogsDatastore // Project sessions ProjectSessionsDatastore // Project WebHooks ProjectHooksDatastore // Projects ProjectsDatastore // Users UsersDatastore // Sessions SessionsDatastore // Tiers TiersDatastore // Errors TranslateError(err error) *models.TranslatedError }
Datastore exposes the necessary functions to interact with the Machinable datastore. Functions are grouped logically based on their purpose and the collections they interact with. implemented connectors: MongoDB potential connectors: InfluxDB, Postgres JSON, Redis, CouchDB, etc.
type MockProjectAPIKeysDatastore ¶
type MockProjectAPIKeysDatastore struct { GetAPIKeyByKeyFunc func(projectID, hash string) (*models.ProjectAPIKey, error) CreateAPIKeyFunc func(projectID, hash, description string, read, write bool, role string) (*models.ProjectAPIKey, error) UpdateAPIKeyFunc func(projectID, keyID string, read, write bool, role string) error ListAPIKeysFunc func(projectID string) ([]*models.ProjectAPIKey, error) DeleteAPIKeyFunc func(projectID, keyID string) error DropProjectKeysFunc func(projectID string) error }
MockProjectAPIKeysDatastore mocks the datastore functions for ProjectAPIKeysDatastore testing
func (*MockProjectAPIKeysDatastore) CreateAPIKey ¶
func (m *MockProjectAPIKeysDatastore) CreateAPIKey(projectID, hash, description string, read, write bool, role string) (*models.ProjectAPIKey, error)
CreateAPIKey mock function, calls field if not nil
func (*MockProjectAPIKeysDatastore) DeleteAPIKey ¶
func (m *MockProjectAPIKeysDatastore) DeleteAPIKey(projectID, keyID string) error
DeleteAPIKey mock function, calls field if not nil
func (*MockProjectAPIKeysDatastore) DropProjectKeys ¶
func (m *MockProjectAPIKeysDatastore) DropProjectKeys(projectID string) error
DropProjectKeys mock function, calls field if not nil
func (*MockProjectAPIKeysDatastore) GetAPIKeyByKey ¶
func (m *MockProjectAPIKeysDatastore) GetAPIKeyByKey(projectID, hash string) (*models.ProjectAPIKey, error)
GetAPIKeyByKey mock function, calls field if not nil
func (*MockProjectAPIKeysDatastore) ListAPIKeys ¶
func (m *MockProjectAPIKeysDatastore) ListAPIKeys(projectID string) ([]*models.ProjectAPIKey, error)
ListAPIKeys mock function, calls field if not nil
func (*MockProjectAPIKeysDatastore) UpdateAPIKey ¶
func (m *MockProjectAPIKeysDatastore) UpdateAPIKey(projectID, keyID string, read, write bool, role string) error
UpdateAPIKey mock function, calls field if not nil
type ProjectAPIKeysDatastore ¶
type ProjectAPIKeysDatastore interface { GetAPIKeyByKey(projectID, hash string) (*models.ProjectAPIKey, error) CreateAPIKey(projectID, hash, description string, read, write bool, role string) (*models.ProjectAPIKey, error) UpdateAPIKey(projectID, keyID string, read, write bool, role string) error ListAPIKeys(projectID string) ([]*models.ProjectAPIKey, error) DeleteAPIKey(projectID, keyID string) error DropProjectKeys(projectID string) error }
ProjectAPIKeysDatastore exposes functions to manage project api keys
type ProjectHooksDatastore ¶
type ProjectHooksDatastore interface { AddHook(projectID string, hook *models.WebHook) *errors.DatastoreError ListHooks(projectID string) ([]*models.WebHook, *errors.DatastoreError) GetHook(projectID, hookID string) (*models.WebHook, *errors.DatastoreError) UpdateHook(projectID, hookID string, hook *models.WebHook) *errors.DatastoreError DeleteHook(projectID, hookID string) *errors.DatastoreError AddResult(result *models.HookResult) *errors.DatastoreError ListResults(projectID, hookID string) ([]*models.HookResult, *errors.DatastoreError) }
ProjectHooksDatastore defines the functions required to interact with the project web hooks datastore
type ProjectJSONDatastore ¶
type ProjectJSONDatastore interface { GetRootKey(projectID, rootKey string) (*models.RootKey, error) ListRootKeys(projectID string) ([]*models.RootKey, error) CreateRootKey(projectID, rootKey string, data []byte) error UpdateRootKey(projectID string, rootKey *models.RootKey) error DeleteRootKey(projectID, rootKey string) error GetJSONKey(projectID, rootKey string, keys ...string) ([]byte, error) CreateJSONKey(projectID, rootKey string, data []byte, keys ...string) error UpdateJSONKey(projectID, rootKey string, data []byte, keys ...string) error DeleteJSONKey(projectID, rootKey string, keys ...string) error }
ProjectJSONDatastore exposes functions to the project json trees
type ProjectLogsDatastore ¶
type ProjectLogsDatastore interface { AddProjectLog(projectID string, log *models.Log) error ListProjectLogs(projectID string, limit, offset int64, filter *models.Filters, sort map[string]int) ([]*models.Log, error) CountProjectLogs(projectID string, filter *models.Filters) (int64, error) DropProjectLogs(projectID string) error }
ProjectLogsDatastore exposes functions to the project access logs
type ProjectSessionsDatastore ¶
type ProjectSessionsDatastore interface { CreateSession(projectID string, session *models.Session) error UpdateProjectSessionLastAccessed(projectID, sessionID string, lastAccessed time.Time) error GetSession(projectID, sessionID string) (*models.Session, error) ListSessions(projectID string) ([]*models.Session, error) DeleteSession(projectID, sessionID string) error DropProjectSessions(projectID string) error }
ProjectSessionsDatastore exposes functions to manage project user sessions
type ProjectUsersDatastore ¶
type ProjectUsersDatastore interface { GetUserByUsername(projectID, userName string) (*models.ProjectUser, error) GetUserByID(projectID, userID string) (*models.ProjectUser, error) CreateUser(projectID string, user *models.ProjectUser) error UpdateUser(projectID, userID string, user *models.ProjectUser) error ListUsers(projectID string) ([]*models.ProjectUser, error) DeleteUser(projectID, userID string) error DropProjectUsers(projectID string) error }
ProjectUsersDatastore exposes functions to manage project users
type ProjectsDatastore ¶
type ProjectsDatastore interface { UpdateProject(projectID, userID string, project *models.Project) (*models.Project, error) UpdateProjectUserRegistration(projectID, userID string, registration bool) (*models.Project, error) CreateProject(userID, slug, name, description, icon string, authn bool, register bool) (*models.Project, error) ListUserProjects(projectID string) ([]*models.Project, error) GetProjectBySlug(slug string) (*models.Project, error) GetProjectDetailBySlug(slug string) (*models.ProjectDetail, error) GetProjectBySlugAndUserID(slug, userID string) (*models.Project, error) DeleteProject(projectID string) error }
ProjectsDatastore exposes functions for projects
type ResourcesDatastore ¶
type ResourcesDatastore interface { // Project resource definitions AddDefinition(projectID string, def *models.ResourceDefinition) (string, *errors.DatastoreError) UpdateDefinition(projectID, definitionID string, def *models.ResourceDefinition) *errors.DatastoreError ListDefinitions(projectID string) ([]*models.ResourceDefinition, *errors.DatastoreError) GetDefinition(projectID, definitionID string) (*models.ResourceDefinition, *errors.DatastoreError) GetResourceStats(projectID, pathName string) (*models.Stats, *errors.DatastoreError) GetDefinitionByPathName(projectID, pathName string) (*models.ResourceDefinition, *errors.DatastoreError) DeleteDefinition(projectID, definitionID string) *errors.DatastoreError DropProjectResources(projectID string) *errors.DatastoreError // Project definition documents AddDefDocument(projectID, path string, fields models.ResourceObject, metadata *models.MetaData) (string, *errors.DatastoreError) UpdateDefDocument(projectID, path, documentID string, updatedFields models.ResourceObject, filter map[string]interface{}) (*models.ResourceObject, *errors.DatastoreError) ListDefDocuments(projectID, path string, limit, offset int64, filter map[string]interface{}, sort map[string]int, relations map[string]string) ([]map[string]interface{}, *errors.DatastoreError) GetDefDocument(projectID, path, documentID string, filter map[string]interface{}, relations map[string]string) (map[string]interface{}, *errors.DatastoreError) CountDefDocuments(projectID, path string, filter map[string]interface{}) (int64, *errors.DatastoreError) DeleteDefDocument(projectID, path, documentID string, filter map[string]interface{}) *errors.DatastoreError DropDefDocuments(projectID, path string) *errors.DatastoreError DropProjectDefDocuments(projectID string) *errors.DatastoreError }
ResourcesDatastore exposes functions to the resources and definitions
type SessionsDatastore ¶
type SessionsDatastore interface { CreateAppSession(session *models.Session) error UpdateAppSessionLastAccessed(sessionID string, lastAccessed time.Time) error ListUserSessions(userID string) ([]*models.Session, error) GetAppSession(sessionID string) (*models.Session, error) DeleteAppSession(sessionID string) error }
SessionsDatastore exposes functions to manage application user sessions
type TiersDatastore ¶
TiersDatastore exposes functions for app tiers
type UsersDatastore ¶
type UsersDatastore interface { GetAppUserByUsername(userName string) (*models.User, error) GetAppUserByID(id string) (*models.User, error) CreateAppUser(user *models.User) error UpdateUserPassword(userID, passwordHash string) error ActivateUser(userID string, active bool) error }
UsersDatastore exposes functions to manage application users