Documentation ¶
Index ¶
- Constants
- Variables
- type CommunityRepository
- func (self *CommunityRepository) Create(ctx context.Context, community model.Community) (*model.Community, error)
- func (self *CommunityRepository) GetByID(ctx context.Context, id string) (*model.Community, error)
- func (self *CommunityRepository) GetByIDs(ctx context.Context, ids []string) ([]model.Community, error)
- func (self *CommunityRepository) UpdatePinned(ctx context.Context, id string, pinnedIDs []string) error
- type InvitationRepository
- func (self *InvitationRepository) Create(ctx context.Context, invitation model.Invitation) (*model.Invitation, error)
- func (self *InvitationRepository) DeleteByID(ctx context.Context, id string) error
- func (self *InvitationRepository) DeleteByIDs(ctx context.Context, ids []string) error
- func (self *InvitationRepository) GetByID(ctx context.Context, id string) (*model.Invitation, error)
- func (self *InvitationRepository) GetByPhone(ctx context.Context, phone string) (*model.Invitation, error)
- func (self *InvitationRepository) List(ctx context.Context, phone string) ([]model.Invitation, error)
- type MembershipRepository
- func (self *MembershipRepository) Create(ctx context.Context, membership model.Membership) (*model.Membership, error)
- func (self *MembershipRepository) GetByID(ctx context.Context, id string) (*model.Membership, error)
- func (self *MembershipRepository) GetByIDsAndCommunity(ctx context.Context, ids []string, communityID string) ([]model.Membership, error)
- func (self *MembershipRepository) GetByUserAndCommunity(ctx context.Context, userID string, communityID string) (*model.Membership, error)
- func (self *MembershipRepository) ListByCommunity(ctx context.Context, communityID string) ([]model.Membership, error)
- func (self *MembershipRepository) ListByUser(ctx context.Context, userID string) ([]model.Membership, error)
- func (self *MembershipRepository) UpdateDeletedAt(ctx context.Context, id string, deletedAt *time.Time) error
- type OTPRepository
- func (self *OTPRepository) Create(ctx context.Context, otp model.OTP) (*model.OTP, error)
- func (self *OTPRepository) Delete(ctx context.Context, id string) error
- func (self *OTPRepository) GetByAsset(ctx context.Context, asset string) (*model.OTP, error)
- func (self *OTPRepository) GetByID(ctx context.Context, id string) (*model.OTP, error)
- func (self *OTPRepository) UpdateAttempts(ctx context.Context, id string, attempts int) error
- type PostRepository
- func (self *PostRepository) CreateHistory(ctx context.Context, history model.PostHistory) (*model.PostHistory, error)
- func (self *PostRepository) CreatePost(ctx context.Context, post model.Post) (*model.Post, error)
- func (self *PostRepository) GetByID(ctx context.Context, id string) (*model.Post, *model.PostHistory, error)
- func (self *PostRepository) GetHistory(ctx context.Context, id string) ([]model.PostHistory, error)
- func (self *PostRepository) GetSubposts(ctx context.Context, id string) (int, error)
- func (self *PostRepository) ListByCommunityID(ctx context.Context, communityID string, typee *string) ([]model.Post, []model.PostHistory, error)
- func (self *PostRepository) ListByThreadID(ctx context.Context, threadID string) ([]model.Post, []model.PostHistory, error)
- func (self *PostRepository) UpdateHistory(ctx context.Context, id string, historyID string) error
- func (self *PostRepository) UpdateVoters(ctx context.Context, id string, voterIDs []string) error
- func (self *PostRepository) UpdateVotersAndPriority(ctx context.Context, id string, voterIDs []string, priority int) error
- func (self *PostRepository) UpdateWidgets(ctx context.Context, historyID string, widgets model.PostWidgets) error
- type SessionRepository
- func (self *SessionRepository) Create(ctx context.Context, session model.Session) (*model.Session, error)
- func (self *SessionRepository) GetByID(ctx context.Context, id string) (*model.Session, error)
- func (self *SessionRepository) UpdateExpiredAt(ctx context.Context, id string, expiredAt time.Time) error
- func (self *SessionRepository) UpdateLastSeen(ctx context.Context, id string, lastSeen time.Time) error
- type UserRepository
- func (self *UserRepository) Create(ctx context.Context, user model.User) (*model.User, error)
- func (self *UserRepository) GetByID(ctx context.Context, id string) (*model.User, error)
- func (self *UserRepository) GetByIDs(ctx context.Context, ids []string) ([]model.User, error)
- func (self *UserRepository) GetByPhone(ctx context.Context, phone string) (*model.User, error)
- func (self *UserRepository) UpdateDeletedAt(ctx context.Context, id string, deletedAt time.Time) error
- func (self *UserRepository) UpdateEmail(ctx context.Context, id string, email string) error
- func (self *UserRepository) UpdatePhone(ctx context.Context, id string, phone string) error
- func (self *UserRepository) UpdateProfile(ctx context.Context, id string, name string, picture string, ...) error
- func (self *UserRepository) UpdateSession(ctx context.Context, id string, sessionID string) error
Constants ¶
View Source
const ( POST_TABLE = "post" POST_HISTORY_TABLE = "post_history" )
View Source
const COMMUNITY_TABLE = "community"
View Source
const INVITATION_TABLE = "invitation"
View Source
const MEMBERSHIP_TABLE = "membership"
View Source
const OTP_TABLE = "otp"
View Source
const SESSION_TABLE = "session"
View Source
const USER_TABLE = "user"
Variables ¶
View Source
var ( ErrUserGeneric = internal.NewError("User query failed") ErrUserExists = internal.NewError("User already exists") )
View Source
var ErrCommunityGeneric = internal.NewError("Community query failed")
View Source
var ErrInvitationGeneric = internal.NewError("Invitation query failed")
View Source
var ErrMembershipGeneric = internal.NewError("Membership query failed")
View Source
var ErrOTPGeneric = internal.NewError("OTP query failed")
View Source
var ErrPostGeneric = internal.NewError("Post query failed")
View Source
var ErrSessionGeneric = internal.NewError("Session query failed")
Functions ¶
This section is empty.
Types ¶
type CommunityRepository ¶
type CommunityRepository struct {
class.Repository
}
func NewCommunityRepository ¶
func NewCommunityRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *CommunityRepository
func (*CommunityRepository) UpdatePinned ¶
type InvitationRepository ¶
type InvitationRepository struct {
class.Repository
}
func NewInvitationRepository ¶
func NewInvitationRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *InvitationRepository
func (*InvitationRepository) Create ¶
func (self *InvitationRepository) Create(ctx context.Context, invitation model.Invitation) (*model.Invitation, error)
func (*InvitationRepository) DeleteByID ¶
func (self *InvitationRepository) DeleteByID(ctx context.Context, id string) error
func (*InvitationRepository) DeleteByIDs ¶
func (self *InvitationRepository) DeleteByIDs(ctx context.Context, ids []string) error
func (*InvitationRepository) GetByID ¶
func (self *InvitationRepository) GetByID(ctx context.Context, id string) (*model.Invitation, error)
func (*InvitationRepository) GetByPhone ¶
func (self *InvitationRepository) GetByPhone(ctx context.Context, phone string) (*model.Invitation, error)
func (*InvitationRepository) List ¶
func (self *InvitationRepository) List(ctx context.Context, phone string) ([]model.Invitation, error)
type MembershipRepository ¶
type MembershipRepository struct {
class.Repository
}
func NewMembershipRepository ¶
func NewMembershipRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *MembershipRepository
func (*MembershipRepository) Create ¶
func (self *MembershipRepository) Create(ctx context.Context, membership model.Membership) (*model.Membership, error)
func (*MembershipRepository) GetByID ¶
func (self *MembershipRepository) GetByID(ctx context.Context, id string) (*model.Membership, error)
func (*MembershipRepository) GetByIDsAndCommunity ¶
func (self *MembershipRepository) GetByIDsAndCommunity(ctx context.Context, ids []string, communityID string) ([]model.Membership, error)
func (*MembershipRepository) GetByUserAndCommunity ¶
func (self *MembershipRepository) GetByUserAndCommunity(ctx context.Context, userID string, communityID string) (*model.Membership, error)
func (*MembershipRepository) ListByCommunity ¶
func (self *MembershipRepository) ListByCommunity(ctx context.Context, communityID string) ([]model.Membership, error)
func (*MembershipRepository) ListByUser ¶
func (self *MembershipRepository) ListByUser(ctx context.Context, userID string) ([]model.Membership, error)
func (*MembershipRepository) UpdateDeletedAt ¶
type OTPRepository ¶
type OTPRepository struct {
class.Repository
}
func NewOTPRepository ¶
func NewOTPRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *OTPRepository
func (*OTPRepository) Delete ¶
func (self *OTPRepository) Delete(ctx context.Context, id string) error
func (*OTPRepository) GetByAsset ¶
func (*OTPRepository) UpdateAttempts ¶
type PostRepository ¶
type PostRepository struct {
class.Repository
}
func NewPostRepository ¶
func NewPostRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *PostRepository
func (*PostRepository) CreateHistory ¶
func (self *PostRepository) CreateHistory(ctx context.Context, history model.PostHistory) (*model.PostHistory, error)
func (*PostRepository) CreatePost ¶
func (*PostRepository) GetByID ¶
func (self *PostRepository) GetByID(ctx context.Context, id string) (*model.Post, *model.PostHistory, error)
func (*PostRepository) GetHistory ¶
func (self *PostRepository) GetHistory(ctx context.Context, id string) ([]model.PostHistory, error)
func (*PostRepository) GetSubposts ¶
func (*PostRepository) ListByCommunityID ¶
func (self *PostRepository) ListByCommunityID(ctx context.Context, communityID string, typee *string) ([]model.Post, []model.PostHistory, error)
TODO: ADD LOTS OF FILTER AND ORDER PARAMS TODO: DISCUSS WHETHER HAVING COMMUNITY_ID DIRECTLY ON THE POST IN ORDER TO AVOID JOINING TABLES... TODO: USE A QUERY BUILDER, MYGOD...
func (*PostRepository) ListByThreadID ¶
func (self *PostRepository) ListByThreadID(ctx context.Context, threadID string) ([]model.Post, []model.PostHistory, error)
func (*PostRepository) UpdateHistory ¶
func (*PostRepository) UpdateVoters ¶
func (*PostRepository) UpdateVotersAndPriority ¶
func (*PostRepository) UpdateWidgets ¶
func (self *PostRepository) UpdateWidgets(ctx context.Context, historyID string, widgets model.PostWidgets) error
type SessionRepository ¶
type SessionRepository struct {
class.Repository
}
func NewSessionRepository ¶
func NewSessionRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *SessionRepository
func (*SessionRepository) UpdateExpiredAt ¶
func (*SessionRepository) UpdateLastSeen ¶
type UserRepository ¶
type UserRepository struct {
class.Repository
}
func NewUserRepository ¶
func NewUserRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *UserRepository
func (*UserRepository) GetByPhone ¶
func (*UserRepository) UpdateDeletedAt ¶
func (*UserRepository) UpdateEmail ¶
func (*UserRepository) UpdatePhone ¶
func (*UserRepository) UpdateProfile ¶
func (*UserRepository) UpdateSession ¶
Click to show internal directories.
Click to hide internal directories.