sqlite

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	sqlcommon.Base
}

Driver is the SQLite open-core system SQL driver.

func GetSQLiteSystemDriver

func GetSQLiteSystemDriver(cfg *models.Config, cred *models.DriverCredentials) (*Driver, error)

GetSQLiteSystemDriver opens the SQLite system database.

func (*Driver) AddATeamMemberToProject

func (d *Driver) AddATeamMemberToProject(ctx context.Context, req *models.TeamMemberAddRequest) error

AddATeamMemberToProject adds a team member to a project using SQL

func (*Driver) AddSystemUserMetaInfo

func (d *Driver) AddSystemUserMetaInfo(ctx context.Context, doc *types.DefaultDocumentStructure) (*types.DefaultDocumentStructure, error)

AddSystemUserMetaInfo adds metadata to a system user using SQL

func (*Driver) AddTeamMetaInfo

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

AddTeamMetaInfo adds metadata to team members using SQL

func (*Driver) AddWebhookToProject

func (d *Driver) AddWebhookToProject(ctx context.Context, doc *models.Webhook) (*models.Webhook, error)

AddWebhookToProject adds a webhook to a project using SQL

func (*Driver) AssignProjectToOrganization

func (d *Driver) AssignProjectToOrganization(ctx context.Context, orgId, userId, projectId string) error

AssignProjectToOrganization assigns a project to an organization using SQL

func (*Driver) AssignTeamToOrganization

func (d *Driver) AssignTeamToOrganization(ctx context.Context, orgId, userId, teamId string) error

AssignTeamToOrganization assigns a team to an organization using SQL

func (*Driver) BlacklistAToken

func (d *Driver) BlacklistAToken(ctx context.Context, token map[string]interface{}) error

BlacklistAToken adds a token to the blacklist using SQL

func (*Driver) CheckProjectName

func (d *Driver) CheckProjectName(ctx context.Context, name string) error

CheckProjectName checks if a project name already exists using SQL

func (*Driver) CheckProjectWithRoles

func (d *Driver) CheckProjectWithRoles(ctx context.Context, userId, projectId string) (*models.ProjectWithRoles, error)

CheckProjectWithRoles checks if a user belongs to a project and returns roles/permissions using SQL

func (*Driver) CheckTeamMemberExists

func (d *Driver) CheckTeamMemberExists(ctx context.Context, projectId string, memberID string) error

CheckTeamMemberExists checks if a team member exists in a project using SQL

func (*Driver) CheckTokenBlacklisted

func (d *Driver) CheckTokenBlacklisted(ctx context.Context, tokenId string) error

CheckTokenBlacklisted checks if a token is blacklisted using SQL

func (*Driver) Close

func (d *Driver) Close() error

func (*Driver) CountProjectUsersByRole

func (d *Driver) CountProjectUsersByRole(ctx context.Context, projectID string) (map[string]int, error)

func (*Driver) CreateOrganization

func (d *Driver) CreateOrganization(ctx context.Context, org *models.Organization) (*models.Organization, error)

CreateOrganization creates a new organization using SQL

func (*Driver) CreateProject

func (d *Driver) CreateProject(ctx context.Context, userId string, project *models.Project) (*models.Project, error)

CreateProject creates a new project using SQL

func (*Driver) CreateSchemaOperation

func (d *Driver) CreateSchemaOperation(ctx context.Context, op *models.SchemaOperation) error

func (*Driver) CreateSystemUser

func (d *Driver) CreateSystemUser(ctx context.Context, user *models.SystemUser) (*models.SystemUser, error)

CreateSystemUser creates a new system user using SQL

func (*Driver) CreateTeam

func (d *Driver) CreateTeam(ctx context.Context, team *models.Team) (*models.Team, error)

CreateTeam creates a new team using SQL

func (*Driver) CreateUser

func (d *Driver) CreateUser(ctx context.Context, row *models.User) (*models.User, error)

