Documentation
¶
Index ¶
- Constants
- Variables
- func ById(userId string) db.Q
- func ByIds(userIds ...string) db.Q
- func Count(query db.Q) (int, error)
- func UpdateAll(query interface{}, update interface{}) error
- func UpdateOne(query interface{}, update interface{}) error
- func UpsertOne(query interface{}, update interface{}) (*mgo.ChangeInfo, error)
- type DBUser
- func (u *DBUser) AddPublicKey(keyName, keyValue string) error
- func (u *DBUser) DeletePublicKey(keyName string) error
- func (u *DBUser) DisplayName() string
- func (u *DBUser) Email() string
- func (u *DBUser) GetAPIKey() string
- func (u *DBUser) GetPublicKey(keyname string) (string, error)
- func (u *DBUser) IncPatchNumber() (int, error)
- func (u *DBUser) Insert() error
- func (u *DBUser) IsNil() bool
- func (u *DBUser) PublicKeys() []PubKey
- func (u *DBUser) Username() string
- type GithubUser
- type PubKey
- type UserSettings
Constants ¶
View Source
const (
Collection = "users"
)
Variables ¶
View Source
var ( IdKey = bsonutil.MustHaveTag(DBUser{}, "Id") FirstNameKey = bsonutil.MustHaveTag(DBUser{}, "FirstName") LastNameKey = bsonutil.MustHaveTag(DBUser{}, "LastName") DispNameKey = bsonutil.MustHaveTag(DBUser{}, "DispName") EmailAddressKey = bsonutil.MustHaveTag(DBUser{}, "EmailAddress") PatchNumberKey = bsonutil.MustHaveTag(DBUser{}, "PatchNumber") CreatedAtKey = bsonutil.MustHaveTag(DBUser{}, "CreatedAt") SettingsKey = bsonutil.MustHaveTag(DBUser{}, "Settings") APIKeyKey = bsonutil.MustHaveTag(DBUser{}, "APIKey") PubKeysKey = bsonutil.MustHaveTag(DBUser{}, "PubKeys") )
View Source
var ( PubKeyNameKey = bsonutil.MustHaveTag(PubKey{}, "Name") PubKeyKey = bsonutil.MustHaveTag(PubKey{}, "Key") PubKeyNCreatedAtKey = bsonutil.MustHaveTag(PubKey{}, "CreatedAt") )
View Source
var (
SettingsTZKey = bsonutil.MustHaveTag(UserSettings{}, "Timezone")
)
Functions ¶
func UpdateAll ¶
func UpdateAll(query interface{}, update interface{}) error
UpdateAll updates all users.
func UpdateOne ¶
func UpdateOne(query interface{}, update interface{}) error
UpdateOne updates one user.
func UpsertOne ¶
func UpsertOne(query interface{}, update interface{}) (*mgo.ChangeInfo, error)
UpsertOne upserts a user.
Types ¶
type DBUser ¶
type DBUser struct {
Id string `bson:"_id"`
FirstName string `bson:"first_name"`
LastName string `bson:"last_name"`
DispName string `bson:"display_name"`
EmailAddress string `bson:"email"`
PatchNumber int `bson:"patch_number"`
PubKeys []PubKey `bson:"public_keys" json:"public_keys"`
CreatedAt time.Time `bson:"created_at"`
Settings UserSettings `bson:"settings"`
APIKey string `bson:"apikey"`
}
func FindByGithubUID ¶
func (*DBUser) AddPublicKey ¶
func (*DBUser) DeletePublicKey ¶
func (*DBUser) DisplayName ¶
func (*DBUser) IncPatchNumber ¶
IncPatchNumber increases the count for the user's patch submissions by one, and then returns the new count.
func (*DBUser) PublicKeys ¶
type GithubUser ¶
type UserSettings ¶
type UserSettings struct {
Timezone string `json:"timezone" bson:"timezone"`
NewWaterfall bool `json:"new_waterfall" bson:"new_waterfall"`
GithubUser GithubUser `json:"github_user" bson:"github_user,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.