Documentation ¶
Index ¶
- Variables
- func NewResponseUser(userId int, givenName, familyName, email string) *responseUser
- func NewResponseUserCategories(models []UserCategory) []responseUserCategory
- func NewResponseUserCategory(id, number int, name string, colorId int) *responseUserCategory
- func NewResponseUsers(models []User) []responseUser
- type DeleteResponse
- type GetAllResponse
- type GetAllUserCategoryResponse
- type GetResponse
- type PostResponse
- type PostUserCategoryResponse
- type PostUserTokenResponse
- type PutResponse
- type User
- type UserCategory
- type UserRepository
- func (r *UserRepository) Create(ctx context.Context, u *User) (int, error)
- func (r *UserRepository) CreateTx(ctx context.Context, tx *sql.Tx, u *User) (int, error)
- func (r *UserRepository) Delete(ctx context.Context, id int) error
- func (r *UserRepository) Find(ctx context.Context, id int) (*User, error)
- func (r *UserRepository) FindAll(ctx context.Context) ([]User, error)
- func (r *UserRepository) FindByEmail(ctx context.Context, email string) (*User, error)
- func (r *UserRepository) FindByEmailTx(ctx context.Context, tx *sql.Tx, email string) (*User, error)
- func (r *UserRepository) FindByIdentifier(ctx context.Context, identifier string, password string) (*User, error)
- func (r *UserRepository) Update(ctx context.Context, u *User) error
- type UserService
- func (s *UserService) Delete(ctx context.Context, id int) error
- func (s *UserService) Get(ctx context.Context, id int) (*responseUser, error)
- func (s *UserService) GetAll(ctx context.Context) ([]responseUser, error)
- func (s *UserService) Post(ctx context.Context, u *User) (int, error)
- func (s *UserService) Update(ctx context.Context, u *User) error
- type UserToken
- type UserTokenRepository
- type UserTokenRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var Routes map[myrouter.RouteKey]func(w http.ResponseWriter, r *http.Request, ps common.QueryMap) = map[myrouter.RouteKey]func(w http.ResponseWriter, r *http.Request, ps common.QueryMap){ {Path: "/api/v1/users", Method: "GET", NeedAuth: true}: uc.getAll, {Path: "/api/v1/users/:user_id", Method: "GET", NeedAuth: true}: uc.get, {Path: "/api/v1/users", Method: "POST", NeedAuth: true}: uc.post, {Path: "/api/v1/users/:user_id", Method: "PUT", NeedAuth: true}: uc.update, {Path: "/api/v1/users/:user_id", Method: "DELETE", NeedAuth: true}: uc.delete, {Path: "/api/v1/usertokens", Method: "POST", NeedAuth: false}: utc.post, {Path: "/api/v1/users/:user_id/categories", Method: "GET", NeedAuth: true}: ucc.getAll, {Path: "/api/v1/users/:user_id/categories", Method: "POST", NeedAuth: true}: ucc.post, }
Functions ¶
func NewResponseUser ¶
func NewResponseUserCategories ¶
func NewResponseUserCategories(models []UserCategory) []responseUserCategory
func NewResponseUserCategory ¶
func NewResponseUsers ¶
func NewResponseUsers(models []User) []responseUser
Types ¶
type DeleteResponse ¶
type DeleteResponse struct {
myhttp.ResponseBase
}
type GetAllResponse ¶
type GetAllResponse struct { myhttp.ResponseBase Users []responseUser `json:"users"` }
type GetAllUserCategoryResponse ¶
type GetAllUserCategoryResponse struct { *myhttp.ResponseBase Categories []responseUserCategory `json:"categories"` }
func NewGetAllUserCategoryResponse ¶
func NewGetAllUserCategoryResponse(res *myhttp.ResponseBase, categories []responseUserCategory) *GetAllUserCategoryResponse
type GetResponse ¶
type GetResponse struct { myhttp.ResponseBase User *responseUser `json:"user"` }
type PostResponse ¶
type PostResponse struct { myhttp.ResponseBase User *responseUser `json:"user"` UserToken *UserToken `json:"usertoken"` }
type PostUserCategoryResponse ¶
type PostUserCategoryResponse struct { *myhttp.ResponseBase Category *responseUserCategory `json:"category"` }
func NewPostUserCategoryResponse ¶
func NewPostUserCategoryResponse(res *myhttp.ResponseBase, category *responseUserCategory) *PostUserCategoryResponse
type PostUserTokenResponse ¶
type PostUserTokenResponse struct { *myhttp.ResponseBase *UserToken }
func NewPostUserTokenResponse ¶
func NewPostUserTokenResponse(res *myhttp.ResponseBase, usertoken *UserToken) *PostUserTokenResponse
type PutResponse ¶
type PutResponse struct { myhttp.ResponseBase User *responseUser `json:"user"` }
type User ¶
type User struct { Id int `json:"id"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` Email string `json:"email"` Password string `json:"password"` CreatedAt time.Time `json:"createdat"` UpdatedAt sql.NullTime `json:"updatedat"` }
type UserCategory ¶
type UserRepository ¶
type UserRepository struct { }
func (*UserRepository) FindAll ¶
func (r *UserRepository) FindAll(ctx context.Context) ([]User, error)
func (*UserRepository) FindByEmail ¶
func (*UserRepository) FindByEmailTx ¶
func (*UserRepository) FindByIdentifier ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
User
func (*UserService) Get ¶
func (s *UserService) Get(ctx context.Context, id int) (*responseUser, error)
type UserToken ¶
type UserTokenRepository ¶
type UserTokenRepository struct { }
type UserTokenRequest ¶
type UserTokenRequest struct { Identifier string `json:"identifier"` Secret string `json:"secret"` }
UserToken
func NewUserTokenRequest ¶
func NewUserTokenRequest( identifier string, secret string, ) UserTokenRequest
Click to show internal directories.
Click to hide internal directories.