func (*Driver) DeleteModelType

func (d *Driver) DeleteModelType(ctx context.Context, projectID, modelName string) error

DeleteModelType implements interfaces.ApitoSystemDB — delete one model_types row.

func (*Driver) DeleteProjectFromSystem

func (d *Driver) DeleteProjectFromSystem(ctx context.Context, projectId string) error

DeleteProjectFromSystem deletes a project and all related data using SQL

func (*Driver) DeleteUser

func (d *Driver) DeleteUser(ctx context.Context, projectID, userID string) error

func (*Driver) DeleteWebhook

func (d *Driver) DeleteWebhook(ctx context.Context, projectId, hookId string) error

DeleteWebhook deletes a webhook using SQL

func (*Driver) EnsureBootstrapAdmin

func (d *Driver) EnsureBootstrapAdmin(ctx context.Context) error

EnsureBootstrapAdmin creates the default admin user if missing (idempotent). Exported for pro layered system bootstrap (e.g. libsql starter provisioned outside OSS driver defaults).

func (*Driver) EnsureBootstrapOrgTeamProjectWithStarterCreate

func (d *Driver) EnsureBootstrapOrgTeamProjectWithStarterCreate(ctx context.Context, fn bootstrapmeta.CreateStarterProjectFn) error

EnsureBootstrapOrgTeamProjectWithStarterCreate seeds default team/org and links the starter project. fn is called only when the starter project row is missing (GetProject returns sql.ErrNoRows). Exported for pro builds that replace OSS starter driver creation (e.g. Turso platform provisioning).

func (*Driver) EnsureBootstrapProjectSettingsRow

func (d *Driver) EnsureBootstrapProjectSettingsRow(ctx context.Context, projectID string) error

EnsureBootstrapProjectSettingsRow ensures a project_settings row exists (idempotent). Exported for pro layered bootstrap that skips open-core ensureStarterProjectDriver.

func (*Driver) EnsureSystemBootstrap

func (d *Driver) EnsureSystemBootstrap(ctx context.Context) error

func (*Driver) FindOrganizationAdmin

func (d *Driver) FindOrganizationAdmin(ctx context.Context, orgId string) (*models.SystemUser, error)

FindOrganizationAdmin implements interfaces.ApitoSystemDB.

func (*Driver) FindUserOrganizations

func (d *Driver) FindUserOrganizations(ctx context.Context, userId string) ([]*models.Organization, error)

FindUserOrganizations retrieves all organizations for a given user using SQL

func (*Driver) FindUserProjects

func (d *Driver) FindUserProjects(ctx context.Context, userId string) ([]*models.Project, error)

FindUserProjects retrieves all projects for a given user using SQL

func (*Driver) FindUserProjectsWithRoles

func (d *Driver) FindUserProjectsWithRoles(ctx context.Context, userId string) ([]*models.ProjectWithRoles, error)

FindUserProjectsWithRoles implements interfaces.ApitoSystemDB.

func (*Driver) FindUserTeams

func (d *Driver) FindUserTeams(ctx context.Context, userId string) ([]*models.Team, error)

FindUserTeams retrieves all teams for a given user using SQL

func (*Driver) GetOrganizations

func (d *Driver) GetOrganizations(ctx context.Context, userId string) (*models.SearchResponse[models.Organization], error)

GetOrganizations implements interfaces.ApitoSystemDB.

func (*Driver) GetProject

func (d *Driver) GetProject(ctx context.Context, id string) (*models.Project, error)

GetProject retrieves a project by ID using SQL

func (*Driver) GetProjectTeams

func (d *Driver) GetProjectTeams(ctx context.Context, projectId string) (*models.Team, error)

GetProjectTeams retrieves team information for a project using SQL

func (*Driver) GetProjectWithRolesAndPermission

func (d *Driver) GetProjectWithRolesAndPermission(ctx context.Context, userId string) ([]*models.ProjectWithRoles, error)

