interfaces

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus interface {
	// Subscribe to the specified topic.
	Subscribe(topic string, cb func(data interface{}), options *QueueOptions) (func(), error)

	// Notify notifies the topic with the optional data
	Notify(topic string, data interface{}) error

	// DeleteQueue deletes a queue
	DeleteQueue(id string) error
}

Bus is an interface used for pub-sub like interactions

type CacheDBInterface

type CacheDBInterface interface {
	GetProject(ctx context.Context, projectId string) (*protobuff.Project, error)
	SaveProject(ctx context.Context, project *protobuff.Project) (*protobuff.Project, error)

	ListKeys(ctx context.Context) ([]string, error)

	PutAppCache(ctx context.Context, projectId string, cache *shared.ApplicationCache) error
	GetAppCache(ctx context.Context, projectId string) (*shared.ApplicationCache, error)
	Expire(ctx context.Context, id string) error

	Put(ctx context.Context, id string, cache interface{}) error
	Get(ctx context.Context, id string) (interface{}, error)
}

type FunctionPluginInterface

type FunctionPluginInterface interface {
	// Init This functions runs when any extension runs
	Init(env []*extensions.EnvVariables) error

	// Migration If your extension has any migration script you can put it here
	Migration() error

	// SchemaRegister Define the GraphQL Schema That Will be Added If this extension registers
	SchemaRegister() (*extensions.ThirdPartyGraphQLSchemas, error)

	// RESTApiRegister Define the REST api that will be added to the existing list
	RESTApiRegister() ([]*extensions.ThirdPartyRESTApi, error)

	// Execute calls when the function is called
	Execute(request interface{}) (interface{}, error)

	// ListFunctions list all the files that this plugin is serving
	ListFunctions(filter interface{}) ([]*extensions.CloudFunction, error)

	// RemoveFunction delete a single file
	RemoveFunction(id string) error
}

FunctionPluginInterface interface functions

type GraphQLExecutorInterface

type GraphQLExecutorInterface interface {
	Init(ctx context.Context, _driver *protobuff.InitParams) error

	GetExecutorVersion(ctx context.Context) (string, error)

	SetApplicationCache(ctx context.Context, cache *shared.ApplicationCache)
	GetApplicationCache(ctx context.Context) *shared.ApplicationCache

	GetProjectDriver(ctx context.Context) ProjectDBInterface
	SetProjectDriver(ctx context.Context, driver ProjectDBInterface)

	GetDataloaders(ctx context.Context) *shared.DataLoaders
	DataLoaderHandlr(ctx context.Context, keys []string) []*dataloader.Result[interface{}]

	SolvePublicQuery(ctx context.Context, model string, _args interface{}, selectionSet *ast.SelectionSet, cache *shared.ApplicationCache) ([]byte, error)
	SolvePublicQueryCount(ctx context.Context, model string, _args interface{}, cache *shared.ApplicationCache) ([]byte, error)
	SolvePublicMutation(ctx context.Context, resolverName string, _id *string, _ids []*string, status *string, local *string, userInputPayload interface{}, connect interface{}, disconnect interface{}, cache *shared.ApplicationCache) ([]byte, error)

	ConnectDisconnectParamBuilder(ctx context.Context, schema *protobuff.ProjectSchema, uid string, collectionName string, connectionIds map[string]interface{}, modelType *protobuff.ModelType) ([]*shared.ConnectDisconnectParam, error)
	HandlePayloadFormatting(ctx context.Context, param *shared.CommonSystemParams, isFaker bool, local string, fields []*protobuff.FieldInfo, inputPayload map[string]interface{}, dbPayload map[string]interface{}) (map[string]interface{}, error)
}

type KeyValueServiceInterface

