store

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2017 License: Apache-2.0 Imports: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRepo

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

CreateRepo creates a new repository.

func CreateUser

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

CreateUser creates a new user account.

func DeleteRepo

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

DeleteRepo deletes a user repository.

func DeleteUser

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

DeleteUser deletes a user account.

func GetRepo

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

GetRepo gets a repo by unique ID.

func GetRepoIntersect

func GetRepoIntersect(c context.Context, repos []*model.Repo) ([]*model.Repo, error)

GetRepoIntersect gets a repo list by account login.

func GetRepoIntersectMap

func GetRepoIntersectMap(c context.Context, repos []*model.Repo) (map[string]*model.Repo, error)

GetRepoIntersectMap gets a repo set by account login where the key is the repository slug and the value is the repository struct.

func GetRepoMulti

func GetRepoMulti(c context.Context, slug ...string) ([]*model.Repo, error)

GetRepoMulti gets a list of multiple repos by their full name.

func GetRepoOwner

func GetRepoOwner(c context.Context, owner string) ([]*model.Repo, error)

GetRepoOwner gets a repo list by account.

func GetRepoOwnerName

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

GetRepoOwnerName gets a repo by its owner and name.

func GetRepoSlug

func GetRepoSlug(c context.Context, slug string) (*model.Repo, error)

GetRepoSlug gets a repo by its full name.

func GetUser

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

GetUser gets a user by unique ID.

func GetUserLogin

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

GetUserLogin gets a user by unique Login name.

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

UpdateRepo updates a user repository.

func UpdateUser

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

UpdateUser updates a user account.

Types

type Setter

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

Setter defines a context that enables setting values.

type Store

type Store interface {
	// GetUser gets a user by unique ID.
	GetUser(int64) (*model.User, error)

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

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

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

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

	// GetRepo gets a repo by unique ID.
	GetRepo(int64) (*model.Repo, error)

	// GetRepoSlug gets a repo by its full name.
	GetRepoSlug(string) (*model.Repo, error)

	// GetRepoMulti gets a list of multiple repos by their full name.
	GetRepoMulti(...string) ([]*model.Repo, error)

	// GetRepoOwner gets a list by owner.
	GetRepoOwner(string) ([]*model.Repo, error)

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

	// UpdateRepo updates a user repository.
	UpdateRepo(*model.Repo) error

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

Store defines a data storage abstraction for managing structured data in the system.

func FromContext

func FromContext(c context.Context) Store

FromContext returns the Store associated with this context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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