sql

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: AGPL-3.0 Imports: 31 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 *shared.CommonSystemParams) (*string, *string, error)

func CommonDocTransformation

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

func ConditionBuilder

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

func FilterBuilder

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

func LimitBuilder

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

func MediaDocTransformation

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

func RootConnectionResolverQueryBuilder

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

func RootResolverMediaQueryBuilder

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

func RootResolverQueryBuilder

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

func SelectBuilder

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

Types

type FieldClassification

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

type Meta

type Meta struct {
	ID    string `bun:",pk,type:varchar(36),notnull" json:"id"`
	DocID string `bun:",notnull" json:"doc_id"`

	CreatedAt time.Time `bun:",notnull,default:current_date" json:"created_at"`
	UpdatedAt time.Time `bun:",notnull,default:current_date" json:"updated_at"`

	CreatedBy string `bun:",notnull" json:"created_by"`
	UpdatedBy string `bun:",notnull" json:"updated_by"`
	Status    string `bun:",notnull" json:"status"`
}

type QueryBuilderParam

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

type SqlDriver

type SqlDriver struct {
	ORM              *bun.DB
	DriverCredential *protobuff.DriverCredentials
}

func GetSQLDriver

func GetSQLDriver(driverCredentials *protobuff.DriverCredentials) (*SqlDriver, error)

func (*SqlDriver) AddATeamMemberToProject

func (S *SqlDriver) AddATeamMemberToProject(ctx context.Context, projectId string, memberData map[string]interface{}) error

func (*SqlDriver) AddAuthAddOns

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

func (*SqlDriver) AddCollection

func (S *SqlDriver) AddCollection(ctx context.Context, projectId string) (*string, error)

func (*SqlDriver) AddDocumentToProject

func (S *SqlDriver) AddDocumentToProject(ctx context.Context, projectId string, modelName string, doc *shared.DefaultDocumentStructure) (interface{}, error)

func (*SqlDriver) AddFieldToModel

func (S *SqlDriver) AddFieldToModel(ctx context.Context, param shared.CommonSystemParams, isUpdate bool, repeatedGroupIdentifier *string) (*protobuff.ModelType, error)

func (*SqlDriver) AddModel

func (S *SqlDriver) AddModel(ctx context.Context, project *protobuff.Project, name string, singleRecord bool) (*protobuff.ProjectSchema, error)

func (*SqlDriver) AddRelationFields

func (S *SqlDriver) AddRelationFields(ctx context.Context, from *protobuff.ConnectionType, to *protobuff.ConnectionType) error

func (*SqlDriver) AddTeamMetaInfo

func (S *SqlDriver) AddTeamMetaInfo(ctx context.Context, docs []*protobuff.SystemUser) ([]*protobuff.SystemUser, error)

func (*SqlDriver) CheckCollectionExists

func (S *SqlDriver) CheckCollectionExists(ctx context.Context, projectId string) (bool, error)

func (*SqlDriver) CheckDBExists

func (S *SqlDriver) CheckDBExists(ctx context.Context, projectId string) (bool, error)

func (*SqlDriver) CheckOneToOneRelationExists

func (S *SqlDriver) CheckOneToOneRelationExists(ctx context.Context, param *shared.ConnectDisconnectParam) (bool, error)

func (*SqlDriver) ConnectBuilder

func (S *SqlDriver) ConnectBuilder(ctx context.Context, param shared.CommonSystemParams) error

func (*SqlDriver) ConvertModel

func (S *SqlDriver) ConvertModel(ctx context.Context, project *protobuff.Project, modelName string) error

func (*SqlDriver) CountDocOfProject

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

func (*SqlDriver) CountDocOfProjectBytes

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

func (*SqlDriver) CountMedias

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

func (*SqlDriver) CountMultiDocumentOfProject

func (S *SqlDriver) CountMultiDocumentOfProject(ctx context.Context, param shared.CommonSystemParams, previewMode bool) (int, error)

func (*SqlDriver) CreateMediaDocument

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

func (*SqlDriver) CreateRelation

func (S *SqlDriver) CreateRelation(ctx context.Context, projectId string, relation *shared.EdgeRelation) error

func (*SqlDriver) DeleteDocumentFromProject

func (S *SqlDriver) DeleteDocumentFromProject(ctx context.Context, param shared.CommonSystemParams) error

func (*SqlDriver) DeleteDocumentRelation

