sql

package
v1.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilterSuffix = map[string]string{
	"eq":     "==",
	"ne":     "!=",
	"lt":     "<",
	"lte":    "<=",
	"gt":     ">",
	"gte":    ">=",
	"in":     "IN",
	"not_in": "NOT IN",
}

Functions

func BuildCombinedMetaQuery

func BuildCombinedMetaQuery(keys dataloader.Keys, param *QueryBuilderParam) ([]byte, error)

func BuildCombinedRelationQuery

func BuildCombinedRelationQuery(relationType string, parentModel string, arg *models.CommonSystemParams) (*string, *string, error)

func CommonDocTransformation

func CommonDocTransformation(model *models.ModelType, local string, result map[string]interface{}, classification *FieldClassification) (*types.DefaultDocumentStructure, error)

func ConditionBuilder

func ConditionBuilder(variable string, args map[string]interface{}, modelType *models.ModelType) (map[string][]string, error)

func FilterBuilder

func FilterBuilder(variable string, where map[string]interface{}, modelType *models.ModelType) ([]string, error)

func LimitBuilder

func LimitBuilder(param *graphql.ResolveParams) (int, int)

func MediaDocTransformation

func MediaDocTransformation(docType string, result map[string]interface{}) (*models.FileDetails, error)

func RootConnectionResolverQueryBuilder

func RootConnectionResolverQueryBuilder(param *models.CommonSystemParams) (string, error)

func RootResolverMediaQueryBuilder

func RootResolverMediaQueryBuilder(param *graphql.ResolveParams) (string, error)

func RootResolverQueryBuilder

func RootResolverQueryBuilder(param *models.CommonSystemParams, returnCount bool) (string, error)

func SelectBuilder

func SelectBuilder(mv string, local string, modelType *models.ModelType, returnCount bool) []string

Types

type FieldClassification

type FieldClassification struct {
	MultilineFields []string
	DoubleFields    []string
	PictureField    []string
	GalleryField    []string
	ListFields      []string
	RepeatedFields  map[string][]*models.FieldInfo
}

type Meta2

type Meta2 struct {
	ID    string `gorm:"primaryKey;column:id;not null"`
	DocID string `gorm:"column:doc_id;not null"`

	CreatedAt time.Time `gorm:"column:created_at;not null;default:current_date"`
	UpdatedAt time.Time `gorm:"column:updated_at;not null;default:current_date"`

	CreatedBy string `gorm:"column:created_by;not null"`

	UpdatedBy string `gorm:"column:updated_by;not null"`
	Status    string `gorm:"column:status;not null"`
}

type QueryBuilderParam

type QueryBuilderParam struct {
	CollectionName string
	RelationName   string
	Args           map[string]interface{}
	ParentModel    string
	ModelType      *models.ModelType
}

type SQLDriver

type SQLDriver struct {
	ORM              *bun.DB
	DriverCredential *models.DriverCredentials
}

func GetSQLDriver

func GetSQLDriver(driverCredentials *models.DriverCredentials) (*SQLDriver, error)

func (*SQLDriver) AddATeamMemberToProject

func (S *SQLDriver) AddATeamMemberToProject(ctx context.Context, req *models.TeamMemberAddRequest) error

func (*SQLDriver) AddAuthAddOns

func (S *SQLDriver) AddAuthAddOns(ctx context.Context, project *models.Project, auth map[string]interface{}) error

func (*SQLDriver) AddCollection

func (S *SQLDriver) AddCollection(ctx context.Context, param *models.CommonSystemParams, isRelationCollection bool) error

func (*SQLDriver) AddDocumentToProject

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

func (*SQLDriver) AddFieldToModel

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

func (*SQLDriver) AddModel

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

func (*SQLDriver) AddRelationFields

func (S *SQLDriver) AddRelationFields(ctx context.Context, from *models.ConnectionType, to *models.ConnectionType) error

func (*SQLDriver) AddRelationFields_AUTOGEN

func (s *SQLDriver) AddRelationFields_AUTOGEN(ctx context.Context, from *models.ConnectionType, to *models.ConnectionType) error

AddRelationFields creates a relation field (has one or has many) between models.

func (*SQLDriver) AddTeamMetaInfo

func (s *SQLDriver) AddTeamMetaInfo(ctx context.Context, docs []*models.SystemUser) ([]*models.SystemUser, error)

AddTeamMetaInfo adds metadata information for a team in the project.

func (*SQLDriver) AggregateDocOfProject

func (s *SQLDriver) AggregateDocOfProject(ctx context.Context, param *models.CommonSystemParams) (interface{}, error)

