Documentation ¶
Index ¶
- Variables
- type DeleteResponse
- type GetAllResponse
- type GetResponse
- type PostResponse
- type PutResponse
- type User
- 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) 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) (*User, error)
- func (s *UserService) GetAll(ctx context.Context) ([]User, error)
- func (s *UserService) Post(ctx context.Context, u *User) (int, error)
- func (s *UserService) Update(ctx context.Context, u *User) error
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, }
Functions ¶
This section is empty.
Types ¶
type DeleteResponse ¶
type DeleteResponse struct {
myhttp.ResponseBase
}
type GetAllResponse ¶
type GetAllResponse struct { myhttp.ResponseBase Users []User `json:"zos"` }
type GetResponse ¶
type GetResponse struct { myhttp.ResponseBase User *User `json:"user"` }
type PostResponse ¶
type PostResponse struct { myhttp.ResponseBase User *User `json:"user"` }
type PutResponse ¶
type PutResponse struct { myhttp.ResponseBase User *User `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 UserRepository ¶
type UserRepository struct { }
func (*UserRepository) FindAll ¶
func (r *UserRepository) FindAll(ctx context.Context) ([]User, error)
func (*UserRepository) FindByEmail ¶
func (*UserRepository) FindByEmailTx ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.