cayley

package
v0.0.0-...-8a4eff6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	*cayley.Handle
}

func NewStore

func NewStore(dbpath string) (*Store, error)

NewStore creates a new store based on a cayley graph db on a bolt file situated at dbPath. If the path does not exist, it will be created.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying store, returning the error if any.

type TeamRepository

type TeamRepository struct {
	// contains filtered or unexported fields
}

func NewTeamRepository

func NewTeamRepository(store *Store) *TeamRepository

NewUserRepository creates a new user repository based on a store.

func (*TeamRepository) Delete

func (r *TeamRepository) Delete(id int) error

func (*TeamRepository) Get

func (r *TeamRepository) Get(id int) (auth.Team, error)

func (*TeamRepository) GetForUser

func (r *TeamRepository) GetForUser(userID int) ([]auth.Team, error)

func (*TeamRepository) Upsert

func (r *TeamRepository) Upsert(team *auth.Team) error

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

func NewUserRepository

func NewUserRepository(store *Store) *UserRepository

NewUserRepository creates a new user repository based on a store.

func (*UserRepository) Delete

func (r *UserRepository) Delete(id int) error

Delete removes a user from the database based on its id.

func (*UserRepository) Get

func (r *UserRepository) Get(id int) (auth.User, error)

Get retrieves a user from its id.

func (*UserRepository) GetByEmail

func (r *UserRepository) GetByEmail(email string) (auth.User, error)

func (*UserRepository) List

func (r *UserRepository) List() ([]auth.User, error)

List returns all the user in the database

func (*UserRepository) PaperOwner

func (r *UserRepository) PaperOwner(paperID int) (int, error)

PaperOwner retrieves for a paper defined by its id the user id of the owner of that paper. This supposes that there is only one owner for a given paper. It is the responsibility of the caller to ensure that by checking if a paper already has an owner before adding a new link (for now).

func (*UserRepository) Upsert

func (r *UserRepository) Upsert(user *auth.User) error

Upsert updates the user passed as argument in the database. If the user has no ID (i.e. user.ID == 0), this method sets the user ID before inserting.

Jump to

Keyboard shortcuts

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