AggregateDocOfProject aggregates the documents in the project.

func (*SQLDriver) AggregateDocOfProjectBytes

func (s *SQLDriver) AggregateDocOfProjectBytes(ctx context.Context, param *models.CommonSystemParams) ([]byte, error)

AggregateDocOfProjectBytes aggregates the documents in the project and returns it as bytes.

func (*SQLDriver) BuildFieldClassification

func (S *SQLDriver) BuildFieldClassification(_fields []*models.FieldInfo) *FieldClassification

func (*SQLDriver) CheckCollectionExists

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

func (*SQLDriver) CheckOneToOneRelationExists

func (s *SQLDriver) CheckOneToOneRelationExists(ctx context.Context, param *models.ConnectDisconnectParam) (bool, error)

CheckOneToOneRelationExists checks if a one-to-one relation exists in the project.

func (*SQLDriver) CheckProjectExists

func (S *SQLDriver) CheckProjectExists(ctx context.Context, projectId string) (bool, error)

func (*SQLDriver) ConnectBuilder

func (S *SQLDriver) ConnectBuilder(ctx context.Context, param *models.CommonSystemParams) error

func (*SQLDriver) ConvertModel

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

ConvertModel converts a model in the project.

func (*SQLDriver) CountDocOfProject

func (S *SQLDriver) CountDocOfProject(ctx context.Context, param *models.CommonSystemParams) (interface{}, error)

func (*SQLDriver) CountDocOfProjectBytes

func (S *SQLDriver) CountDocOfProjectBytes(ctx context.Context, param *models.CommonSystemParams) ([]byte, error)

func (*SQLDriver) CountMedias

func (S *SQLDriver) CountMedias(ctx context.Context, projectId string, param *graphql.ResolveParams) (int, error)

func (*SQLDriver) CountMultiDocumentOfProject

func (f *SQLDriver) CountMultiDocumentOfProject(ctx context.Context, param *models.CommonSystemParams, previewMode bool) (int, error)

func (*SQLDriver) CreateIndex

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

CreateIndex creates an index for a model in the project.

func (*SQLDriver) CreateMediaDocument

func (S *SQLDriver) CreateMediaDocument(ctx context.Context, projectId string, media *models.FileDetails) (*models.FileDetails, error)

func (*SQLDriver) CreateRelation

func (s *SQLDriver) CreateRelation(ctx context.Context, projectId string, relation *models.EdgeRelation) error

CreateRelation creates a relation in the project.

func (*SQLDriver) DeleteDocumentFromProject

func (S *SQLDriver) DeleteDocumentFromProject(ctx context.Context, param *models.CommonSystemParams) error

func (*SQLDriver) DeleteDocumentRelation

func (s *SQLDriver) DeleteDocumentRelation(ctx context.Context, param *models.CommonSystemParams) error

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

func (*SQLDriver) DeleteDocumentsFromProject

func (s *SQLDriver) DeleteDocumentsFromProject(ctx context.Context, param *models.CommonSystemParams) error

DeleteDocumentsFromProject deletes multiple documents from the project.

func (*SQLDriver) DeleteMediaFile

func (s *SQLDriver) DeleteMediaFile(ctx context.Context, param models.CommonSystemParams) error

DeleteMediaFile deletes a media file from the project.

func (*SQLDriver) DeleteProject

func (S *SQLDriver) DeleteProject(ctx context.Context, projectId string) error

func (*SQLDriver) DeleteRelation

func (s *SQLDriver) DeleteRelation(ctx context.Context, param *models.ConnectDisconnectParam, id string) error

DeleteRelation deletes a relation in the project.

func (*SQLDriver) DeleteRelationDocuments

func (S *SQLDriver) DeleteRelationDocuments(ctx context.Context, projectId string, from *models.ConnectionType, to *models.ConnectionType) error

func (*SQLDriver) DeleteRelationDocuments_AUTOGEN

func (s *SQLDriver) DeleteRelationDocuments_AUTOGEN(ctx context.Context, projectId string, from *models.ConnectionType, to *models.ConnectionType) error

DeleteRelationDocuments drops pivot tables, relation keys, or collection tables and all documents within them.

func (*SQLDriver) DisconnectBuilder

func (S *SQLDriver) DisconnectBuilder(ctx context.Context, param *models.CommonSystemParams) error

func (*SQLDriver) DropField

func (S *SQLDriver) DropField(ctx context.Context, param *models.CommonSystemParams) error

func (*SQLDriver) DropIndex

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

DropIndex drops an index from a model in the project.

func (*SQLDriver) DropModel

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

