schema

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package schema provides versioned data structures for cf

Index

Constants

View Source
const (
	TypeWorkspace  = "workspace"
	TypeProblem    = "problem"
	TypeSubmission = "submission"
	TypeProgress   = "progress"
	TypeConfig     = "config"
)

Schema types

Variables

View Source
var (
	// CurrentVersion is the latest schema version
	CurrentVersion = Version{Major: 1, Minor: 0, Patch: 0}

	// MinSupportedVersion is the oldest version we can migrate from
	MinSupportedVersion = Version{Major: 1, Minor: 0, Patch: 0}
)

Functions

This section is empty.

Types

type SchemaHeader

type SchemaHeader struct {
	Version string `yaml:"version" json:"version"`
	Type    string `yaml:"type" json:"type"`
}

SchemaHeader is embedded in all versioned YAML files

func NewSchemaHeader

func NewSchemaHeader(schemaType string) SchemaHeader

NewSchemaHeader creates a new schema header with current version

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a semantic version

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion parses a version string (e.g., "1.0.0")

func (Version) Compare

func (v Version) Compare(other Version) int

Compare returns -1 if v < other, 0 if v == other, 1 if v > other

func (Version) IsCompatible

func (v Version) IsCompatible(other Version) bool

IsCompatible checks if two versions are compatible (same major version)

func (Version) NeedsMigration

func (v Version) NeedsMigration(other Version) bool

NeedsMigration checks if migration is needed between versions

func (Version) String

func (v Version) String() string

String returns the version as a string (e.g., "1.0.0")

Directories

Path Synopsis
Package v1 contains schema definitions for version 1.x
Package v1 contains schema definitions for version 1.x

Jump to

Keyboard shortcuts

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