type KeyValueServiceInterface interface {
	// AddToSortedSets adds a key to a sorted set with a given TTL (Time To Live) in seconds.
	AddToSortedSets(ctx context.Context, setName string, key string, exp time.Duration) error

	// GetFromSortedSets retrieves a key from a sorted set.
	GetFromSortedSets(ctx context.Context, setName string, key string) (float64, error)

	// SetToHashMap sets a key-value pair in a hash.
	SetToHashMap(ctx context.Context, hash, key string, value string) error

	// GetFromHashMap retrieves a value from a hash using a key.
	GetFromHashMap(ctx context.Context, hash, key string) (string, error)

	// CheckKeyHashMap checks if a key exists in a hash.
	CheckKeyHashMap(ctx context.Context, hash, key string) bool

	// DelValue deletes a value using a key.
	DelValue(ctx context.Context, key string) error

	// SetValue sets a value with a key with a given expiration time.
	SetValue(ctx context.Context, key string, value string, expiration time.Duration) error

	// SetJSONObject sets a JSON object with a key with a given expiration time.
	SetJSONObject(ctx context.Context, key string, value interface{}, expiration time.Duration) error

	// GetJSONObject retrieves a JSON object using a key.
	GetJSONObject(ctx context.Context, key string) (interface{}, error)

	// CheckRedisKey checks if one or more keys exist.
	CheckRedisKey(ctx context.Context, keys ...string) (bool, error)

	// GetValue retrieves a value using a key.
	GetValue(ctx context.Context, key string) (string, error)

	// AddToSets adds a value to a set.
	AddToSets(ctx context.Context, key string, value string) error

	// RemoveSets removes a value from a set.
	RemoveSets(ctx context.Context, key string, value string) error
}

KeyValueServiceInterface is an interface that defines the methods for interacting with Redis.

type NormalPluginInterface

type NormalPluginInterface interface {
	// Init This functions runs when any extension runs
	Init(projectDB ProjectDBInterface, envs []*extensions.EnvVariables) error

	// Migration If your extension has any migration script you can put it here
	// You can use projectDB functions to run any migrations in project database like create table or add data to a table
	Migration() error

	// SchemaRegister Define the GraphQL Schema That Will be Added If this extension registers
	SchemaRegister() (*extensions.ThirdPartyGraphQLSchemas, error)

	// RESTApiRegister Define the REST api that will be added to the existing list
	RESTApiRegister() ([]*extensions.ThirdPartyRESTApi, error)

	// Execute calls when the function is called
	Execute(request interface{}) (interface{}, error)
}

NormalPluginInterface interface functions

type ProjectDBInterface

