password

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexResponse

type IndexResponse[T responseAble] struct {
	Data       []*T `json:"-"`
	Pagination *paginate.M
}

IndexResponse response that's used in use case Index.

func NewIndexResponseCategoryFromEntity

func NewIndexResponseCategoryFromEntity(cats []*entity.Category, prefix string) *IndexResponse[ResponseCategory]

NewIndexResponseCategoryFromEntity create new pointer IndexResponse from given slices of entity.Category. Also prepend given prefix to both Image & Icon fields after cleaning the trailing slash.

func NewIndexResponseFromEntity

func NewIndexResponseFromEntity(pw []*entity.Password) *IndexResponse[Response]

NewIndexResponseFromEntity create new pointer IndexResponse from given slices of entity.Password.

type Request

type Request struct {
	ID       uint   `json:"id"`
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
	Category uint   `json:"category" validate:"required"`
	// contains filtered or unexported fields
}

Request standard request object that may be used in password domain.

func (*Request) SetQuery

func (p *Request) SetQuery()

SetQuery do setup Order and Sort.

func (*Request) Validate

func (r *Request) Validate() validator.ValidationErrors

Validate apply validation rules for Request.

func (*Request) ValidateDelete

func (r *Request) ValidateDelete() validator.ValidationErrors

ValidateDelete apply validation rules for RequestCategory in delete endpoint.

func (*Request) ValidateUpdate

func (r *Request) ValidateUpdate() validator.ValidationErrors

ValidateUpdate apply validation rules for RequestCategory in update endpoint.

type RequestCategory

type RequestCategory struct {

	// ID unique identifier of each Category. Should be required when updating.
	ID uint `form:"id"`
	// Name the name of category.
	Name string `form:"name" validate:"required"`
	// Image binary file for image field that should be parsed manually from
	// delivery.
	Image *multipart.FileHeader `form:"image"`
	// Icon binary file for icon field that should be parsed manually from
	// delivery.
	Icon *multipart.FileHeader `form:"icon"`
	// contains filtered or unexported fields
}

RequestCategory standard request object that may be used in password domain.

func (*RequestCategory) NormalizeName

func (r *RequestCategory) NormalizeName()

NormalizeName transform value of Name field to upper-cased.

func (*RequestCategory) SetQuery

func (p *RequestCategory) SetQuery()

SetQuery do setup Order and Sort.

func (*RequestCategory) Validate

func (r *RequestCategory) Validate() validator.ValidationErrors

Validate apply validation rules for RequestCategory.

func (*RequestCategory) ValidateCreate

func (r *RequestCategory) ValidateCreate() validator.ValidationErrors

ValidateCreate apply validation rules for RequestCategory in create endpoint.

func (*RequestCategory) ValidateDelete

func (r *RequestCategory) ValidateDelete() validator.ValidationErrors

ValidateDelete apply validation rules for RequestCategory in delete endpoint.

func (*RequestCategory) ValidateUpdate

func (r *RequestCategory) ValidateUpdate() validator.ValidationErrors

ValidateUpdate apply validation rules for RequestCategory in update endpoint.

type Response

type Response struct {
	ID         uint   `json:"id"`
	Username   string `json:"username"`
	CategoryID uint   `json:"category_id"`
}

Response standard response object that may be used in password domain.

func NewResponseFromEntity

func NewResponseFromEntity(pw entity.Password) *Response

NewResponseFromEntity transform given entity.Password to Response.

type ResponseCategory

type ResponseCategory struct {
	ID    uint   `json:"id"`
	Name  string `json:"name"`
	Image string `json:"image"`
	Icon  string `json:"icon"`
}

ResponseCategory standard response object that may be used in password domain.

func NewResponseCategoryFromEntity

func NewResponseCategoryFromEntity(cat entity.Category, prefix string) *ResponseCategory

NewResponseCategoryFromEntity transform given entity.Category to ResponseCategory. Also prepend given prefix to both Image & Icon fields after cleaning the trailing slash.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL