Documentation ¶
Index ¶
- func BuildBadRequestResponse(err error, w http.ResponseWriter)
- func BuildBadRequestResponseWithErrorArray(apierrs []*apierror.ApiError, code, message string, w http.ResponseWriter)
- func BuildCreatedResponse(result interface{}, apierr error, w http.ResponseWriter)
- func BuildOkResponse(result interface{}, apierr error, w http.ResponseWriter)
- func BuildResponse(result interface{}, apierr error, status int, w http.ResponseWriter)
- func BuildUnauthorizedResponse(w http.ResponseWriter)
- func GetClientIP(r *http.Request) string
- type AccountBody
- type AccountsHttpAdapter
- type Endpoint
- type Error
- type HTTPAdapter
- type Payload
- type Response
- type Route
- type TransactionBody
- func (tb *TransactionBody) GetAccountID() int
- func (tb *TransactionBody) GetAmount() float64
- func (tb *TransactionBody) GetEventDate() time.Time
- func (tb *TransactionBody) GetID() int
- func (tb *TransactionBody) GetOperationType() int
- func (tb *TransactionBody) SetAccountID(accountId int)
- func (tb *TransactionBody) SetAmount(amount float64)
- func (tb *TransactionBody) SetEventDate(date time.Time)
- func (tb *TransactionBody) SetID(id int)
- func (tb *TransactionBody) SetOperationType(operationType int)
- type TransactionsHttpAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBadRequestResponse ¶
func BuildBadRequestResponse(err error, w http.ResponseWriter)
func BuildBadRequestResponseWithErrorArray ¶
func BuildBadRequestResponseWithErrorArray(apierrs []*apierror.ApiError, code, message string, w http.ResponseWriter)
func BuildCreatedResponse ¶
func BuildCreatedResponse(result interface{}, apierr error, w http.ResponseWriter)
func BuildOkResponse ¶
func BuildOkResponse(result interface{}, apierr error, w http.ResponseWriter)
func BuildResponse ¶
func BuildResponse(result interface{}, apierr error, status int, w http.ResponseWriter)
func BuildUnauthorizedResponse ¶
func BuildUnauthorizedResponse(w http.ResponseWriter)
func GetClientIP ¶
Types ¶
type AccountBody ¶
func NewAccount ¶
func NewAccount(id, documentNumber int) *AccountBody
func (*AccountBody) GetDocumentNumber ¶
func (a *AccountBody) GetDocumentNumber() int
func (*AccountBody) GetID ¶
func (a *AccountBody) GetID() int
func (*AccountBody) SetDocumentNumber ¶
func (a *AccountBody) SetDocumentNumber(documentNumber int)
func (*AccountBody) SetID ¶
func (a *AccountBody) SetID(id int)
type AccountsHttpAdapter ¶
type AccountsHttpAdapter struct {
// contains filtered or unexported fields
}
func NewAccountsHttpAdapter ¶
func NewAccountsHttpAdapter(service *accounts.Service) *AccountsHttpAdapter
func (*AccountsHttpAdapter) CreateAccount ¶
func (u *AccountsHttpAdapter) CreateAccount(w http.ResponseWriter, r *http.Request)
func (*AccountsHttpAdapter) GetAccount ¶
func (u *AccountsHttpAdapter) GetAccount(w http.ResponseWriter, r *http.Request)
type HTTPAdapter ¶
type HTTPAdapter struct { Middlewares []func(http.Handler) http.Handler // contains filtered or unexported fields }
func NewHTTPAdapter ¶
func NewHTTPAdapter(routes []Route, timeout int) *HTTPAdapter
Returns an adapter for run http server routes []Route routes from application timeout int duration in seconds
type Payload ¶
type Payload struct { *Error `json:"error,omitempty"` Data interface{} `json:"data,omitempty"` }
type Response ¶
type Response struct { StatusCode int `json:"status_code"` Data interface{} `json:"data"` }
type TransactionBody ¶
type TransactionBody struct { ID int `json:"id"` AccountID int `json:"account_id"` OperationType int `json:"operation_type_id"` Amount float64 `json:"amount"` EventDate time.Time `json:"event_date"` }
func (*TransactionBody) GetAccountID ¶
func (tb *TransactionBody) GetAccountID() int
func (*TransactionBody) GetAmount ¶
func (tb *TransactionBody) GetAmount() float64
func (*TransactionBody) GetEventDate ¶
func (tb *TransactionBody) GetEventDate() time.Time
func (*TransactionBody) GetID ¶
func (tb *TransactionBody) GetID() int
func (*TransactionBody) GetOperationType ¶
func (tb *TransactionBody) GetOperationType() int
func (*TransactionBody) SetAccountID ¶
func (tb *TransactionBody) SetAccountID(accountId int)
func (*TransactionBody) SetAmount ¶
func (tb *TransactionBody) SetAmount(amount float64)
func (*TransactionBody) SetEventDate ¶
func (tb *TransactionBody) SetEventDate(date time.Time)
func (*TransactionBody) SetID ¶
func (tb *TransactionBody) SetID(id int)
func (*TransactionBody) SetOperationType ¶
func (tb *TransactionBody) SetOperationType(operationType int)
type TransactionsHttpAdapter ¶
type TransactionsHttpAdapter struct {
// contains filtered or unexported fields
}
func NewTransactionsHttpAdapter ¶
func NewTransactionsHttpAdapter(service *transactions.Service) *TransactionsHttpAdapter
func (*TransactionsHttpAdapter) CreateTransactions ¶
func (t *TransactionsHttpAdapter) CreateTransactions(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.