repository

package
v0.0.0-...-224a6a0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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) Create

func (self *CommunityRepository) Create(ctx context.Context, community model.Community) (*model.Community, error)

func (*CommunityRepository) GetByID

func (self *CommunityRepository) GetByID(ctx context.Context, id string) (*model.Community, error)

func (*CommunityRepository) GetByIDs

func (self *CommunityRepository) GetByIDs(ctx context.Context, ids []string) ([]model.Community, error)

func (*CommunityRepository) UpdatePinned

func (self *CommunityRepository) UpdatePinned(ctx context.Context, id string, pinnedIDs []string) error

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

func (self *MembershipRepository) UpdateDeletedAt(ctx context.Context, id string, deletedAt *time.Time) error

type OTPRepository

type OTPRepository struct {
	class.Repository
}

func NewOTPRepository

func NewOTPRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *OTPRepository

func (*OTPRepository) Create

func (self *OTPRepository) Create(ctx context.Context, otp model.OTP) (*model.OTP, error)

func (*OTPRepository) Delete

func (self *OTPRepository) Delete(ctx context.Context, id string) error

func (*OTPRepository) GetByAsset

func (self *OTPRepository) GetByAsset(ctx context.Context, asset string) (*model.OTP, error)

func (*OTPRepository) GetByID

func (self *OTPRepository) GetByID(ctx context.Context, id string) (*model.OTP, error)

func (*OTPRepository) UpdateAttempts

func (self *OTPRepository) UpdateAttempts(ctx context.Context, id string, attempts int) error

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 (self *PostRepository) CreatePost(ctx context.Context, post model.Post) (*model.Post, error)

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 (self *PostRepository) GetSubposts(ctx context.Context, id string) (int, error)

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 (self *PostRepository) UpdateHistory(ctx context.Context, id string, historyID string) error

func (*PostRepository) UpdateVoters

func (self *PostRepository) UpdateVoters(ctx context.Context, id string, voterIDs []string) error

func (*PostRepository) UpdateVotersAndPriority

func (self *PostRepository) UpdateVotersAndPriority(ctx context.Context, id string, voterIDs []string, priority int) error

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) Create

func (self *SessionRepository) Create(ctx context.Context, session model.Session) (*model.Session, error)

func (*SessionRepository) GetByID

func (self *SessionRepository) GetByID(ctx context.Context, id string) (*model.Session, error)

func (*SessionRepository) UpdateExpiredAt

func (self *SessionRepository) UpdateExpiredAt(ctx context.Context, id string, expiredAt time.Time) error

func (*SessionRepository) UpdateLastSeen

func (self *SessionRepository) UpdateLastSeen(ctx context.Context, id string, lastSeen time.Time) error

type UserRepository

type UserRepository struct {
	class.Repository
}

func NewUserRepository

func NewUserRepository(configuration internal.Configuration, logger core.Logger, database database.Database) *UserRepository

func (*UserRepository) Create

func (self *UserRepository) Create(ctx context.Context, user model.User) (*model.User, error)

func (*UserRepository) GetByID

func (self *UserRepository) GetByID(ctx context.Context, id string) (*model.User, error)

func (*UserRepository) GetByIDs

func (self *UserRepository) GetByIDs(ctx context.Context, ids []string) ([]model.User, error)

func (*UserRepository) GetByPhone

func (self *UserRepository) GetByPhone(ctx context.Context, phone string) (*model.User, error)

func (*UserRepository) UpdateDeletedAt

func (self *UserRepository) UpdateDeletedAt(ctx context.Context, id string, deletedAt time.Time) error

func (*UserRepository) UpdateEmail

func (self *UserRepository) UpdateEmail(ctx context.Context, id string, email string) error

func (*UserRepository) UpdatePhone

func (self *UserRepository) UpdatePhone(ctx context.Context, id string, phone string) error

func (*UserRepository) UpdateProfile

func (self *UserRepository) UpdateProfile(ctx context.Context, id string, name string, picture string, birthday date.Date) error

func (*UserRepository) UpdateSession

func (self *UserRepository) UpdateSession(ctx context.Context, id string, sessionID string) error

Jump to

Keyboard shortcuts

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