store

package
v0.0.0-...-92b63b8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Auth module storage
	Auth AuthStore
	// Comments module storage
	Comments CommentsStore
	// Reviews module storage
	Reviews ReviewsStore
)
View Source
var (
	// ErrUserExists returns in case of login is not free
	ErrUserExists = xerrors.New("User with such login already exists")
)

Functions

func InitStore

func InitStore()

InitStore and open database

Types

type AuthStore

type AuthStore interface {
	FindUserByLogin(login string) (User, error)
	CreateUser(user User) error
	UpdateUser(user User) error
	FindUsers(query string, exclude string) ([]User, error)
}

AuthStore provides access to auth module storage

type Comment

type Comment struct {
	ID       int `storm:"id,increment"`
	Author   string
	Created  int64
	Text     string
	ParentID int
	LineID   string
}

Comment represents information about comment

type CommentsStore

type CommentsStore interface {
	CreateComment(reviewID int, comment *Comment) error
	FindCommentByID(reviewID, id int) (Comment, error)
	CheckExists(reviewID, commentID int) (bool, error)
	CommentsForReview(reviewID int) ([]Comment, error)
}

CommentsStore provides access to comments module storage

type Review

type Review struct {
	ID       int    `storm:"id,increment"`
	File     []byte // TODO store id of versioned file
	Name     string
	Updated  int64
	Closed   bool
	Accepted bool
	Owner    string `storm:"index"`
	// TODO create custom index for reviewers
	Reviewers []string
}

Review represents information about review

type ReviewsStore

type ReviewsStore interface {
	CreateReview(review *Review) error
	FindReviewByID(id int) (Review, error)
	FindReviewsByOwner(owner string) ([]Review, error)
	FindReviewsByReviewer(reviewer string) ([]Review, error)
	UpdateReview(review *Review) error
}

ReviewsStore provides access to comments module storage

type User

type User struct {
	FirstName    string `storm:"index"`
	LastName     string `storm:"index"`
	Login        string `storm:"id"`
	PasswordHash string
}

User represents information about registered user

Jump to

Keyboard shortcuts

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