inmemory

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2017 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 IdeaStorage

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

IdeaStorage contains read and write operations for ideas

func (*IdeaStorage) Add

func (s *IdeaStorage) Add(title, description string, userID int) (*models.Idea, error)

Add a new idea in the database

func (*IdeaStorage) AddComment

func (s *IdeaStorage) AddComment(number int, content string, userID int) (int, error)

AddComment places a new comment on an idea

func (*IdeaStorage) AddSupporter

func (s *IdeaStorage) AddSupporter(number, userID int) error

AddSupporter adds user to idea list of supporters

func (*IdeaStorage) GetAll

func (s *IdeaStorage) GetAll() ([]*models.Idea, error)

GetAll returns all tenant ideas

func (*IdeaStorage) GetByID

func (s *IdeaStorage) GetByID(ideaID int) (*models.Idea, error)

GetByID returns idea by given id

func (*IdeaStorage) GetByNumber

func (s *IdeaStorage) GetByNumber(number int) (*models.Idea, error)

GetByNumber returns idea by tenant and number

func (*IdeaStorage) GetCommentsByIdea

func (s *IdeaStorage) GetCommentsByIdea(number int) ([]*models.Comment, error)

GetCommentsByIdea returns all coments from given idea

func (*IdeaStorage) RemoveSupporter

func (s *IdeaStorage) RemoveSupporter(number, userID int) error

RemoveSupporter removes user from idea list of supporters

func (*IdeaStorage) SetResponse

func (s *IdeaStorage) SetResponse(number int, text string, userID, status int) error

SetResponse changes current idea response

func (*IdeaStorage) SupportedBy

func (s *IdeaStorage) SupportedBy(userID int) ([]int, error)

SupportedBy returns a list of Idea ID supported by given user

type TenantStorage

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

TenantStorage contains read and write operations for tenants

func (*TenantStorage) Add

func (s *TenantStorage) Add(tenant *models.Tenant) error

Add given tenant to tenant list

func (*TenantStorage) First

func (s *TenantStorage) First() (*models.Tenant, error)

First returns first tenant

func (*TenantStorage) GetByDomain

func (s *TenantStorage) GetByDomain(domain string) (*models.Tenant, error)

GetByDomain returns a tenant based on its domain

func (*TenantStorage) IsSubdomainAvailable

func (s *TenantStorage) IsSubdomainAvailable(subdomain string) (bool, error)

IsSubdomainAvailable returns true if subdomain is available to use

type UserStorage

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

UserStorage is used for user operations

func (*UserStorage) GetByEmail

func (s *UserStorage) GetByEmail(tenantID int, email string) (*models.User, error)

GetByEmail returns a user based on given email

func (*UserStorage) GetByID

func (s *UserStorage) GetByID(userID int) (*models.User, error)

GetByID returns a user based on given id

func (*UserStorage) Register

func (s *UserStorage) Register(user *models.User) error

Register creates a new user based on given information

func (*UserStorage) RegisterProvider

func (s *UserStorage) RegisterProvider(userID int, provider *models.UserProvider) error

RegisterProvider adds given provider to userID

Jump to

Keyboard shortcuts

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