GetProjectWithRolesAndPermission retrieves projects with roles and permissions for a user using SQL

func (*Driver) GetProjects

func (d *Driver) GetProjects(ctx context.Context, keys []string) ([]*models.Project, error)

GetProjects retrieves multiple projects by their IDs using SQL

func (*Driver) GetSQLBase

func (d *Driver) GetSQLBase() *sqlcommon.Base

func (*Driver) GetSchemaOperation

func (d *Driver) GetSchemaOperation(ctx context.Context, id string) (*models.SchemaOperation, error)

func (*Driver) GetSystemUser

func (d *Driver) GetSystemUser(ctx context.Context, id string) (*models.SystemUser, error)

GetSystemUser retrieves a system user by ID using SQL

func (*Driver) GetSystemUserByEmail

func (d *Driver) GetSystemUserByEmail(ctx context.Context, email string) (*models.SystemUser, error)

GetSystemUserByEmail retrieves a system user by email using SQL

func (*Driver) GetSystemUsers

func (d *Driver) GetSystemUsers(ctx context.Context, keys []string) ([]*models.SystemUser, error)

GetSystemUsers retrieves multiple system users by their IDs using SQL

func (*Driver) GetTeams

func (d *Driver) GetTeams(ctx context.Context, userId string) ([]*models.Team, error)

GetTeams implements interfaces.ApitoSystemDB.

func (*Driver) GetTeamsMembers

func (d *Driver) GetTeamsMembers(ctx context.Context, projectId string) ([]*models.SystemUser, error)

GetTeamsMembers implements interfaces.ApitoSystemDB.

func (*Driver) GetUser

func (d *Driver) GetUser(ctx context.Context, projectID, userID string) (*models.User, error)

func (*Driver) GetUserByUsername

func (d *Driver) GetUserByUsername(ctx context.Context, projectID, username string) (*models.User, error)

func (*Driver) GetWebHook

func (d *Driver) GetWebHook(ctx context.Context, projectId, hookId string) (*models.Webhook, error)

GetWebHook retrieves a specific webhook by ID using SQL

func (*Driver) ListAllProjects

func (d *Driver) ListAllProjects(ctx context.Context, userId string) ([]*models.Project, error)

ListAllProjects lists all projects for a user (with admin check) using SQL

func (*Driver) ListAllUsers

func (d *Driver) ListAllUsers(ctx context.Context) ([]*models.SystemUser, error)

ListAllUsers lists all system users using SQL

func (*Driver) ListSchemaOperationsByStatus

func (d *Driver) ListSchemaOperationsByStatus(ctx context.Context, projectID string, statuses []string, limit int) ([]*models.SchemaOperation, error)

func (*Driver) ListTeams

func (d *Driver) ListTeams(ctx context.Context, projectId string) ([]*models.SystemUser, error)

ListTeams lists team members for a project using SQL

func (*Driver) ListUsersByEmail

func (d *Driver) ListUsersByEmail(ctx context.Context, projectID, email string) ([]*models.User, error)

func (*Driver) ListUsersByGoogleSub

func (d *Driver) ListUsersByGoogleSub(ctx context.Context, projectID, googleSub string) ([]*models.User, error)

func (*Driver) ListUsersByPhone

func (d *Driver) ListUsersByPhone(ctx context.Context, projectID, phone string) ([]*models.User, error)

func (*Driver) PersistProjectModelTypes

func (d *Driver) PersistProjectModelTypes(ctx context.Context, projectID string, schemaModels []*models.ModelType) error

PersistProjectModelTypes implements interfaces.ApitoSystemDB: deletes model_types rows for projectID whose name is not in schemaModels, then inserts or updates each model row. schemaModels nil means no-op (reserved). An empty slice deletes all model_types for the project.

func (*Driver) Ping

func (d *Driver) Ping() error

