Documentation ¶
Index ¶
- Variables
- func Client(v interface{}) interface{}
- func Clients(v interface{}) interface{}
- func Transform(v interface{}) (interface{}, error)
- func User(v interface{}) interface{}
- func Users(v interface{}) interface{}
- type ClientOutput
- type CreateClient
- type CreateUser
- type TransformerFunc
- type UpdateClient
- type UpdateUser
- type UserOutput
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownTypeToTransform = errors.New("dto: unknown type to transform")
ErrUnknownTypeToTransform is a sentinel error indicating that a type requested to be transformed by this package is not known by this package.
Functions ¶
func Client ¶
func Client(v interface{}) interface{}
Create transforms a single *client.Client to a *ClientOutput.
func Clients ¶
func Clients(v interface{}) interface{}
Clients transforms a []*client.Client to a []*ClientOutput. It delegates to Client.
Types ¶
type ClientOutput ¶
type ClientOutput struct { Id data.Id `json:"id"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
ClientOutput is a marshalable type that should be used for external representations of client.Client(s) outside the API.
type CreateClient ¶
type CreateClient struct {
Name string `json:"name" valid:"required"`
}
CreateClient is a form type that should be used for incoming create client requests to the API.
type CreateUser ¶
type CreateUser struct { Email string `json:"email" valid:"required,email"` Enabled bool `json:"enabled"` ClientIds []data.Id `json"client_ids"` }
CreateUser is a form type that should be used for incoming create user requests to the API.
type TransformerFunc ¶
type TransformerFunc func(interface{}) interface{}
TransformerFunc is a type that can convert from type to another. Ideally it is used to convert domain types to output, marshalable types.
type UpdateClient ¶
type UpdateClient struct {
Name *string `json:"name" valid:"omitempty,required"`
}
UpdateClient is a form type that should be used for incoming update client requests to the API.
type UpdateUser ¶
type UpdateUser struct { Email *string `json:"email" valid:"omitempty,email"` Enabled *bool `json:"enabled"` ClientIds *[]data.Id `json:"client_ids"` }
UpdateUser is a form type that should be used for incoming udpate user requests to the API.
type UserOutput ¶
type UserOutput struct { Id data.Id `json:"id"` Email string `json:"email"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Enabled bool `json:"enabled"` ClientIds []data.Id `json:"client_ids"` }
UserOutput is a marshalable type that should be used to represent a User outside of the API.