store

package
v0.0.0-...-e8fbb80 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountUsers

func CountUsers(c context.Context) (int, error)

func CreateRepo

func CreateRepo(c context.Context, repo *model.Repo) error

func CreateUser

func CreateUser(c context.Context, user *model.User) error

func DeleteRepo

func DeleteRepo(c context.Context, repo *model.Repo) error

func DeleteUser

func DeleteUser(c context.Context, user *model.User) error

func GetRepo

func GetRepo(c context.Context, id int64) (*model.Repo, error)

func GetRepoByOwnerName

func GetRepoByOwnerName(c context.Context, owner, name string) (*model.Repo, error)

func GetUser

func GetUser(c context.Context, id int64) (*model.User, error)

func GetUserLogin

func GetUserLogin(c context.Context, login string) (*model.User, error)

func ToContext

func ToContext(c Setter, store Store)

ToContext adds the Store to this context if it supports the Setter interface.

func UpdateRepo

func UpdateRepo(c context.Context, repo *model.Repo) error

func UpdateUser

func UpdateUser(c context.Context, user *model.User) error

Types

type RepoStore

type RepoStore interface {
	// Get gets a repo by unique ID.
	Get(int64) (*model.Repo, error)

	// GetByName gets a repo by owner and name.
	GetByName(string, string) (*model.Repo, error)

	// Get all repos.
	GetRepoList() ([]*model.Repo, error)

	// Create creates a new repository.
	Create(*model.Repo) error

	// Update updates a repository.
	Update(*model.Repo) error

	// Delete deletes a user repository.
	Delete(*model.Repo) error
}

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

type Store

type Store interface {
	Users() UserStore
	Repos() RepoStore
}

func FromContext

func FromContext(c context.Context) Store

FromContext returns the Store associated with this context.

func New

func New(name string, users UserStore, repos RepoStore) Store

type UserStore

type UserStore interface {
	// Get gets user by unique ID.
	Get(int64) (*model.User, error)

	// GetLogin gets a user by unique Login name.
	GetLogin(string) (*model.User, error)

	// Count gets the number of users in the store.
	Count() (int, error)

	// Create creates a new user account.
	Create(*model.User) error

	// Update updates a user account.
	Update(*model.User) error

	// Delete deletes a user account.
	Delete(*model.User) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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