postgres

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2017 License: GPL-3.0 Imports: 9 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 NewIdeaStorage

func NewIdeaStorage(tenant *models.Tenant, trx *dbx.Trx) *IdeaStorage

NewIdeaStorage creates a new IdeaStorage

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

func (*IdeaStorage) Update added in v0.4.0

func (s *IdeaStorage) Update(number int, title, description string) (*models.Idea, error)

Update given idea

type TenantStorage

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

TenantStorage contains read and write operations for tenants

func NewTenantStorage

func NewTenantStorage(trx *dbx.Trx) *TenantStorage

NewTenantStorage creates a new TenantStorage

func (*TenantStorage) Activate added in v0.6.0

func (s *TenantStorage) Activate(id int) error

Activate given tenant

func (*TenantStorage) Add

func (s *TenantStorage) Add(name string, subdomain string, status int) (*models.Tenant, error)

Add given tenant to tenant list

func (*TenantStorage) FindVerificationByKey added in v0.6.0

func (s *TenantStorage) FindVerificationByKey(key string) (*models.SignInRequest, error)

FindVerificationByKey based on current tenant

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

func (*TenantStorage) SaveVerificationKey added in v0.6.0

func (s *TenantStorage) SaveVerificationKey(key string, duration time.Duration, email, name string) error

SaveVerificationKey used by e-mail verification process

func (*TenantStorage) SetCurrentTenant added in v0.6.0

func (s *TenantStorage) SetCurrentTenant(tenant *models.Tenant)

SetCurrentTenant tenant

func (*TenantStorage) SetKeyAsVerified added in v0.6.0

func (s *TenantStorage) SetKeyAsVerified(key string) error

SetKeyAsVerified so that it cannot be used anymore

func (*TenantStorage) UpdateSettings added in v0.4.0

func (s *TenantStorage) UpdateSettings(settings *models.UpdateTenantSettings) error

UpdateSettings of given tenant

type UserStorage

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

UserStorage is used for user operations using a Postgres database

func NewUserStorage

func NewUserStorage(trx *dbx.Trx) *UserStorage

NewUserStorage creates a new UserStorage

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) GetByProvider added in v0.4.0

func (s *UserStorage) GetByProvider(tenantID int, provider string, uid string) (*models.User, error)

GetByProvider returns a user based on provider details

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

func (*UserStorage) Update added in v0.6.0

func (s *UserStorage) Update(userID int, settings *models.UpdateUserSettings) error

Update user settings

Jump to

Keyboard shortcuts

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