model

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 10 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"}
)

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 Sha1 added in v1.16.0

func Sha1(o interface{}) string

Sha1 return SHA1 fingerprint

func StoreUser added in v1.1.0

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

StoreUser stores given User in context

Types

type AuthService added in v1.16.0

type AuthService interface {
	Create(context.Context, authModel.User) (authModel.User, error)
	Check(context.Context, authModel.User, authModel.User) error
}

AuthService defines interaction with underlying User provider

type GenericProvider added in v1.16.0

type GenericProvider interface {
	LatestVersions(string, []string) (map[string]semver.Version, error)
}

GenericProvider defines interaction with common providers

type HelmProvider added in v1.16.0

type HelmProvider interface {
	FetchIndex(string, map[string][]string) (map[string]map[string]semver.Version, error)
	LatestVersions(string, string, []string) (map[string]semver.Version, error)
}

HelmProvider defines interaction with helm

type Ketchup added in v1.1.0

type Ketchup struct {
	ID         string
	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

func (Ketchup) WithID added in v1.16.0

func (k Ketchup) WithID() Ketchup

WithID generate ID of the ketchup

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 KetchupService added in v1.16.0

type KetchupService interface {
	List(ctx context.Context, pageSize uint, last string) ([]Ketchup, uint64, error)
	ListForRepositories(ctx context.Context, repositories []Repository, frequency KetchupFrequency) ([]Ketchup, error)
	ListOutdatedByFrequency(ctx context.Context, frequency KetchupFrequency) ([]Ketchup, error)
	Create(ctx context.Context, item Ketchup) (Ketchup, error)
	Update(ctx context.Context, oldPattern string, item Ketchup) (Ketchup, error)
	UpdateAll(ctx context.Context) error
	Delete(ctx context.Context, item Ketchup) error
}

KetchupService defines interaction with ketchup

type Mailer added in v1.16.0

type Mailer interface {
	Enabled() bool
	Send(context.Context, mailerModel.MailRequest) error
}

Mailer interface client

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) MarshalJSON added in v1.16.0

func (r RepositoryKind) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (RepositoryKind) String added in v1.8.0

func (r RepositoryKind) String() string

func (*RepositoryKind) UnmarshalJSON added in v1.16.0

func (r *RepositoryKind) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal JSOn

type RepositoryService added in v1.16.0

type RepositoryService interface {
	List(context.Context, uint, string) ([]Repository, uint64, error)
	ListByKinds(context.Context, uint, string, ...RepositoryKind) ([]Repository, uint64, error)
	Suggest(context.Context, []uint64, uint64) ([]Repository, error)
	GetOrCreate(context.Context, RepositoryKind, string, string, string) (Repository, error)
	Update(context.Context, Repository) error
	Clean(context.Context) error
	LatestVersions(Repository) (map[string]semver.Version, error)
}

RepositoryService defines interaction with repository

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

func (User) IsZero added in v1.16.0

func (u User) IsZero() bool

IsZero check if instance is valued or not

type UserService added in v1.16.0

type UserService interface {
	StoreInContext(context.Context) context.Context
}

UserService for storing user in context

type UserStore added in v1.16.0

type UserStore interface {
	DoAtomic(context.Context, func(context.Context) error) error
	GetByLoginID(context.Context, uint64) (User, error)
	GetByEmail(context.Context, string) (User, error)
	Create(context.Context, User) (uint64, error)
	Count(context.Context) (uint64, error)
}

UserStore defines interaction with User storage

Jump to

Keyboard shortcuts

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