badger

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerDriver

type BadgerDriver struct {
	DB               *badger.DB
	DriverCredential *models.DriverCredentials
}

func GetBadgerDriver

func GetBadgerDriver(driverCredentials *models.DriverCredentials) (*BadgerDriver, error)

GetBadgerDriver creates a new BadgerDB project driver instance

func (*BadgerDriver) AddCollection

func (b *BadgerDriver) AddCollection(ctx context.Context, param *models.CommonSystemParams) error

AddCollection adds a new collection to the project

func (*BadgerDriver) AddDocumentToProject

func (b *BadgerDriver) AddDocumentToProject(ctx context.Context, param *models.CommonSystemParams, doc *types.DefaultDocumentStructure) (interface{}, error)

AddDocumentToProject adds a new document to the project

func (*BadgerDriver) AddFieldToModel

func (b *BadgerDriver) AddFieldToModel(ctx context.Context, param *models.CommonSystemParams, isUpdate bool, parent_field string) (*models.ModelType, error)

AddFieldToModel adds a new field to an existing model in the project

func (*BadgerDriver) AddModel

func (b *BadgerDriver) AddModel(ctx context.Context, project *models.Project, model *models.ModelType) (*models.ProjectSchema, error)

AddModel adds a new model to the project

func (*BadgerDriver) AddRelationFields

func (b *BadgerDriver) AddRelationFields(ctx context.Context, param *models.CommonSystemParams, sourceModel, targetModel, relationType string) error

AddRelationFields adds relation fields to a model (no-op for BadgerDB)

func (*BadgerDriver) AddTeamMetaInfo

AddTeamMetaInfo adds team meta info to a document

func (*BadgerDriver) AggregateDocOfProject

func (b *BadgerDriver) AggregateDocOfProject(ctx context.Context, param *models.CommonSystemParams, pipeline interface{}) (interface{}, error)

AggregateDocOfProject performs aggregation on documents

func (*BadgerDriver) AggregateDocOfProjectBytes

func (b *BadgerDriver) AggregateDocOfProjectBytes(ctx context.Context, param *models.CommonSystemParams, pipeline interface{}) ([]byte, error)

AggregateDocOfProjectBytes performs aggregation on documents (bytes version)

func (*BadgerDriver) CheckCollectionExists

func (b *BadgerDriver) CheckCollectionExists(ctx context.Context, param *models.CommonSystemParams, isRelationCollection bool) (bool, error)

CheckCollectionExists checks if a collection exists in the project

func (*BadgerDriver) CheckOneToOneRelationExists

func (b *BadgerDriver) CheckOneToOneRelationExists(ctx context.Context, param *models.CommonSystemParams, fromId, toId, relationName string) (bool, error)

CheckOneToOneRelationExists checks if a one-to-one relation already exists

func (*BadgerDriver) Close

func (b *BadgerDriver) Close() error

Close closes the BadgerDB database connection

func (*BadgerDriver) ConnectBuilder

func (b *BadgerDriver) ConnectBuilder(ctx context.Context, projectId, userId string) error

ConnectBuilder connects a builder to the project

func (*BadgerDriver) ConvertModel

func (b *BadgerDriver) ConvertModel(ctx context.Context, project *models.Project, modelName string) error

ConvertModel converts a model in the project (no-op for BadgerDB)

func (*BadgerDriver) CountDocOfProject

func (b *BadgerDriver) CountDocOfProject(ctx context.Context, param *models.CommonSystemParams) (int, error)

CountDocOfProject counts documents in a project

func (*BadgerDriver) CountDocOfProjectBytes

func (b *BadgerDriver) CountDocOfProjectBytes(ctx context.Context, param *models.CommonSystemParams) (int, error)

CountDocOfProjectBytes counts documents in a project (bytes version)

func (*BadgerDriver) CountMultiDocumentOfProject

func (b *BadgerDriver) CountMultiDocumentOfProject(ctx context.Context, param *models.CommonSystemParams, condition map[string]interface{}) (int, error)