func (S *SqlDriver) DeleteDocumentRelation(ctx context.Context, param shared.CommonSystemParams) error

func (*SqlDriver) DeleteDocumentsFromProject

func (S *SqlDriver) DeleteDocumentsFromProject(ctx context.Context, param shared.CommonSystemParams) error

func (*SqlDriver) DeleteMediaFile

func (S *SqlDriver) DeleteMediaFile(ctx context.Context, param shared.CommonSystemParams) error

func (*SqlDriver) DeleteProject

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

func (*SqlDriver) DeleteRelation

func (S *SqlDriver) DeleteRelation(ctx context.Context, param *shared.ConnectDisconnectParam, id string) error

func (*SqlDriver) DisconnectBuilder

func (S *SqlDriver) DisconnectBuilder(ctx context.Context, param shared.CommonSystemParams) error

func (*SqlDriver) DropConnections

func (S *SqlDriver) DropConnections(ctx context.Context, projectId string, from *protobuff.ConnectionType, to *protobuff.ConnectionType) error

func (*SqlDriver) DropField

func (S *SqlDriver) DropField(ctx context.Context, param shared.CommonSystemParams) error

func (*SqlDriver) DuplicateModel

func (S *SqlDriver) DuplicateModel(ctx context.Context, project *protobuff.Project, modelName, newName string) (*protobuff.ProjectSchema, error)

func (*SqlDriver) GetAllRelationDocumentsOfSingleDocument

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

func (*SqlDriver) GetLoggedInProjectUser

func (S *SqlDriver) GetLoggedInProjectUser(ctx context.Context, param *shared.CommonSystemParams) (*shared.DefaultDocumentStructure, error)

func (*SqlDriver) GetProjectUser

func (S *SqlDriver) GetProjectUser(ctx context.Context, phone, email, projectId string) (*shared.DefaultDocumentStructure, error)

func (*SqlDriver) GetProjectUsers

func (S *SqlDriver) GetProjectUsers(ctx context.Context, projectId string, keys []string) (map[string]*shared.DefaultDocumentStructure, error)

func (*SqlDriver) GetRelationIds

func (S *SqlDriver) GetRelationIds(ctx context.Context, param *shared.ConnectDisconnectParam) ([]string, error)

func (*SqlDriver) GetSingleProjectDocument

func (S *SqlDriver) GetSingleProjectDocument(ctx context.Context, param shared.CommonSystemParams) (*shared.DefaultDocumentStructure, error)

func (*SqlDriver) GetSingleProjectDocumentBytes

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

func (*SqlDriver) GetSingleProjectDocumentRevisions

func (S *SqlDriver) GetSingleProjectDocumentRevisions(ctx context.Context, param shared.CommonSystemParams) ([]*shared.DocumentRevisionHistory, error)

func (*SqlDriver) GetSingleRawDocumentFromProject

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

func (*SqlDriver) ListMedias

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

func (*SqlDriver) NewInsertableRelations

func (S *SqlDriver) NewInsertableRelations(ctx context.Context, param *shared.ConnectDisconnectParam) ([]string, error)

func (*SqlDriver) QueryMultiDocumentOfProject

func (S *SqlDriver) QueryMultiDocumentOfProject(ctx context.Context, param shared.CommonSystemParams) ([]*shared.DefaultDocumentStructure, error)

func (*SqlDriver) QueryMultiDocumentOfProjectBytes

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

func (*SqlDriver) RelationshipDataLoader

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

func (*SqlDriver) RelationshipDataLoaderBytes

func (S *SqlDriver) RelationshipDataLoaderBytes(ctx context.Context, param *shared.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 (S *SqlDriver) RemoveAuthAddOns(ctx context.Context, project *protobuff.Project, option map[string]interface{}) error

func (*SqlDriver) RenameField

func (S *SqlDriver) RenameField(ctx context.Context, oldFieldName string, repeatedGroupIdentifier *string, param shared.CommonSystemParams) error

func (*SqlDriver) RenameModel

func (S *SqlDriver) RenameModel(ctx context.Context, project *protobuff.Project, modelName, newName string) error

func (*SqlDriver) RunMigration

func (S *SqlDriver) RunMigration(ctx context.Context, projectId string) error

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 shared.CommonSystemParams, doc *shared.DefaultDocumentStructure, replace bool) error

Jump to

Keyboard shortcuts

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