Documentation ¶
Index ¶
- type BackendUserService
- func (r *BackendUserService) Find(filter *Filter, sort *Sort, page, pageSize int) (*UserProfilePage, error)
- func (r *BackendUserService) GetUserProfile(userID string) (*app.UserProfile, error)
- func (r *BackendUserService) UpdateUserProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error)
- type DB
- func (db *DB) Find(filter *Filter, sort *Sort, page, pageSize int) (*UserProfilePage, error)
- func (db *DB) GetUserProfile(objectID string) (*app.UserProfile, error)
- func (db *DB) UpdateMyProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error)
- func (db *DB) UpdateUserProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error)
- type Filter
- type Sort
- type User
- type UserProfilePage
- type UserProfileRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendUserService ¶
type BackendUserService struct {
// contains filtered or unexported fields
}
func (*BackendUserService) Find ¶ added in v1.1.2
func (r *BackendUserService) Find(filter *Filter, sort *Sort, page, pageSize int) (*UserProfilePage, error)
Find looks up the user profiles matching the search filter.
func (*BackendUserService) GetUserProfile ¶
func (r *BackendUserService) GetUserProfile(userID string) (*app.UserProfile, error)
GetUserProfile finds user profile by Id. Return media type if succeed.
func (*BackendUserService) UpdateUserProfile ¶
func (r *BackendUserService) UpdateUserProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error)
UpdateUserProfile updates user profile by id. Return media type if succeed.
type DB ¶
DB emulates a database driver using in-memory data structures.
func (*DB) GetUserProfile ¶
func (db *DB) GetUserProfile(objectID string) (*app.UserProfile, error)
GetUserProfile mock implementation
func (*DB) UpdateMyProfile ¶
func (db *DB) UpdateMyProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error)
UpdateMyProfile mock implementation
func (*DB) UpdateUserProfile ¶
func (db *DB) UpdateUserProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error)
UpdateUserProfile mock implementation
type Filter ¶ added in v1.1.2
type Filter struct { // Match exact values. Match map[string]interface{} // Pattern match values by regular expression. Pattern map[string]string }
Filter holds the exact Match values and Pattern match values for organizations lookup.
type Sort ¶ added in v1.1.2
type Sort struct { // SortBy is the name of the property by which to sort. SortBy string // Direction specifies the sorting direction. Valid values are: "asc" and "desc". Direction string }
Sort holds the sorting specification for the results. This usually entails specifying the property by which to sort and the sorting direction (either "asc" or "desc").
type User ¶
type User struct { UserID string `json:"userId" bson:"userId"` FullName string `json:"fullname,omitempty" bson:"fullName,omitempty"` Email string `json:"email,omitempty" bson:"email,omitempty"` Company string `json:"company,omitempty" bson:"company,omitempty"` CompanyRegistrationNumber string `json:"companyRegistrationNumber,omitempty" bson:"companyRegistrationNumber,omitempty"` TaxNumber string `json:"taxNumber,omitempty" bson:"taxNumber,omitempty"` CreatedOn int `json:"createdOn,omitempty" bson:"createdOn"` }
User is an object which holds the UserID, FullName, Email and the date of creation
type UserProfilePage ¶ added in v1.1.2
type UserProfilePage struct { // Page number. Starts from 1. Page int `json:"page"` // PageSize is the number of results per page. PageSize int `json:"pageSize"` // Items is an array of the actually returned user profiles that match the search filter. Items []User `json:"items"` }
UserProfilePage represents a paginated result of user profiles.
type UserProfileRepository ¶
type UserProfileRepository interface { // GetUserProfile looks up a UserProfile by the user ID. GetUserProfile(userID string) (*app.UserProfile, error) // UpdateUserProfile updates the UserProfile data for a particular user by its user ID. // If the profile already exists, it updates the data. If not profile entry exists, a new one is created. // Returns the updated or newly created user profile. UpdateUserProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error) // UpdateMyProfile(profile *app.UserProfilePayload, userID string) (*app.UserProfile, error) // Find Performs a search for user profiles that match the input filter. Find(filter *Filter, sort *Sort, page, pageSize int) (*UserProfilePage, error) }
UserProfileRepository defines the interface for accessing the user profile data
func NewUserService ¶
func NewUserService(userRepository backends.Repository) UserProfileRepository