modules

package
v3.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Data structures used to store and version modules (code in Lua environment)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidModuleName

func IsValidModuleName(name string) bool

Some validation functions

func SemanticVersionToString

func SemanticVersionToString(v SemanticVersion) string

Types

type DataModule

type DataModule struct {
	ID       string                 `json:"id" bson:"_id"` // Use as Mongo ID
	Name     string                 `json:"name"`
	Comments string                 `json:"comments"`
	Origin   pixlUser.APIObjectItem `json:"origin"`
}

Stored module object itself

type DataModuleInput

type DataModuleInput struct {
	Name        string                   `json:"name"`       // Editable name
	SourceCode  string                   `json:"sourceCode"` // The module executable code
	Comments    string                   `json:"comments"`   // Editable comments
	Tags        []string                 `json:"tags"`       // Any tags for this version
	DOIMetadata zenodoModels.DOIMetadata `json:"doiMetadata,omitempty" bson:"doiMetadata,omitempty"`
}

What users send in POST

type DataModuleSpecificVersionWire

type DataModuleSpecificVersionWire struct {
	*DataModule
	Version DataModuleVersionSourceWire `json:"version"`
}

And what we send for a specific module version request

type DataModuleVersion

type DataModuleVersion struct {
	ID               string                   `json:"-" bson:"_id"` // Use as Mongo ID
	ModuleID         string                   `json:"moduleID"`     // The ID of the module we belong to
	SourceCode       string                   `json:"sourceCode"`
	Version          SemanticVersion          `json:"version"`
	Tags             []string                 `json:"tags"`
	Comments         string                   `json:"comments"`
	TimeStampUnixSec int64                    `json:"mod_unix_time_sec"`
	DOIMetadata      zenodoModels.DOIMetadata `json:"doiMetadata,omitempty" bson:"doiMetadata,omitempty"`
}

Stored version of a module

type DataModuleVersionInput

type DataModuleVersionInput struct {
	SourceCode    string                   `json:"sourceCode"`    // The module executable code
	Comments      string                   `json:"comments"`      // Editable comments
	Tags          []string                 `json:"tags"`          // Any tags for this version
	VersionUpdate string                   `json:"versionupdate"` // What are we updating? patch, minor or major. Anything else = error
	DOIMetadata   zenodoModels.DOIMetadata `json:"doiMetadata,omitempty" bson:"doiMetadata,omitempty"`
}

And what we get in PUT for new versions being uploaded

type DataModuleVersionSourceWire

type DataModuleVersionSourceWire struct {
	SourceCode string `json:"sourceCode"`
	*DataModuleVersionWire
}

As above, but with source field

type DataModuleVersionWire

type DataModuleVersionWire struct {
	Version          string                   `json:"version"`
	Tags             []string                 `json:"tags"`
	Comments         string                   `json:"comments"`
	TimeStampUnixSec int64                    `json:"mod_unix_time_sec"`
	DOIMetadata      zenodoModels.DOIMetadata `json:"doiMetadata,omitempty" bson:"doiMetadata,omitempty"`
}

What we send out to users - notice versions only contains version numbers & tags

type DataModuleWire

type DataModuleWire struct {
	*DataModule
	Versions []DataModuleVersionWire `json:"versions"`
}

type DataModuleWireLookup

type DataModuleWireLookup map[string]DataModuleWire

type SemanticVersion

type SemanticVersion struct {
	Major int
	Minor int
	Patch int
}

func SemanticVersionFromString

func SemanticVersionFromString(v string) (SemanticVersion, error)

Jump to

Keyboard shortcuts

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