DropModel drops a model from the project.

func (*SQLDriver) DuplicateModel

func (s *SQLDriver) DuplicateModel(ctx context.Context, project *models.Project, modelName, newName string) (*models.ProjectSchema, error)

DuplicateModel duplicates a model in the project.

func (*SQLDriver) GetAllRelationDocumentsOfSingleDocument

func (S *SQLDriver) GetAllRelationDocumentsOfSingleDocument(ctx context.Context, from string, arg *models.CommonSystemParams) (interface{}, error)

func (*SQLDriver) GetAllRelationDocumentsOfSingleDocument_AUTOGEN

func (s *SQLDriver) GetAllRelationDocumentsOfSingleDocument_AUTOGEN(ctx context.Context, from string, arg *models.CommonSystemParams) (interface{}, error)

GetAllRelationDocumentsOfSingleDocument retrieves all relation data of a single document by ID.

func (*SQLDriver) GetLoggedInProjectUser

func (s *SQLDriver) GetLoggedInProjectUser(ctx context.Context, param *models.CommonSystemParams) (*types.DefaultDocumentStructure, error)

GetLoggedInProjectUser retrieves the logged-in user profile for the project.

func (*SQLDriver) GetProjectUser

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

GetProjectUser retrieves a user profile by phone, email, and project ID.

func (*SQLDriver) GetProjectUsers

func (s *SQLDriver) GetProjectUsers(ctx context.Context, projectId string, keys []string) (map[string]*types.DefaultDocumentStructure, error)

GetProjectUsers retrieves metadata for multiple users in the project.

func (*SQLDriver) GetRelationDocument

func (s *SQLDriver) GetRelationDocument(ctx context.Context, param *models.ConnectDisconnectParam) (*models.EdgeRelation, error)

GetRelationDocument retrieves a relation document by ID.

func (*SQLDriver) GetRelationIds

func (s *SQLDriver) GetRelationIds(ctx context.Context, param *models.ConnectDisconnectParam) ([]string, error)

GetRelationIds retrieves the IDs of every document related to a document.

func (*SQLDriver) GetSingleProjectDocument

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

func (*SQLDriver) GetSingleProjectDocumentBytes

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

func (*SQLDriver) GetSingleProjectDocumentRevisions

func (s *SQLDriver) GetSingleProjectDocumentRevisions(ctx context.Context, param *models.CommonSystemParams) ([]*models.DocumentRevisionHistory, error)

GetSingleProjectDocumentRevisions retrieves the revision history of a single project document by ID.

func (*SQLDriver) GetSingleRawDocumentFromProject

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

func (*SQLDriver) ListMedias

func (S *SQLDriver) ListMedias(ctx context.Context, projectId string, param *graphql.ResolveParams) ([]*models.FileDetails, error)

func (*SQLDriver) NewInsertableRelations

func (s *SQLDriver) NewInsertableRelations(ctx context.Context, param *models.ConnectDisconnectParam) ([]string, error)

NewInsertableRelations retrieves new insertable relations in the project.

func (*SQLDriver) Ping added in v1.1.4

func (p *SQLDriver) Ping() error

func (*SQLDriver) QueryMultiDocumentOfProject

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

func (*SQLDriver) QueryMultiDocumentOfProjectBytes

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

func (*SQLDriver) RelationshipDataLoader

func (S *SQLDriver) RelationshipDataLoader(ctx context.Context, param *models.CommonSystemParams, connection map[string]interface{}) (interface{}, error)

func (*SQLDriver) RelationshipDataLoaderBytes

func (S *SQLDriver) RelationshipDataLoaderBytes(ctx context.Context, param *models.CommonSystemParams, connection map[string]interface{}) ([]byte, error)

func (*SQLDriver) RemoveATeamMemberFromProject

func (S *SQLDriver) RemoveATeamMemberFromProject(ctx context.Context, projectId string, memberId string) error

func (*SQLDriver) RemoveAuthAddOns

func (a *SQLDriver) RemoveAuthAddOns(ctx context.Context, project *models.Project, option map[string]interface{}) error

func (*SQLDriver) RenameField

func (s *SQLDriver) RenameField(ctx context.Context, oldFieldName string, repeatedFieldGroup string, param *models.CommonSystemParams) error

RenameField renames a field in a model along with its data key.

func (*SQLDriver) RenameModel

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

RenameModel renames a model in the project.

func (*SQLDriver) TransferProject

func (S *SQLDriver) TransferProject(ctx context.Context, userId, from, to string) error

func (*SQLDriver) UpdateDocumentOfProject

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

Jump to

Keyboard shortcuts

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