db

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const FetchSyncJobsDefaultBatchSize = 1000
View Source
const SyncDeleteBson = "sync_delete"
View Source
const SyncTodoBson = "sync_todo"
View Source
const SyncUnixTimestampBson = "sync_unix_timestamp"

Variables

View Source
var CreateCollections = []func(db *Mongo, config config.Config) error{}
View Source
var DeploymentBson = getBsonFieldObject[messages.DeploymentCommand]()
View Source
var ErrorUnexpectedDeploymentVersion = errors.New("unexpected deployment version")
View Source
var Factory = FactoryType{}
View Source
var NotDeletedFilterKey = "$or"
View Source
var NotDeletedFilterValue = []interface{}{
	bson.M{SyncDeleteBson: bson.M{"$exists": false}},
	bson.M{SyncDeleteBson: false},
}

Functions

func FetchSyncJobs added in v0.0.16

func FetchSyncJobs[OutputType any](collection *mongo.Collection, syncLockDuration time.Duration, maxBatchSize int) (jobs []OutputType, err error)

Types

type DeploymentCommandIdVersionWrapper

type DeploymentCommandIdVersionWrapper struct {
	Id      string `json:"id"`
	Owner   string `json:"owner"`
	Version int64  `json:"version"`
}

type DeploymentWithSyncInfo added in v0.0.16

type DeploymentWithSyncInfo struct {
	messages.DeploymentCommand `bson:",inline"`
	SyncInfo                   `bson:",inline"`
}

type FactoryType

type FactoryType struct{}

func (FactoryType) New

func (f FactoryType) New(ctx context.Context, config config.Config) (result interfaces.Database, err error)

type Mongo

type Mongo struct {
	// contains filtered or unexported fields
}

func (*Mongo) CheckDeploymentAccess

func (this *Mongo) CheckDeploymentAccess(user string, deploymentId string) (err error, code int)

func (*Mongo) DeleteDependencies

func (this *Mongo) DeleteDependencies(id string) error

func (*Mongo) DeleteDeployment

func (this *Mongo) DeleteDeployment(id string, syncDeleteHandler func(messages.DeploymentCommand) error) error

func (*Mongo) GetDependencies

func (this *Mongo) GetDependencies(user string, deploymentId string) (result dependencymodel.Dependencies, err error, code int)

func (*Mongo) GetDependenciesList

func (this *Mongo) GetDependenciesList(user string, limit int, offset int) (result []dependencymodel.Dependencies, err error, code int)

func (*Mongo) GetDeployment

func (this *Mongo) GetDeployment(user string, deploymentId string) (deployment *deploymentmodel.Deployment, err error, code int)

func (*Mongo) GetDeploymentIds

func (this *Mongo) GetDeploymentIds(user string) (deployments []string, err error)

func (*Mongo) GetSelectedDependencies

func (this *Mongo) GetSelectedDependencies(user string, ids []string) (result []dependencymodel.Dependencies, err error, code int)

func (*Mongo) ListDeployments added in v0.0.14

func (this *Mongo) ListDeployments(user string, listOptions model.DeploymentListOptions) (deployments []deploymentmodel.Deployment, err error)

func (*Mongo) RetryDeploymentSync added in v0.0.16

func (this *Mongo) RetryDeploymentSync(lockduration time.Duration, syncDeleteHandler func(messages.DeploymentCommand) error, syncHandler func(messages.DeploymentCommand) error) error

func (*Mongo) SetDependencies

func (this *Mongo) SetDependencies(dependencies dependencymodel.Dependencies) error

func (*Mongo) SetDeployment

func (this *Mongo) SetDeployment(depl messages.DeploymentCommand, syncHandler func(messages.DeploymentCommand) error) error

type SyncInfo added in v0.0.16

type SyncInfo struct {
	SyncTodo          bool  `bson:"sync_todo"`
	SyncDelete        bool  `bson:"sync_delete"`
	SyncUnixTimestamp int64 `bson:"sync_unix_timestamp"`
}

Jump to

Keyboard shortcuts

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