models

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ReposCollection = "repos"

ReposCollection is the name of the repos collection

View Source
const UserKey contextKey = 0

UserKey is the context key for the User data in the request context

View Source
const UsersCollection = "users"

UsersCollection is the name of the users collection

Variables

View Source
var MockRepos = OfficialRepos

MockRepos contains the mocked repos returned by the database

View Source
var MockUser = &User{Name: "Rick Sanchez", Email: "rick@sanchez.com"}

MockUser contains the mock user returned by the database

View Source
var OfficialRepos = []*Repo{
	{
		Name:   "stable",
		URL:    "https://kubernetes-charts.storage.googleapis.com",
		Source: "https://github.com/kubernetes/charts/tree/master/stable",
	},
	{
		Name:   "incubator",
		URL:    "https://kubernetes-charts-incubator.storage.googleapis.com",
		Source: "https://github.com/kubernetes/charts/tree/master/incubator",
	},
}

OfficialRepos are the official Kubernetes repos

Functions

func CreateRepo

func CreateRepo(db datastore.Database, repo *Repo) error

CreateRepo takes a Repo object and saves it to the database Repos with the same name are updated

func CreateRepos

func CreateRepos(db datastore.Database, repos []*Repo) error

CreateRepos takes an array of Repos and saves them to the database Repos with the same name are updated

func CreateUser added in v0.5.2

func CreateUser(db datastore.Database, user *User) error

CreateUser takes a User object and saves it to the database Users with the same email are updated

func DeleteRepo

func DeleteRepo(db datastore.Database, name string) error

DeleteRepo by name

func NewMockSession added in v0.5.2

func NewMockSession(config MockDBConfig) datastore.Session

NewMockSession returns a mocked Session

Types

type MockDBConfig added in v0.5.2

type MockDBConfig struct {
	// If WantErr is set to true, all collection methods and query methods will return errors
	WantErr bool
	// If Empty is set to true, the Query methods will not affect the result parameter
	Empty bool
}

MockDBConfig describes configuration for the mock db session

type Repo

type Repo struct {
	ID     bson.ObjectId `json:"-" bson:"_id,omitempty"`
	Name   string        `json:"name" valid:"alpha,required"`
	URL    string        `json:"url" valid:"url,required"`
	Source string        `json:"source"`
}

Repo describes a chart repository

func GetRepo

func GetRepo(db datastore.Database, name string) (*Repo, error)

GetRepo by name

func ListRepos

func ListRepos(db datastore.Database) ([]*Repo, error)

ListRepos returns a list of all repos

type User added in v0.5.2

type User struct {
	ID    bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Name  string        `json:"name"`
	Email string        `json:"email"`
	// contains filtered or unexported fields
}

User describes a user

func GetUserByEmail added in v0.5.2

func GetUserByEmail(db datastore.Database, email string) (*User, error)

GetUserByEmail finds a user given an email

type UserClaims added in v0.5.2

type UserClaims struct {
	*User
	jwt.StandardClaims
}

UserClaims describes a JWT claim for a user

Jump to

Keyboard shortcuts

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