Documentation ¶
Index ¶
- func ComparePassword(plain, hashed string) error
- func HashPassword(pwd string) (string, error)
- type Feed
- type FeedPage
- type FeedRepository
- type Following
- type FollowingRepository
- type FollowingsPage
- type Page
- type Preference
- type PreferencesPage
- type PreferencesRepository
- type Service
- type Tokenizer
- type User
- type UsersPage
- type UsersRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePassword ¶
func HashPassword ¶
Types ¶
type FeedPage ¶
func (FeedPage) MarshalJSON ¶
type FeedRepository ¶
type FollowingRepository ¶
type FollowingsPage ¶
type Page ¶
type Page struct { Total uint64 `db:"total" json:"total"` Offset uint64 `db:"offset" json:"offset"` Limit uint64 `db:"limit" json:"limit"` FollowerID string `db:"follower_id" json:"follower_id,omitempty"` FolloweeID string `db:"followee_id" json:"followee_id,omitempty"` UserID string `db:"user_id" json:"user_id,omitempty"` }
type Preference ¶
type Preference struct { ID string `json:"id"` UserID string `json:"user_id"` EmailEnable bool `json:"email_enabled"` PushEnable bool `json:"push_enabled"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (Preference) FromKV ¶
func (p Preference) FromKV(key, value string) error
type PreferencesPage ¶
type PreferencesPage struct { Page Preferences []Preference `json:"preferences"` }
func (PreferencesPage) MarshalJSON ¶
func (page PreferencesPage) MarshalJSON() ([]byte, error)
type PreferencesRepository ¶
type PreferencesRepository interface { Create(ctx context.Context, preference Preference) (Preference, error) RetrieveByUserID(ctx context.Context, userID string) (Preference, error) RetrieveAll(ctx context.Context, page Page) (PreferencesPage, error) Update(ctx context.Context, preference Preference) (Preference, error) UpdateEmail(ctx context.Context, preference Preference) (Preference, error) UpdatePush(ctx context.Context, preference Preference) (Preference, error) Delete(ctx context.Context, userID string) error }
type Service ¶
type Service interface { IssueToken(ctx context.Context, user User) (string, error) RefreshToken(ctx context.Context, token string) (string, error) IdentifyUser(ctx context.Context, token string) (string, error) CreateUser(ctx context.Context, user User) (User, error) GetUserByID(ctx context.Context, token string, id string) (User, error) GetUsers(ctx context.Context, token string, page Page) (UsersPage, error) UpdateUser(ctx context.Context, token string, user User) (User, error) UpdateUserUsername(ctx context.Context, token string, user User) (User, error) UpdateUserPassword(ctx context.Context, token string, oldPassword, currentPassowrd string) error UpdateUserEmail(ctx context.Context, token string, user User) (User, error) UpdateUserBio(ctx context.Context, token string, user User) (User, error) UpdateUserPictureURL(ctx context.Context, token string, user User) (User, error) UpdateUserPreferences(ctx context.Context, token string, user User) (User, error) DeleteUser(ctx context.Context, token string, id string) error CreatePreferences(ctx context.Context, token string, preference Preference) (Preference, error) GetPreferencesByUserID(ctx context.Context, token, id string) (Preference, error) GetPreferences(ctx context.Context, token string, page Page) (PreferencesPage, error) UpdatePreferences(ctx context.Context, token string, preference Preference) (Preference, error) UpdateEmailPreferences(ctx context.Context, token string, preference Preference) (Preference, error) UpdatePushPreferences(ctx context.Context, token string, preference Preference) (Preference, error) DeletePreferences(ctx context.Context, token string) error CreateFollower(ctx context.Context, token string, following Following) (Following, error) GetUserFollowings(ctx context.Context, token string, page Page) (FollowingsPage, error) DeleteFollower(ctx context.Context, token string, following Following) error CreateFeed(ctx context.Context, feed Feed) error GetUserFeed(ctx context.Context, token string, page Page) (FeedPage, error) }
func NewService ¶
func NewService(usersRepo UsersRepository, preferencesRepo PreferencesRepository, followingRepo FollowingRepository, feedRepo FeedRepository, tokenizer Tokenizer, cacher cache.Cacher) Service
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` DisplayName string `json:"display_name"` Bio string `json:"bio,omitempty"` PictureURL string `json:"picture_url,omitempty"` Email string `json:"email"` Password string `json:"password,omitempty"` Preferences []string `json:"preferences,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type UsersPage ¶
func (UsersPage) MarshalJSON ¶
type UsersRepository ¶
type UsersRepository interface { Create(ctx context.Context, user User) (User, error) RetrieveByID(ctx context.Context, id string) (User, error) RetrieveByEmail(ctx context.Context, email string) (User, error) RetrieveAll(ctx context.Context, page Page) (UsersPage, error) Update(ctx context.Context, user User) (User, error) UpdateUsername(ctx context.Context, user User) (User, error) UpdatePassword(ctx context.Context, user User) error UpdateEmail(ctx context.Context, user User) (User, error) UpdateBio(ctx context.Context, user User) (User, error) UpdatePictureURL(ctx context.Context, user User) (User, error) UpdatePreferences(ctx context.Context, user User) (User, error) Delete(ctx context.Context, id string) error }
Click to show internal directories.
Click to hide internal directories.