model

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPattern is the latest but non-beta version
	DefaultPattern = "stable"
)

Variables

View Source
var (
	// KetchupFrequencyValues string values
	KetchupFrequencyValues = []string{"None", "Daily", "Weekly"}

	// NoneKetchup is an undefined ketchup
	NoneKetchup = Ketchup{}
)
View Source
var (
	// RepositoryKindValues string values
	RepositoryKindValues = []string{"github", "helm", "docker", "npm", "pypi"}

	// NoneRepository is an undefined repository
	NoneRepository = Repository{}
)
View Source
var (
	// NoneUser is an undefined user
	NoneUser = User{}
)

Functions

func CheckPatternsMatching added in v1.9.0

func CheckPatternsMatching(versions map[string]semver.Version, patterns map[string]semver.Pattern, version semver.Version)

CheckPatternsMatching check given version against pattern matching

func PreparePatternMatching added in v1.9.0

func PreparePatternMatching(patterns []string) (map[string]semver.Version, map[string]semver.Pattern, error)

PreparePatternMatching prepare maps for doing pattern matching

func StoreUser added in v1.1.0

func StoreUser(ctx context.Context, user User) context.Context

StoreUser stores given User in context

Types

type Ketchup added in v1.1.0

type Ketchup struct {
	Semver     string
	Pattern    string
	Version    string
	User       User
	Repository Repository
	Frequency  KetchupFrequency
}

Ketchup of app

func NewKetchup added in v1.9.0

func NewKetchup(pattern, version string, frequency KetchupFrequency, repo Repository) Ketchup

NewKetchup creates new instance

type KetchupByPriority added in v1.2.0

type KetchupByPriority []Ketchup

KetchupByPriority sort ketchup by priority (outdated first, name then)

func (KetchupByPriority) Len added in v1.2.0

func (a KetchupByPriority) Len() int

func (KetchupByPriority) Less added in v1.2.0

func (a KetchupByPriority) Less(i, j int) bool

func (KetchupByPriority) Swap added in v1.2.0

func (a KetchupByPriority) Swap(i, j int)

type KetchupByRepositoryIDAndPattern added in v1.14.0

type KetchupByRepositoryIDAndPattern []Ketchup

KetchupByRepositoryIDAndPattern sort ketchup by repository ID

func (KetchupByRepositoryIDAndPattern) Len added in v1.14.0

func (KetchupByRepositoryIDAndPattern) Less added in v1.14.0

func (KetchupByRepositoryIDAndPattern) Swap added in v1.14.0

func (a KetchupByRepositoryIDAndPattern) Swap(i, j int)

type KetchupFrequency added in v1.12.0

type KetchupFrequency int

KetchupFrequency defines constant for ketchup frequency

const (
	// None frequency
	None KetchupFrequency = iota
	// Daily frequency
	Daily
	// Weekly frequency (on Monday)
	Weekly
)

func ParseKetchupFrequency added in v1.12.0

func ParseKetchupFrequency(value string) (KetchupFrequency, error)

ParseKetchupFrequency parse raw string into a KetchupFrequency

func (KetchupFrequency) String added in v1.12.0

func (r KetchupFrequency) String() string

type Release added in v1.1.0

type Release struct {
	Pattern    string         `json:"pattern"`
	URL        string         `json:"url"`
	Repository Repository     `json:"repository"`
	Version    semver.Version `json:"version"`
}

Release is when new version is out

func NewRelease added in v1.1.0

func NewRelease(repository Repository, pattern string, version semver.Version) Release

NewRelease creates a new version from its objects

type ReleaseByKindAndName added in v1.15.0

type ReleaseByKindAndName []Release

ReleaseByKindAndName sort release by repository kind and repository name

func (ReleaseByKindAndName) Len added in v1.15.0

func (a ReleaseByKindAndName) Len() int

func (ReleaseByKindAndName) Less added in v1.15.0

func (a ReleaseByKindAndName) Less(i, j int) bool

func (ReleaseByKindAndName) Swap added in v1.15.0

func (a ReleaseByKindAndName) Swap(i, j int)

type ReleaseByRepositoryIDAndPattern added in v1.14.0

type ReleaseByRepositoryIDAndPattern []Release

ReleaseByRepositoryIDAndPattern sort release by repository ID

func (ReleaseByRepositoryIDAndPattern) Len added in v1.14.0

func (ReleaseByRepositoryIDAndPattern) Less added in v1.14.0

func (ReleaseByRepositoryIDAndPattern) Swap added in v1.14.0

func (a ReleaseByRepositoryIDAndPattern) Swap(i, j int)

type Repository added in v1.1.0

type Repository struct {
	Versions map[string]string `json:"versions"`
	Name     string            `json:"name"`
	Part     string            `json:"part"`
	ID       uint64            `json:"id"`
	Kind     RepositoryKind    `json:"kind"`
}

Repository of app

func NewGithubRepository added in v1.12.0

func NewGithubRepository(id uint64, name string) Repository

NewGithubRepository create new Repository with initialized values

func NewHelmRepository added in v1.12.0

func NewHelmRepository(id uint64, name, part string) Repository

NewHelmRepository create new Repository with initialized values

func NewRepository added in v1.9.0

func NewRepository(id uint64, kind RepositoryKind, name, part string) Repository

NewRepository create new Repository with initialized values

func (Repository) AddVersion added in v1.9.0

func (r Repository) AddVersion(pattern, version string) Repository

AddVersion adds given pattern to versions map

func (Repository) CompareURL added in v1.8.0

func (r Repository) CompareURL(version string, pattern string) string

CompareURL format the URL of given repository compared against given version

func (Repository) String added in v1.12.0

func (r Repository) String() string

URL format the URL of given repository with current version

func (Repository) URL added in v1.8.0

func (r Repository) URL(pattern string) string

URL format the URL of given repository with pattern version

func (Repository) VersionURL added in v1.15.0

func (r Repository) VersionURL(version string) string

VersionURL format the URL of given repository with given version

type RepositoryKind added in v1.8.0

type RepositoryKind int

RepositoryKind defines constant for repository types

const (
	// Github repository kind
	Github RepositoryKind = iota
	// Helm repository kind
	Helm
	// Docker repository kind
	Docker
	// NPM repository kind
	NPM
	// Pypi repository kind
	Pypi
)

func ParseRepositoryKind added in v1.8.0

func ParseRepositoryKind(value string) (RepositoryKind, error)

ParseRepositoryKind parse raw string into a RepositoryKind

func (RepositoryKind) String added in v1.8.0

func (r RepositoryKind) String() string

type User added in v1.1.0

type User struct {
	Email string
	Login authModel.User
	ID    uint64
}

User of app

func NewUser added in v1.9.0

func NewUser(id uint64, email string, login authModel.User) User

NewUser creates new User instance

func ReadUser added in v1.1.0

func ReadUser(ctx context.Context) User

ReadUser retrieves user from context

Jump to

Keyboard shortcuts

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