Documentation
¶
Index ¶
- Constants
- Variables
- func CreateRepo(db datastore.Database, repo *Repo) error
- func CreateRepos(db datastore.Database, repos []*Repo) error
- func CreateUser(db datastore.Database, user *User) error
- func DeleteRepo(db datastore.Database, name string) error
- func NewMockSession(config MockDBConfig) datastore.Session
- type MockDBConfig
- type Repo
- type User
- type UserClaims
Constants ¶
const ReposCollection = "repos"
ReposCollection is the name of the repos collection
const UserKey contextKey = 0
UserKey is the context key for the User data in the request context
const UsersCollection = "users"
UsersCollection is the name of the users collection
Variables ¶
var MockRepos = OfficialRepos
MockRepos contains the mocked repos returned by the database
var MockUser = &User{Name: "Rick Sanchez", Email: "rick@sanchez.com"}
MockUser contains the mock user returned by the database
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 ¶
CreateRepo takes a Repo object and saves it to the database Repos with the same name are updated
func CreateRepos ¶
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
CreateUser takes a User object and saves it to the database Users with the same email are updated
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
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
type UserClaims ¶ added in v0.5.2
type UserClaims struct { *User jwt.StandardClaims }
UserClaims describes a JWT claim for a user