devops

package
v0.0.0-...-99e730b Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	ID          string     `bson:"_id" json:"id"`
	Name        string     `bson:"name" json:"name"`
	ObjectID    string     `bson:"object_id" json:"object_id"`
	ObjectType  ObjectType `bson:"object_type" json:"object_type"`
	BaseVersion string     `bson:"base_version" json:"base_version"`
	HeadVersion string     `bson:"head_version" json:"head_version"`
	CreatedAt   time.Time  `bson:"created_at" json:"created_at"`
	CreatedBy   string     `bson:"created_by" json:"created_by"`
	IsActive    bool       `bson:"is_active" json:"is_active"`
	IsMerged    bool       `bson:"is_merged" json:"is_merged"`
}

Branch represents a development branch

type ChangeLog

type ChangeLog struct {
	ID            string                 `bson:"_id" json:"id"`
	ObjectID      string                 `bson:"object_id" json:"object_id"`
	ObjectType    ObjectType             `bson:"object_type" json:"object_type"`
	Action        string                 `bson:"action" json:"action"` // "create", "update", "delete", "merge"
	FromVersion   string                 `bson:"from_version,omitempty" json:"from_version,omitempty"`
	ToVersion     string                 `bson:"to_version" json:"to_version"`
	Changes       []FieldChange          `bson:"changes" json:"changes"`
	ChangedBy     string                 `bson:"changed_by" json:"changed_by"`
	ChangedAt     time.Time              `bson:"changed_at" json:"changed_at"`
	CommitMessage string                 `bson:"commit_message" json:"commit_message"`
	Metadata      map[string]interface{} `bson:"metadata,omitempty" json:"metadata,omitempty"`
}

ChangeLog represents a changelog entry

type FieldChange

type FieldChange struct {
	Field    string      `bson:"field" json:"field"`
	OldValue interface{} `bson:"old_value,omitempty" json:"old_value,omitempty"`
	NewValue interface{} `bson:"new_value,omitempty" json:"new_value,omitempty"`
	Action   string      `bson:"action" json:"action"` // "add", "modify", "delete"
}

FieldChange represents a change to a specific field

type ObjectType

type ObjectType string

ObjectType represents types of objects that can be version controlled

const (
	ObjectTypeTranCode   ObjectType = "TranCode"
	ObjectTypeWorkflow   ObjectType = "Workflow"
	ObjectTypeUIPage     ObjectType = "UI_Page"
	ObjectTypeUIView     ObjectType = "UI_View"
	ObjectTypeWhiteboard ObjectType = "Whiteboard"
	ObjectTypeProcess    ObjectType = "Process_Plan"
)

type VersionControl

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

VersionControl manages version control for document objects

func NewVersionControl

func NewVersionControl(docDB *documents.DocDB, user string) *VersionControl

NewVersionControl creates a new version control manager

func (*VersionControl) AutoCommit

func (vc *VersionControl) AutoCommit(objectType ObjectType, objectID, commitMessage, createdBy string) (*VersionRecord, error)

AutoCommit automatically commits changes from the main collection

func (*VersionControl) Commit

func (vc *VersionControl) Commit(objectType ObjectType, objectID string, content map[string]interface{}, commitMessage, branch, createdBy string) (*VersionRecord, error)

Commit commits a new version of an object

func (*VersionControl) CreateBranch

func (vc *VersionControl) CreateBranch(objectType ObjectType, objectID, branchName, baseVersion, createdBy string) (*Branch, error)

CreateBranch creates a new branch

func (*VersionControl) Diff

func (vc *VersionControl) Diff(version1ID, version2ID string) ([]FieldChange, error)

Diff compares two versions

func (*VersionControl) GetChangelog

func (vc *VersionControl) GetChangelog(objectType ObjectType, objectID string, limit int) ([]*ChangeLog, error)

GetChangelog retrieves changelog for an object

func (*VersionControl) GetLatestVersion

func (vc *VersionControl) GetLatestVersion(objectType ObjectType, objectID, branch string) (*VersionRecord, error)

GetLatestVersion retrieves the latest version of an object

func (*VersionControl) GetVersion

func (vc *VersionControl) GetVersion(versionID string) (*VersionRecord, error)

GetVersion retrieves a specific version

func (*VersionControl) ListVersions

func (vc *VersionControl) ListVersions(objectType ObjectType, objectID, branch string) ([]*VersionRecord, error)

ListVersions lists all versions of an object

func (*VersionControl) MergeBranch

func (vc *VersionControl) MergeBranch(objectType ObjectType, objectID, sourceBranch, targetBranch, mergedBy string) (*VersionRecord, error)

MergeBranch merges a branch into another branch

func (*VersionControl) Revert

func (vc *VersionControl) Revert(objectType ObjectType, objectID, versionID, revertedBy string) (*VersionRecord, error)

Revert reverts an object to a specific version

func (*VersionControl) TagVersion

func (vc *VersionControl) TagVersion(versionID string, tags []string) error

TagVersion tags a version with a label

type VersionRecord

type VersionRecord struct {
	ID            string                 `bson:"_id" json:"id"`
	ObjectID      string                 `bson:"object_id" json:"object_id"`
	ObjectType    ObjectType             `bson:"object_type" json:"object_type"`
	Version       string                 `bson:"version" json:"version"`
	VersionNumber int                    `bson:"version_number" json:"version_number"`
	Content       map[string]interface{} `bson:"content" json:"content"`
	ContentHash   string                 `bson:"content_hash" json:"content_hash"`
	CreatedAt     time.Time              `bson:"created_at" json:"created_at"`
	CreatedBy     string                 `bson:"created_by" json:"created_by"`
	CommitMessage string                 `bson:"commit_message" json:"commit_message"`
	Tags          []string               `bson:"tags,omitempty" json:"tags,omitempty"`
	Branch        string                 `bson:"branch" json:"branch"`
	ParentVersion string                 `bson:"parent_version,omitempty" json:"parent_version,omitempty"`
	MergedFrom    []string               `bson:"merged_from,omitempty" json:"merged_from,omitempty"`
	IsDeleted     bool                   `bson:"is_deleted" json:"is_deleted"`
	Metadata      map[string]interface{} `bson:"metadata,omitempty" json:"metadata,omitempty"`
}

VersionRecord represents a version of an object

Jump to

Keyboard shortcuts

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