Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPatternsMatching(versions map[string]semver.Version, patterns map[string]semver.Pattern, ...)
- func PreparePatternMatching(patterns []string) (map[string]semver.Version, map[string]semver.Pattern, error)
- func StoreUser(ctx context.Context, user User) context.Context
- type AuthService
- type Database
- type GenericProvider
- type HelmProvider
- type Identifier
- type Ketchup
- type KetchupByPriority
- type KetchupByRepositoryIDAndPattern
- type KetchupFrequency
- type KetchupService
- type KetchupStore
- type Mailer
- type Release
- type ReleaseByKindAndName
- type ReleaseByRepositoryIDAndPattern
- type Repository
- func (r Repository) AddVersion(pattern, version string) Repository
- func (r Repository) CompareURL(version string, pattern string) string
- func (r Repository) IsZero() bool
- func (r Repository) String() string
- func (r Repository) URL(pattern string) string
- func (r Repository) VersionURL(version string) string
- type RepositoryKind
- type RepositoryService
- type RepositoryStore
- type User
- type UserService
- type UserStore
Constants ¶
const (
// DefaultPattern is the latest but non-beta version
DefaultPattern = "stable"
)
Variables ¶
var KetchupFrequencyValues = []string{"None", "Daily", "Weekly"}
KetchupFrequencyValues string values
var RepositoryKindValues = []string{"github", "helm", "docker", "npm", "pypi"}
RepositoryKindValues string values
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
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 interactions with underlying User provider
type Database ¶ added in v1.17.0
type Database interface { List(context.Context, func(pgx.Rows) error, string, ...any) error Get(context.Context, func(pgx.Row) error, string, ...any) error Create(context.Context, string, ...any) (uint64, error) Exec(context.Context, string, ...any) error One(context.Context, string, ...any) error DoAtomic(context.Context, func(context.Context) error) error }
Database interface needed
type GenericProvider ¶ added in v1.16.0
type GenericProvider interface {
LatestVersions(context.Context, string, []string) (map[string]semver.Version, error)
}
GenericProvider defines interactions with common providers
type HelmProvider ¶ added in v1.16.0
type HelmProvider interface { FetchIndex(context.Context, string, map[string][]string) (map[string]map[string]semver.Version, error) LatestVersions(context.Context, string, string, []string) (map[string]semver.Version, error) }
HelmProvider defines interactions with helm
type Identifier ¶ added in v1.18.0
type Identifier uint64
func (Identifier) IsZero ¶ added in v1.18.0
func (i Identifier) IsZero() bool
type Ketchup ¶ added in v1.1.0
type Ketchup struct { ID string Semver string Pattern string Version string User User Repository Repository Frequency KetchupFrequency UpdateWhenNotify bool }
Ketchup of app
func NewKetchup ¶ added in v1.9.0
func NewKetchup(pattern, version string, frequency KetchupFrequency, updateWhenNotify bool, 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 (a KetchupByRepositoryIDAndPattern) Len() int
func (KetchupByRepositoryIDAndPattern) Less ¶ added in v1.14.0
func (a KetchupByRepositoryIDAndPattern) Less(i, j int) bool
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, frequencies ...KetchupFrequency) ([]Ketchup, error) ListOutdated(ctx context.Context, users ...User) ([]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 UpdateVersion(ctx context.Context, userID, repositoryID Identifier, pattern, version string) error Delete(ctx context.Context, item Ketchup) error }
KetchupService defines interactions with ketchup
type KetchupStore ¶ added in v1.17.0
type KetchupStore interface { DoAtomic(ctx context.Context, action func(context.Context) error) error List(ctx context.Context, page uint, last string) ([]Ketchup, uint64, error) ListByRepositoriesIDAndFrequencies(ctx context.Context, ids []Identifier, frequencies ...KetchupFrequency) ([]Ketchup, error) ListOutdated(ctx context.Context, usersIds ...Identifier) ([]Ketchup, error) GetByRepository(ctx context.Context, id Identifier, pattern string, forUpdate bool) (Ketchup, error) Create(ctx context.Context, o Ketchup) (Identifier, error) Update(ctx context.Context, o Ketchup, oldPattern string) error UpdateAll(ctx context.Context) error UpdateVersion(ctx context.Context, userID, repositoryID Identifier, pattern, version string) error Delete(ctx context.Context, o Ketchup) error }
KetchupStore defines interactions with ketchup storage
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"` Updated uint `json:"updated"` }
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
func (Release) SetUpdated ¶ added in v1.17.0
SetUpdated marks released as auto updated
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 (a ReleaseByRepositoryIDAndPattern) Len() int
func (ReleaseByRepositoryIDAndPattern) Less ¶ added in v1.14.0
func (a ReleaseByRepositoryIDAndPattern) Less(i, j int) bool
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 Identifier `json:"id"` Kind RepositoryKind `json:"kind"` }
Repository of app
func NewEmptyRepository ¶ added in v1.17.0
func NewEmptyRepository() Repository
NewEmptyRepository create an empty Repository
func NewGithubRepository ¶ added in v1.12.0
func NewGithubRepository(id Identifier, name string) Repository
NewGithubRepository create new Repository with initialized values
func NewHelmRepository ¶ added in v1.12.0
func NewHelmRepository(id Identifier, name, part string) Repository
NewHelmRepository create new Repository with initialized values
func NewRepository ¶ added in v1.9.0
func NewRepository(id Identifier, 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) IsZero ¶ added in v1.17.0
func (r Repository) IsZero() bool
IsZero return false if instance is not initialized
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, []Identifier, uint64) ([]Repository, error) GetOrCreate(context.Context, RepositoryKind, string, string, string) (Repository, error) Update(context.Context, Repository) error Clean(context.Context) error LatestVersions(context.Context, Repository) (map[string]semver.Version, error) }
RepositoryService defines interactions with repository
type RepositoryStore ¶ added in v1.17.0
type RepositoryStore interface { DoAtomic(ctx context.Context, action func(context.Context) error) error List(ctx context.Context, pageSize uint, last string) ([]Repository, uint64, error) ListByKinds(ctx context.Context, pageSize uint, last string, kinds ...RepositoryKind) ([]Repository, uint64, error) Suggest(ctx context.Context, ignoreIds []Identifier, count uint64) ([]Repository, error) Get(ctx context.Context, id Identifier, forUpdate bool) (Repository, error) GetByName(ctx context.Context, repositoryKind RepositoryKind, name, part string) (Repository, error) Create(ctx context.Context, o Repository) (Identifier, error) UpdateVersions(ctx context.Context, o Repository) error DeleteUnused(ctx context.Context) error DeleteUnusedVersions(ctx context.Context) error }
RepositoryStore defines interactions with repository storage
type User ¶ added in v1.1.0
type User struct { Email string `json:"email"` Login authModel.User `json:"login"` ID Identifier `json:"id"` }
User of app
func NewUser ¶ added in v1.9.0
func NewUser(id Identifier, email string, login authModel.User) User
NewUser creates new User instance
type UserService ¶ added in v1.16.0
UserService for storing user in context
type UserStore ¶ added in v1.16.0
type UserStore interface { DoAtomic(context.Context, func(context.Context) error) error ListReminderUsers(ctx context.Context) ([]User, error) GetByLoginID(context.Context, uint64) (User, error) GetByEmail(context.Context, string) (User, error) Create(context.Context, User) (Identifier, error) Count(context.Context) (uint64, error) }
UserStore defines interactions with User storage