usersstore

package
v0.0.0-...-dcf5b65 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge

type Badge struct {
	UserID                        string            `bson:"user_id"`
	CurrentLevel                  int64             `bson:"current_level,omitempty"`
	DisplayName                   string            `bson:"display_name,omitempty"`
	Id                            string            `bson:"_id"`
	LinesOfCodeToNextLevel        int64             `bson:"lines_of_code_to_next_level,omitempty"`
	Points                        int64             `bson:"points,omitempty"`
	ProgressPercentageToNextLevel int64             `bson:"progress_percentage_to_next_level,omitempty"`
	TimeCreated                   time.Time         `bson:"time_created,omitempty"`
	TimeUpdated                   time.Time         `bson:"time_updated,omitempty"`
	Ownership                     *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewBadge

func NewBadge() *Badge

func (*Badge) Get

func (badge *Badge) Get(field string) interface{}

type BadgeFilters

type BadgeFilters struct {
	Ids []string

	User *User
}

type BadgeSortBy

type BadgeSortBy uint8
const (
	BadgeSortByDefault BadgeSortBy = iota
	BadgeSortByPoints
	BadgeSortByTimeCreated
)

func GetBadgeSortByFromString

func GetBadgeSortByFromString(s string) BadgeSortBy

func (BadgeSortBy) CursorType

func (s BadgeSortBy) CursorType() cursor.ValueType

func (BadgeSortBy) String

func (s BadgeSortBy) String() string

type BadgeUpdate

type BadgeUpdate struct {
	CurrentLevel                  *int64     `bson:"current_level,omitempty"`
	LinesOfCodeToNextLevel        *int64     `bson:"lines_of_code_to_next_level,omitempty"`
	Points                        *int64     `bson:"points,omitempty"`
	ProgressPercentageToNextLevel *int64     `bson:"progress_percentage_to_next_level,omitempty"`
	TimeUpdated                   *time.Time `bson:"time_updated,omitempty"`
}

type CursorCheckpoints

type CursorCheckpoints struct {
	PullRequests string            `bson:"pull_requests,omitempty"`
	Ownership    *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewCursorCheckpoints

func NewCursorCheckpoints() *CursorCheckpoints

func (*CursorCheckpoints) Get

func (cursor_checkpoints *CursorCheckpoints) Get(field string) interface{}

type CursorCheckpointsFilters

type CursorCheckpointsFilters struct {
	Ids []string
}

type CursorCheckpointsSortBy

type CursorCheckpointsSortBy uint8
const (
	CursorCheckpointsSortByDefault CursorCheckpointsSortBy = iota
)

func GetCursorCheckpointsSortByFromString

func GetCursorCheckpointsSortByFromString(s string) CursorCheckpointsSortBy

func (CursorCheckpointsSortBy) CursorType

func (s CursorCheckpointsSortBy) CursorType() cursor.ValueType

func (CursorCheckpointsSortBy) String

func (s CursorCheckpointsSortBy) String() string

type GitContributionStats

type GitContributionStats struct {
	Issues       int64             `bson:"issues,omitempty"`
	PullRequests int64             `bson:"pull_requests,omitempty"`
	Ownership    *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewGitContributionStats

func NewGitContributionStats() *GitContributionStats

func (*GitContributionStats) Get

func (git_contribution_stats *GitContributionStats) Get(field string) interface{}

type GitContributionStatsFilters

type GitContributionStatsFilters struct {
	Ids []string
}

type GitContributionStatsSortBy

type GitContributionStatsSortBy uint8
const (
	GitContributionStatsSortByDefault GitContributionStatsSortBy = iota
)

func GetGitContributionStatsSortByFromString

func GetGitContributionStatsSortByFromString(s string) GitContributionStatsSortBy

func (GitContributionStatsSortBy) CursorType

func (GitContributionStatsSortBy) String

type Reputation

type Reputation struct {
	ContributionsToPopularRepos   int64             `bson:"contributions_to_popular_repos,omitempty"`
	ContributionsToUnpopularRepos int64             `bson:"contributions_to_unpopular_repos,omitempty"`
	Value                         float64           `bson:"value,omitempty"`
	Ownership                     *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewReputation

func NewReputation() *Reputation

func (*Reputation) Get

func (reputation *Reputation) Get(field string) interface{}

type ReputationFilters

type ReputationFilters struct {
	Ids []string
}

type ReputationSortBy

type ReputationSortBy uint8
const (
	ReputationSortByDefault ReputationSortBy = iota
)

func GetReputationSortByFromString

func GetReputationSortByFromString(s string) ReputationSortBy

func (ReputationSortBy) CursorType

func (s ReputationSortBy) CursorType() cursor.ValueType

func (ReputationSortBy) String

func (s ReputationSortBy) String() string

type Store

type Store interface {
	// user methods
	GetUserByID(ctx context.Context, id string) (*User, error)
	GetOneUser(ctx context.Context, filters *UserFilters) (*User, error)
	GetUsers(ctx context.Context, filters *UserFilters, after *string, before *string, first *int64, last *int64, sortBy UserSortBy, sortOrder *string) ([]*User, bool, bool, []string, error)
	CountUsers(ctx context.Context, filters *UserFilters) (int64, error)
	CreateUser(ctx context.Context, user *User, ownership *authorizer.Scope) (*User, error)
	UpdateUser(ctx context.Context, id string, update *UserUpdate) error
	DeleteUserByID(ctx context.Context, id string) error
	// badge methods
	GetBadgeByID(ctx context.Context, id string) (*Badge, error)
	GetOneBadge(ctx context.Context, filters *BadgeFilters) (*Badge, error)
	GetBadges(ctx context.Context, filters *BadgeFilters, after *string, before *string, first *int64, last *int64, sortBy BadgeSortBy, sortOrder *string) ([]*Badge, bool, bool, []string, error)
	CountBadges(ctx context.Context, filters *BadgeFilters) (int64, error)
	CreateBadge(ctx context.Context, badge *Badge, ownership *authorizer.Scope) (*Badge, error)
	UpdateBadge(ctx context.Context, id string, update *BadgeUpdate) error
	DeleteBadgeByID(ctx context.Context, id string) error
}

type Tags

type Tags struct {
	Languages   []*string         `bson:"languages,omitempty"`
	RecentRepos []*string         `bson:"recent_repos,omitempty"`
	Topics      []*string         `bson:"topics,omitempty"`
	Ownership   *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewTags

func NewTags() *Tags

func (*Tags) Get

func (tags *Tags) Get(field string) interface{}

type TagsFilters

type TagsFilters struct {
	Ids []string
}

type TagsSortBy

type TagsSortBy uint8
const (
	TagsSortByDefault TagsSortBy = iota
)

func GetTagsSortByFromString

func GetTagsSortByFromString(s string) TagsSortBy

func (TagsSortBy) CursorType

func (s TagsSortBy) CursorType() cursor.ValueType

func (TagsSortBy) String

func (s TagsSortBy) String() string

type Token

type Token struct {
	AccessToken  string            `bson:"access_token,omitempty"`
	Expiry       time.Time         `bson:"expiry,omitempty"`
	RefreshToken string            `bson:"refresh_token,omitempty"`
	TokenType    string            `bson:"token_type,omitempty"`
	Ownership    *authorizer.Scope `bson:"ownership,omitempty"`
}

func NewToken

func NewToken() *Token

func (*Token) Get

func (token *Token) Get(field string) interface{}

type TokenFilters

type TokenFilters struct {
	Ids []string
}

type TokenSortBy

type TokenSortBy uint8
const (
	TokenSortByDefault TokenSortBy = iota
)

func GetTokenSortByFromString

func GetTokenSortByFromString(s string) TokenSortBy

func (TokenSortBy) CursorType

func (s TokenSortBy) CursorType() cursor.ValueType

func (TokenSortBy) String

func (s TokenSortBy) String() string

type User

type User struct {
	Avatar               string                  `bson:"avatar,omitempty"`
	Bio                  string                  `bson:"bio,omitempty"`
	CursorCheckpoints    *CursorCheckpoints      `bson:"cursor_checkpoints,omitempty"`
	GitContributionStats *GitContributionStats   `bson:"git_contribution_stats,omitempty"`
	Handle               string                  `bson:"handle,omitempty"`
	Id                   string                  `bson:"_id"`
	Name                 string                  `bson:"name,omitempty"`
	Reputation           *Reputation             `bson:"reputation,omitempty"`
	Tags                 *Tags                   `bson:"tags,omitempty"`
	TimeCreated          time.Time               `bson:"time_created,omitempty"`
	TimeUpdated          time.Time               `bson:"time_updated,omitempty"`
	Token                *Token                  `bson:"token,omitempty"`
	Permissions          []authorizer.Permission `bson:"permissions,omitempty"`
	Ownership            *authorizer.Scope       `bson:"ownership,omitempty"`
}

func NewUser

func NewUser() *User

func (*User) Get

func (user *User) Get(field string) interface{}

type UserFilters

type UserFilters struct {
	Ids    []string
	Search *string
	Handle *string
}

type UserSortBy

type UserSortBy uint8
const (
	UserSortByDefault UserSortBy = iota
	UserSortByTimeCreated
)

func GetUserSortByFromString

func GetUserSortByFromString(s string) UserSortBy

func (UserSortBy) CursorType

func (s UserSortBy) CursorType() cursor.ValueType

func (UserSortBy) String

func (s UserSortBy) String() string

type UserUpdate

type UserUpdate struct {
	Avatar               *string               `bson:"avatar,omitempty"`
	Bio                  *string               `bson:"bio,omitempty"`
	CursorCheckpoints    *CursorCheckpoints    `bson:"cursor_checkpoints,omitempty"`
	GitContributionStats *GitContributionStats `bson:"git_contribution_stats,omitempty"`
	Name                 *string               `bson:"name,omitempty"`
	Reputation           *Reputation           `bson:"reputation,omitempty"`
	Tags                 *Tags                 `bson:"tags,omitempty"`
	TimeUpdated          *time.Time            `bson:"time_updated,omitempty"`
	Token                *Token                `bson:"token,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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