Documentation ¶
Index ¶
- type IdeaStorage
- func (s *IdeaStorage) Add(title, description string, userID int) (*models.Idea, error)
- func (s *IdeaStorage) AddComment(number int, content string, userID int) (int, error)
- func (s *IdeaStorage) AddSupporter(number, userID int) error
- func (s *IdeaStorage) GetAll() ([]*models.Idea, error)
- func (s *IdeaStorage) GetByID(ideaID int) (*models.Idea, error)
- func (s *IdeaStorage) GetByNumber(number int) (*models.Idea, error)
- func (s *IdeaStorage) GetCommentsByIdea(number int) ([]*models.Comment, error)
- func (s *IdeaStorage) RemoveSupporter(number, userID int) error
- func (s *IdeaStorage) SetCurrentTenant(tenant *models.Tenant)
- func (s *IdeaStorage) SetCurrentUser(user *models.User)
- func (s *IdeaStorage) SetResponse(number int, text string, userID, status int) error
- func (s *IdeaStorage) SupportedBy(userID int) ([]int, error)
- func (s *IdeaStorage) Update(number int, title, description string) (*models.Idea, error)
- type TagStorage
- func (s *TagStorage) Add(name, color string, isPublic bool) (*models.Tag, error)
- func (s *TagStorage) AssignTag(tagID, ideaID, userID int) error
- func (s *TagStorage) Delete(tagID int) error
- func (s *TagStorage) GetAll() ([]*models.Tag, error)
- func (s *TagStorage) GetAssigned(ideaID int) ([]*models.Tag, error)
- func (s *TagStorage) GetBySlug(slug string) (*models.Tag, error)
- func (s *TagStorage) SetCurrentTenant(tenant *models.Tenant)
- func (s *TagStorage) SetCurrentUser(user *models.User)
- func (s *TagStorage) UnassignTag(tagID, ideaID int) error
- func (s *TagStorage) Update(tagID int, name, color string, isPublic bool) (*models.Tag, error)
- type TenantStorage
- func (s *TenantStorage) Activate(id int) error
- func (s *TenantStorage) Add(name string, subdomain string, status int) (*models.Tenant, error)
- func (s *TenantStorage) FindVerificationByKey(key string) (*models.SignInRequest, error)
- func (s *TenantStorage) First() (*models.Tenant, error)
- func (s *TenantStorage) GetByDomain(domain string) (*models.Tenant, error)
- func (s *TenantStorage) IsCNAMEAvailable(cname string) (bool, error)
- func (s *TenantStorage) IsSubdomainAvailable(subdomain string) (bool, error)
- func (s *TenantStorage) SaveVerificationKey(key string, duration time.Duration, email, name string) error
- func (s *TenantStorage) SetCurrentTenant(tenant *models.Tenant)
- func (s *TenantStorage) SetCurrentUser(user *models.User)
- func (s *TenantStorage) SetKeyAsVerified(key string) error
- func (s *TenantStorage) UpdateSettings(settings *models.UpdateTenantSettings) error
- type UserStorage
- func (s *UserStorage) ChangeRole(userID int, role models.Role) error
- func (s *UserStorage) GetAll() ([]*models.User, error)
- func (s *UserStorage) GetByEmail(tenantID int, email string) (*models.User, error)
- func (s *UserStorage) GetByID(userID int) (*models.User, error)
- func (s *UserStorage) GetByProvider(tenantID int, provider string, uid string) (*models.User, error)
- func (s *UserStorage) Register(user *models.User) error
- func (s *UserStorage) RegisterProvider(userID int, provider *models.UserProvider) error
- func (s *UserStorage) SetCurrentTenant(tenant *models.Tenant)
- func (s *UserStorage) SetCurrentUser(user *models.User)
- func (s *UserStorage) Update(userID int, settings *models.UpdateUserSettings) error
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 ¶ added in v0.7.0
func NewIdeaStorage() *IdeaStorage
NewIdeaStorage creates a new IdeaStorage
func (*IdeaStorage) AddComment ¶
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) SetCurrentTenant ¶ added in v0.8.0
func (s *IdeaStorage) SetCurrentTenant(tenant *models.Tenant)
SetCurrentTenant to current context
func (*IdeaStorage) SetCurrentUser ¶ added in v0.8.0
func (s *IdeaStorage) SetCurrentUser(user *models.User)
SetCurrentUser to current context
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 TagStorage ¶ added in v0.8.0
type TagStorage struct {
// contains filtered or unexported fields
}
TagStorage contains read and write operations for tags
func NewTagStorage ¶ added in v0.8.0
func NewTagStorage() *TagStorage
NewTagStorage creates a new TagStorage
func (*TagStorage) AssignTag ¶ added in v0.8.0
func (s *TagStorage) AssignTag(tagID, ideaID, userID int) error
AssignTag adds a tag to an idea
func (*TagStorage) Delete ¶ added in v0.8.0
func (s *TagStorage) Delete(tagID int) error
Delete a tag by its id
func (*TagStorage) GetAll ¶ added in v0.8.0
func (s *TagStorage) GetAll() ([]*models.Tag, error)
GetAll returns all tags
func (*TagStorage) GetAssigned ¶ added in v0.8.0
func (s *TagStorage) GetAssigned(ideaID int) ([]*models.Tag, error)
GetAssigned returns all tags assigned to given idea
func (*TagStorage) GetBySlug ¶ added in v0.8.0
func (s *TagStorage) GetBySlug(slug string) (*models.Tag, error)
GetBySlug returns tag by given slug
func (*TagStorage) SetCurrentTenant ¶ added in v0.8.0
func (s *TagStorage) SetCurrentTenant(tenant *models.Tenant)
SetCurrentTenant to current context
func (*TagStorage) SetCurrentUser ¶ added in v0.8.0
func (s *TagStorage) SetCurrentUser(user *models.User)
SetCurrentUser to current context
func (*TagStorage) UnassignTag ¶ added in v0.8.0
func (s *TagStorage) UnassignTag(tagID, ideaID int) error
UnassignTag removes a tag from an idea
type TenantStorage ¶
type TenantStorage struct {
// contains filtered or unexported fields
}
TenantStorage contains read and write operations for tenants
func (*TenantStorage) Activate ¶ added in v0.6.0
func (s *TenantStorage) Activate(id int) error
Activate given tenant
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) IsCNAMEAvailable ¶ added in v0.8.0
func (s *TenantStorage) IsCNAMEAvailable(cname string) (bool, error)
IsCNAMEAvailable returns true if cname is available to use
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
func (*TenantStorage) SetCurrentTenant ¶ added in v0.6.0
func (s *TenantStorage) SetCurrentTenant(tenant *models.Tenant)
SetCurrentTenant tenant
func (*TenantStorage) SetCurrentUser ¶ added in v0.8.0
func (s *TenantStorage) SetCurrentUser(user *models.User)
SetCurrentUser to current context
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
func (*UserStorage) ChangeRole ¶ added in v0.7.0
func (s *UserStorage) ChangeRole(userID int, role models.Role) error
ChangeRole of given user
func (*UserStorage) GetAll ¶ added in v0.7.0
func (s *UserStorage) GetAll() ([]*models.User, error)
GetAll return all users of current tenant
func (*UserStorage) GetByEmail ¶
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) SetCurrentTenant ¶ added in v0.8.0
func (s *UserStorage) SetCurrentTenant(tenant *models.Tenant)
SetCurrentTenant tenant
func (*UserStorage) SetCurrentUser ¶ added in v0.8.0
func (s *UserStorage) SetCurrentUser(user *models.User)
SetCurrentUser to current context
func (*UserStorage) Update ¶ added in v0.6.0
func (s *UserStorage) Update(userID int, settings *models.UpdateUserSettings) error
Update user settings