inmemory

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 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 added in v0.7.0

func NewIdeaStorage() *IdeaStorage

NewIdeaStorage creates a new IdeaStorage

func (*IdeaStorage) Add

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

Add a new idea in the database

func (*IdeaStorage) AddComment

func (s *IdeaStorage) AddComment(idea *models.Idea, content string) (int, error)

AddComment places a new comment on an idea

func (*IdeaStorage) AddSubscriber added in v0.10.0

func (s *IdeaStorage) AddSubscriber(idea *models.Idea, user *models.User) error

AddSubscriber adds user to the idea list of subscribers

func (*IdeaStorage) AddSupporter

func (s *IdeaStorage) AddSupporter(idea *models.Idea, user *models.User) error

AddSupporter adds user to idea list of supporters

func (*IdeaStorage) CountPerStatus added in v0.10.0

func (s *IdeaStorage) CountPerStatus() (map[int]int, error)

CountPerStatus returns total number of ideas per status

func (*IdeaStorage) GetActiveSubscribers added in v0.10.0

func (s *IdeaStorage) GetActiveSubscribers(number int, channel models.NotificationChannel, event models.NotificationEvent) ([]*models.User, error)

GetActiveSubscribers based on input and settings

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) GetBySlug added in v0.9.0

func (s *IdeaStorage) GetBySlug(slug string) (*models.Idea, error)

GetBySlug returns idea by tenant and slug

func (*IdeaStorage) GetCommentByID added in v0.11.0

func (s *IdeaStorage) GetCommentByID(id int) (*models.Comment, error)

GetCommentByID returns a comment by given ID

func (*IdeaStorage) GetCommentsByIdea

func (s *IdeaStorage) GetCommentsByIdea(idea *models.Idea) ([]*models.Comment, error)

GetCommentsByIdea returns all comments from given idea

func (*IdeaStorage) IsReferenced added in v0.11.0

func (s *IdeaStorage) IsReferenced(idea *models.Idea) (bool, error)

IsReferenced returns true if another idea is referencing given idea

func (*IdeaStorage) MarkAsDuplicate added in v0.9.0

func (s *IdeaStorage) MarkAsDuplicate(idea *models.Idea, original *models.Idea) error

MarkAsDuplicate set idea as a duplicate of another idea

func (*IdeaStorage) RemoveSubscriber added in v0.10.0

func (s *IdeaStorage) RemoveSubscriber(idea *models.Idea, user *models.User) error

RemoveSubscriber removes user from idea list of subscribers

func (*IdeaStorage) RemoveSupporter

func (s *IdeaStorage) RemoveSupporter(idea *models.Idea, user *models.User) error

RemoveSupporter removes user from idea list of supporters

func (*IdeaStorage) Search added in v0.10.0

func (s *IdeaStorage) Search(query, filter string, tags []string) ([]*models.Idea, error)

Search existing ideas based on input

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(idea *models.Idea, text string, status int) error

SetResponse changes current idea response

func (*IdeaStorage) SupportedBy