type ProjectDBInterface interface {
	// RunMigration runs the migration for a specific project.
	RunMigration(ctx context.Context, projectId string) error

	// DeleteProject deletes a project from the database.
	DeleteProject(ctx context.Context, projectId string) error

	// CheckCollectionExists checks if a collection exists for a specific project.
	CheckCollectionExists(ctx context.Context, projectId string) (bool, error)

	// AddCollection adds a new collection to a project.
	AddCollection(ctx context.Context, projectName string) (*string, error)

	// TransferProject transfers a project from one user to another.
	TransferProject(ctx context.Context, userId, from, to string) error

	// AddModel adds a new model to a project.
	AddModel(ctx context.Context, project *protobuff.Project, name string, singleRecord bool) (*protobuff.ProjectSchema, error)

	// AddFieldToModel adds a new field to a model.
	AddFieldToModel(ctx context.Context, param shared.CommonSystemParams, isUpdate bool, repeatedGroupIdentifier *string) (*protobuff.ModelType, error)

	// AddRelationFields creates a relation field (has one or has many) between two models.
	AddRelationFields(ctx context.Context, from *protobuff.ConnectionType, to *protobuff.ConnectionType) error

	// DropConnections drops the connections between two models, including pivot tables, relation keys, and collection tables.
	// This operation is not reversible.
	DropConnections(ctx context.Context, projectId string, from *protobuff.ConnectionType, to *protobuff.ConnectionType) error

	// ConnectBuilder connects a builder to a project.
	ConnectBuilder(ctx context.Context, param shared.CommonSystemParams) error

	// DisconnectBuilder disconnects a builder from a project.
	DisconnectBuilder(ctx context.Context, param shared.CommonSystemParams) error

	// GetProjectUser retrieves the user profile for a specific project.
	GetProjectUser(ctx context.Context, phone, email, projectId string) (*shared.DefaultDocumentStructure, error)

	// GetLoggedInProjectUser retrieves the user profile for the logged-in user in a specific project.
	GetLoggedInProjectUser(ctx context.Context, param *shared.CommonSystemParams) (*shared.DefaultDocumentStructure, error)

	// GetProjectUsers retrieves the metadata for multiple users in a project.
	GetProjectUsers(ctx context.Context, projectId string, keys []string) (map[string]*shared.DefaultDocumentStructure, error)

	// GetAllRelationDocumentsOfSingleDocument retrieves all relation data of a single document by its ID.
	GetAllRelationDocumentsOfSingleDocument(ctx context.Context, from string, arg *shared.CommonSystemParams) (interface{}, error)

	// GetSingleProjectDocumentBytes retrieves the byte representation of a single project document by its ID.
	GetSingleProjectDocumentBytes(ctx context.Context, param shared.CommonSystemParams) ([]byte, error)

	// GetSingleProjectDocument retrieves a single project document by its ID.
	GetSingleProjectDocument(ctx context.Context, param shared.CommonSystemParams) (*shared.DefaultDocumentStructure, error)

	// GetSingleProjectDocumentRevisions retrieves the revision history of a single project document by its ID.
	GetSingleProjectDocumentRevisions(ctx context.Context, param shared.CommonSystemParams) ([]*shared.DocumentRevisionHistory, error)

	// GetSingleRawDocumentFromProject retrieves a single raw document from a project by its ID.
	GetSingleRawDocumentFromProject(ctx context.Context, param shared.CommonSystemParams) (interface{}, error)

	// QueryMultiDocumentOfProjectBytes queries multiple documents in a project and retrieves the byte representation of the result.
	QueryMultiDocumentOfProjectBytes(ctx context.Context, param shared.CommonSystemParams) ([]byte, error)

	// QueryMultiDocumentOfProject queries multiple documents in a project and retrieves the result as a list of DefaultDocumentStructure.
	QueryMultiDocumentOfProject(ctx context.Context, param shared.CommonSystemParams) ([]*shared.DefaultDocumentStructure, error)

	// CountMultiDocumentOfProject counts the number of documents in a project that match the given parameters.
	CountMultiDocumentOfProject(ctx context.Context, param shared.CommonSystemParams, previewModel bool) (int, error)

	// AddDocumentToProject adds a document to a project.
	AddDocumentToProject(ctx context.Context, projectId string, modelName string, doc *shared.DefaultDocumentStructure) (interface{}, error)

	// UpdateDocumentOfProject updates a specific document in a project.
	UpdateDocumentOfProject(ctx context.Context, param shared.CommonSystemParams, doc *shared.DefaultDocumentStructure, replace bool) error

	// DeleteDocumentFromProject deletes a specific document from a project.
	DeleteDocumentFromProject(ctx context.Context, param shared.CommonSystemParams) error

	// DeleteDocumentRelation deletes the relations or data in pivot tables associated with a document in a project.
	DeleteDocumentRelation(ctx context.Context, param shared.CommonSystemParams) error

	// DeleteDocumentsFromProject deletes multiple documents from a project.
	DeleteDocumentsFromProject(ctx context.Context, param shared.CommonSystemParams) error

	// CreateRelation creates a relation between two models in a project.
	CreateRelation(ctx context.Context, projectId string, relation *shared.EdgeRelation) error

	// DeleteRelation deletes a relation between two models in a project.
	DeleteRelation(ctx context.Context, param *shared.ConnectDisconnectParam, id string) error

	// NewInsertableRelations returns a list of insertable relations for a specific model in a project.
	NewInsertableRelations(ctx context.Context, param *shared.ConnectDisconnectParam) ([]string, error)

	// CheckOneToOneRelationExists checks if a one-to-one relation exists between two models in a project.
	CheckOneToOneRelationExists(ctx context.Context, param *shared.ConnectDisconnectParam) (bool, error)

	// GetRelationIds retrieves the IDs of all documents related to a specific document in a project.
	GetRelationIds(ctx context.Context, param *shared.ConnectDisconnectParam) ([]string, error)

	// RelationshipDataLoader loads relationship data for a specific document in a project.
	RelationshipDataLoader(ctx context.Context, param *shared.CommonSystemParams, connection map[string]interface{}) (interface{}, error)

	// RelationshipDataLoaderBytes loads relationship data for a specific document in a project and returns the byte representation of the result.
	RelationshipDataLoaderBytes(ctx context.Context, param *shared.CommonSystemParams, connection map[string]interface{}) ([]byte, error)

	// CountDocOfProject counts the number of documents in a project that match the given parameters.
	CountDocOfProject(ctx context.Context, param *shared.CommonSystemParams) (interface{}, error)

	// CountDocOfProjectBytes counts the number of documents in a project that match the given parameters and returns the byte representation of the result.
	CountDocOfProjectBytes(ctx context.Context, param *shared.CommonSystemParams) ([]byte, error)

	// DropField drops a field and its associated data from a project.
	DropField(ctx context.Context, param shared.CommonSystemParams) error

	// RenameField renames a field in a model along with its data key.
	RenameField(ctx context.Context, oldFieldName string, repeatedFieldGroup *string, param shared.CommonSystemParams) error

	// CreateTableOrCollection creates a table for a specific project.
	CreateTableOrCollection(ctx context.Context, name string, properties map[string]string) error

	// DropTableOrCollection drops a table for a specific project.
	DropTableOrCollection(ctx context.Context, name string) error

	// AddDataToTableOrCollection adds data to a specific project table.
	AddDataToTableOrCollection(ctx context.Context, table string, data map[string]interface{}) error

	// UpdateDataToTableOrCollection updates data in a specific project table.
	UpdateDataToTableOrCollection(ctx context.Context, table string, data map[string]interface{}) (interface{}, error)

	// DeleteDataFromTableOrCollection deletes data from a specific project table.
	DeleteDataFromTableOrCollection(ctx context.Context, table string, id string) error
}