CountMultiDocumentOfProject counts multiple documents with filters

func (*BadgerDriver) CreateIndex

func (b *BadgerDriver) CreateIndex(ctx context.Context, param *models.CommonSystemParams, fieldName string, parent_field string) error

CreateIndex creates an index for a model in the project (no-op for BadgerDB)

func (*BadgerDriver) CreateRelation

CreateRelation creates a new relation between documents

func (*BadgerDriver) DeleteDocumentFromProject

func (b *BadgerDriver) DeleteDocumentFromProject(ctx context.Context, param *models.CommonSystemParams) error

DeleteDocumentFromProject deletes a document from the project

func (*BadgerDriver) DeleteDocumentRelation

func (b *BadgerDriver) DeleteDocumentRelation(ctx context.Context, param *models.CommonSystemParams) error

DeleteDocumentRelation deletes all relations or data in pivot tables from the project

func (*BadgerDriver) DeleteDocumentsFromProject

func (b *BadgerDriver) DeleteDocumentsFromProject(ctx context.Context, param *models.CommonSystemParams) error

DeleteDocumentsFromProject deletes multiple documents from the project

func (*BadgerDriver) DeleteMediaFile

func (b *BadgerDriver) DeleteMediaFile(ctx context.Context, param *models.CommonSystemParams) error

DeleteMediaFile deletes a media file document

func (*BadgerDriver) DeleteProject

func (b *BadgerDriver) DeleteProject(ctx context.Context, projectID string) error

DeleteProject deletes a project and all related data

func (*BadgerDriver) DeleteRelation

func (b *BadgerDriver) DeleteRelation(ctx context.Context, param *models.CommonSystemParams, relationID string) error

DeleteRelation deletes a specific relation

func (*BadgerDriver) DeleteRelationDocuments

func (b *BadgerDriver) DeleteRelationDocuments(ctx context.Context, param *models.CommonSystemParams, relationshipName string) error

DeleteRelationDocuments deletes relation documents for a specific relation

func (*BadgerDriver) DisconnectBuilder

func (b *BadgerDriver) DisconnectBuilder(ctx context.Context, projectId, userId string) error

DisconnectBuilder disconnects a builder from the project

func (*BadgerDriver) DropField

func (b *BadgerDriver) DropField(ctx context.Context, param *models.CommonSystemParams, fieldName string) error

DropField drops a field from all documents in a collection

func (*BadgerDriver) DropIndex

func (b *BadgerDriver) DropIndex(ctx context.Context, param *models.CommonSystemParams, indexName string) error

DropIndex drops an index from a model in the project (no-op for BadgerDB)

func (*BadgerDriver) DropModel

func (b *BadgerDriver) DropModel(ctx context.Context, project *models.Project, modelName string) error

DropModel drops a model from the project

func (*BadgerDriver) DuplicateModel

func (b *BadgerDriver) DuplicateModel(ctx context.Context, param *models.CommonSystemParams, newModelName string) error

DuplicateModel duplicates a model by copying all its documents

func (*BadgerDriver) GetAllRelationDocumentsOfSingleDocument

func (b *BadgerDriver) GetAllRelationDocumentsOfSingleDocument(ctx context.Context, param *models.CommonSystemParams, documentID string) ([]*types.DefaultDocumentStructure, error)

GetAllRelationDocumentsOfSingleDocument gets all relation documents for a single document

func (*BadgerDriver) GetLoggedInProjectUser

func (b *BadgerDriver) GetLoggedInProjectUser(ctx context.Context, projectId, userId string) (*types.DefaultDocumentStructure, error)

GetLoggedInProjectUser gets a logged-in project user by user ID

func (*BadgerDriver) GetProjectUser

func (b *BadgerDriver) GetProjectUser(ctx context.Context, projectId, email, phone string) (*types.DefaultDocumentStructure, error)

GetProjectUser gets a project user by email or phone

func (*BadgerDriver) GetProjectUsers