func (s *IdeaStorage) SupportedBy() ([]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(idea *models.Idea, title, description string) (*models.Idea, error)

Update given idea

func (*IdeaStorage) UpdateComment added in v0.11.0

func (s *IdeaStorage) UpdateComment(id int, content string) error

UpdateComment with given ID and content

type NotificationStorage added in v0.10.0

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

NotificationStorage contains read and write operations for notifications

func NewNotificationStorage added in v0.10.0

func NewNotificationStorage() *NotificationStorage

NewNotificationStorage creates a new NotificationStorage

func (*NotificationStorage) GetActiveNotifications added in v0.10.0

func (s *NotificationStorage) GetActiveNotifications() ([]*models.Notification, error)

GetActiveNotifications returns all unread notifications and last 30 days of read notifications

func (*NotificationStorage) GetNotification added in v0.10.0

func (s *NotificationStorage) GetNotification(id int) (*models.Notification, error)

GetNotification returns notification by id

func (*NotificationStorage) Insert added in v0.10.0

func (s *NotificationStorage) Insert(user *models.User, title, link string, ideaID int) (*models.Notification, error)

Insert notification for given user

func (*NotificationStorage) MarkAllAsRead added in v0.10.0

func (s *NotificationStorage) MarkAllAsRead() error

MarkAllAsRead of current user

func (*NotificationStorage) MarkAsRead added in v0.10.0

func (s *NotificationStorage) MarkAsRead(id int) error

MarkAsRead given id of current user

func (*NotificationStorage) SetCurrentTenant added in v0.10.0

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

SetCurrentTenant to current context

func (*NotificationStorage) SetCurrentUser added in v0.10.0

func (s *NotificationStorage) SetCurrentUser(user *models.User)

SetCurrentUser to current context

func (*NotificationStorage) TotalUnread added in v0.10.0

func (s *NotificationStorage) TotalUnread() (int, error)

TotalUnread returns the number of unread notifications for current 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) Add added in v0.8.0

func (s *TagStorage) Add(name, color string, isPublic bool) (*models.Tag, error)

Add creates a new tag with given input

func (*TagStorage) AssignTag added in v0.8.0

func (s *TagStorage) AssignTag(tag *models.Tag, idea *models.Idea) error

AssignTag adds a tag to an idea

func (*TagStorage) Delete added in v0.8.0

func (s *TagStorage) Delete(tag *models.Tag) 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(idea *models.Idea) ([]*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(tag *models.Tag, idea *models.Idea) error

UnassignTag removes a tag from an idea

func (*TagStorage) Update added in v0.8.0

func (s *TagStorage) Update(tag *models.Tag, name, color string, isPublic bool) (*models.Tag, error)

Update a tag with given input

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) 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(kind models.EmailVerificationKind, key string) (*models.EmailVerification, 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 (s *TenantStorage) GetLogo(id int) (*models.Upload, error)

GetLogo returns tenant logo by id

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, request models.NewEmailVerification) error

SaveVerificationKey used by email 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) UpdateAdvancedSettings added in v0.13.0

func (s *TenantStorage) UpdateAdvancedSettings(settings *models.UpdateTenantAdvancedSettings) error

UpdateAdvancedSettings of current tenant

func (*TenantStorage) UpdatePrivacy added in v0.12.0

func (s *TenantStorage) UpdatePrivacy(settings *models.UpdateTenantPrivacy) error

UpdatePrivacy settings of current tenant

func (*TenantStorage) UpdateSettings added in v0.4.0

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

UpdateSettings of current tenant

type UserStorage

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

UserStorage is used for user operations

func (*UserStorage) ChangeEmail added in v0.9.0

func (s *UserStorage) ChangeEmail(userID int, email string) error

ChangeEmail of given user

func (*UserStorage) ChangeRole added in v0.7.0

func (s *UserStorage) ChangeRole(userID int, role models.Role) error

ChangeRole of given user

func (*UserStorage) Delete added in v0.13.0

func (s *UserStorage) Delete() error

Delete removes current user personal data and mark it as deleted

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

func (s *UserStorage) GetByEmail(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(provider string, uid string) (*models.User, error)

GetByProvider returns a user based on provider details

func (*UserStorage) GetUserSettings added in v0.10.0

func (s *UserStorage) GetUserSettings() (map[string]string, error)

GetUserSettings returns current user's settings

func (*UserStorage) HasSubscribedTo added in v0.10.0

func (s *UserStorage) HasSubscribedTo(ideaID int) (bool, error)

HasSubscribedTo returns true if current user is receiving notification from specific idea

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(settings *models.UpdateUserSettings) error

Update user settings

func (*UserStorage) UpdateSettings added in v0.10.0

func (s *UserStorage) UpdateSettings(settings map[string]string) error

UpdateSettings of given user

Jump to

Keyboard shortcuts

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