func (*Driver) RemoveATeamFromOrganization

func (d *Driver) RemoveATeamFromOrganization(ctx context.Context, orgId, userId, teamId string) error

RemoveATeamFromOrganization removes a team from an organization using SQL

func (*Driver) RemoveATeamMemberFromProject

func (d *Driver) RemoveATeamMemberFromProject(ctx context.Context, projectId string, memberID string) error

RemoveATeamMemberFromProject removes a team member from a project using SQL

func (*Driver) RemoveProjectFromOrganization

func (d *Driver) RemoveProjectFromOrganization(ctx context.Context, orgId, userId, projectId string) error

RemoveProjectFromOrganization removes a project from an organization using SQL

func (*Driver) RunMigration

func (d *Driver) RunMigration(ctx context.Context) error

func (*Driver) SaveAuditLog

func (d *Driver) SaveAuditLog(ctx context.Context, auditLog *models.AuditLogs) error

SaveAuditLog implements interfaces.ApitoSystemDB.

func (*Driver) SaveProjectAuthenticationSettings

func (d *Driver) SaveProjectAuthenticationSettings(ctx context.Context, projectID string, auth *models.AuthenticationSettings) error

func (*Driver) SaveProjectStorageSettings

func (d *Driver) SaveProjectStorageSettings(ctx context.Context, projectID string, storage *models.StorageSettings) error

func (*Driver) SaveRawData

func (d *Driver) SaveRawData(ctx context.Context, collection string, data map[string]interface{}) error

SaveRawData saves raw data using SQL for payment-related operations

func (*Driver) SearchAuditLogs

SearchAuditLogs implements interfaces.ApitoSystemDB.

func (*Driver) SearchFunctions

SearchFunctions searches for cloud functions in a project using SQL

func (*Driver) SearchProjectUsers

func (d *Driver) SearchProjectUsers(ctx context.Context, projectID string, limit, offset int) ([]*models.User, int, error)

func (*Driver) SearchProjects

SearchProjects searches for projects based on common system parameters using SQL

func (*Driver) SearchResource

func (d *Driver) SearchResource(ctx context.Context, param *models.CommonSystemParams) (*models.SearchResponse[any], error)

SearchResource implements interfaces.ApitoSystemDB.

func (*Driver) SearchSystemUsers

func (d *Driver) SearchSystemUsers(ctx context.Context, param *models.CommonSystemParams) (*models.SearchResponse[models.SystemUser], error)

SearchSystemUsers searches for system users based on parameters using SQL

func (*Driver) SearchWebHooks

SearchWebHooks searches for webhooks in a project using SQL

func (*Driver) TouchProjectUpdatedAt

func (d *Driver) TouchProjectUpdatedAt(ctx context.Context, projectID string) error

TouchProjectUpdatedAt implements interfaces.ApitoSystemDB.

func (*Driver) UpdateProject

func (d *Driver) UpdateProject(ctx context.Context, project *models.Project, replace bool) error

UpdateProject updates a project using SQL

func (*Driver) UpdateSchemaOperation

func (d *Driver) UpdateSchemaOperation(ctx context.Context, op *models.SchemaOperation) error

func (*Driver) UpdateSystemUser

func (d *Driver) UpdateSystemUser(ctx context.Context, user *models.SystemUser, replace bool) error

UpdateSystemUser updates a system user using SQL

func (*Driver) UpdateUser

func (d *Driver) UpdateUser(ctx context.Context, row *models.User) error

func (*Driver) UpsertModelType

func (d *Driver) UpsertModelType(ctx context.Context, projectID string, m *models.ModelType) error

UpsertModelType implements interfaces.ApitoSystemDB — single model_types row, no orphan reconciliation.

type SystemSQLDriver

type SystemSQLDriver = Driver

SystemSQLDriver is a compatibility alias for pro/sqlpro embed during migration.

Jump to

Keyboard shortcuts

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