func (b *BadgerDriver) GetProjectUsers(ctx context.Context, projectId string, userIds []string) ([]*types.DefaultDocumentStructure, error)

GetProjectUsers gets project users by their IDs

func (*BadgerDriver) GetRelationDocument

GetRelationDocument retrieves a relation document

func (*BadgerDriver) GetRelationIds

func (b *BadgerDriver) GetRelationIds(ctx context.Context, param *models.CommonSystemParams, documentID, relationName string) ([]string, error)

GetRelationIds gets relation IDs for a document

func (*BadgerDriver) GetSingleProjectDocument

func (b *BadgerDriver) GetSingleProjectDocument(ctx context.Context, param *models.CommonSystemParams) (*types.DefaultDocumentStructure, error)

GetSingleProjectDocument retrieves a single document by its ID

func (*BadgerDriver) GetSingleProjectDocumentBytes

func (b *BadgerDriver) GetSingleProjectDocumentBytes(ctx context.Context, param *models.CommonSystemParams) ([]byte, error)

GetSingleProjectDocumentBytes retrieves a single document as bytes

func (*BadgerDriver) GetSingleProjectDocumentRevisions

func (b *BadgerDriver) GetSingleProjectDocumentRevisions(ctx context.Context, param *models.CommonSystemParams) ([]*types.DefaultDocumentStructure, error)

GetSingleProjectDocumentRevisions retrieves document revisions

func (*BadgerDriver) GetSingleRawDocumentFromProject

func (b *BadgerDriver) GetSingleRawDocumentFromProject(ctx context.Context, param *models.CommonSystemParams) (interface{}, error)

GetSingleRawDocumentFromProject retrieves a raw document

func (*BadgerDriver) NewInsertableRelations

func (b *BadgerDriver) NewInsertableRelations(ctx context.Context, param *models.CommonSystemParams, relations []*types.DefaultDocumentStructure) ([]*types.DefaultDocumentStructure, error)

NewInsertableRelations creates new insertable relations

func (*BadgerDriver) QueryMultiDocumentOfProject

func (b *BadgerDriver) QueryMultiDocumentOfProject(ctx context.Context, param *models.CommonSystemParams) ([]*types.DefaultDocumentStructure, error)

QueryMultiDocumentOfProject retrieves multiple documents from a project

func (*BadgerDriver) QueryMultiDocumentOfProjectBytes

func (b *BadgerDriver) QueryMultiDocumentOfProjectBytes(ctx context.Context, param *models.CommonSystemParams) ([]byte, error)

QueryMultiDocumentOfProjectBytes retrieves multiple documents as bytes

func (*BadgerDriver) RelationshipDataLoader

func (b *BadgerDriver) RelationshipDataLoader(ctx context.Context, param *models.CommonSystemParams, ids []string) ([]*types.DefaultDocumentStructure, error)

RelationshipDataLoader loads relationship data

func (*BadgerDriver) RelationshipDataLoaderBytes

func (b *BadgerDriver) RelationshipDataLoaderBytes(ctx context.Context, param *models.CommonSystemParams, ids []string) ([][]byte, error)

RelationshipDataLoaderBytes loads relationship data as bytes

func (*BadgerDriver) RenameField

func (b *BadgerDriver) RenameField(ctx context.Context, param *models.CommonSystemParams, oldFieldName, newFieldName string) error

RenameField renames a field in all documents in a collection

func (*BadgerDriver) RenameModel

func (b *BadgerDriver) RenameModel(ctx context.Context, project *models.Project, modelName, newName string) error

RenameModel renames a model in the project

func (*BadgerDriver) TransferProject

func (b *BadgerDriver) TransferProject(ctx context.Context, userId, from, to string) error

TransferProject transfers a project from one user to another

func (*BadgerDriver) UpdateDocumentOfProject

func (b *BadgerDriver) UpdateDocumentOfProject(ctx context.Context, param *models.CommonSystemParams, doc *types.DefaultDocumentStructure, replace bool) error

UpdateDocumentOfProject updates a particular document in the project

Jump to

Keyboard shortcuts

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