ProjectDBInterface represents the interface for interacting with the project database.

type QueueOptions

type QueueOptions struct {
	Durable    bool
	AutoDelete bool
	Exclusive  bool
	NoWait     bool
}

type StoragePluginInterface

type StoragePluginInterface interface {
	// Init This functions runs when any extension runs
	Init(env []*extensions.EnvVariables) error

	// Migration If your extension has any migration script you can put it here
	Migration(ctx context.Context) error

	// SchemaRegister Define the GraphQL Schema That Will be Added If this extension registers
	SchemaRegister(ctx context.Context) (*extensions.ThirdPartyGraphQLSchemas, error)

	// RESTApiRegister Define the REST api that will be added to the existing list
	RESTApiRegister(ctx context.Context) ([]*extensions.ThirdPartyRESTApi, error)

	// UploadFile calls when the function is called
	UploadFile(ctx context.Context, file *extensions.FileDetails) (*extensions.FileDetails, error)

	// ListFiles list all the files that this plugin is serving
	ListFiles(ctx context.Context, filter map[string]interface{}) ([]*extensions.FileDetails, error)

	// CountFiles count files
	CountFiles(ctx context.Context, filter map[string]interface{}) (int64, error)

	// DeleteFile delete a single file
	DeleteFile(ctx context.Context, id string) error
}

StoragePluginInterface interface functions

type SystemDBInterface

type SystemDBInterface interface {

	// RunMigration runs the database migrations
	RunMigration(ctx context.Context) error

	// GetSystemUser retrieves a system user by their ID
	GetSystemUser(ctx context.Context, id string) (*protobuff.SystemUser, error)

	// GetSystemUserByUsername retrieves a system user by their username
	GetSystemUserByUsername(ctx context.Context, username string) (*protobuff.SystemUser, error)

	// UpdateSystemUser updates a system user's profile
	UpdateSystemUser(ctx context.Context, user *protobuff.SystemUser, replace bool) error

	// SearchResource searches for system users based on a filter
	SearchResource(ctx context.Context, param *shared.CommonSystemParams) (*shared.SearchResponse[any], error)

	// GetProject retrieves a project by its ID
	GetProject(ctx context.Context, id string) (*protobuff.Project, error)

	// ListFunctions lists all the cloud functions for a given project
	ListFunctions(ctx context.Context, param *shared.CommonSystemParams) (*shared.SearchResponse[protobuff.CloudFunction], error)

	// UpdateProject updates a project
	UpdateProject(ctx context.Context, project *protobuff.Project, replace bool) error

	// CheckTokenBlacklisted checks if a token is blacklisted
	CheckTokenBlacklisted(ctx context.Context, tokenId string) error

	// BlacklistAToken blacklists a token
	BlacklistAToken(ctx context.Context, token map[string]interface{}) error

	// DeleteProjectFromSystem deletes a project from the system
	DeleteProjectFromSystem(ctx context.Context, projectId string) error

	// SaveRawData saves raw data related to payments
	SaveRawData(ctx context.Context, collection string, data map[string]interface{}) error
}

SystemDBInterface is the main interface for the system database operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL