trangrp

package
v0.0.0-...-c64bf0e Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package trangrp maintains the group of handlers for transaction example.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes(app *web.App, cfg Config)

Routes adds specific routes for this group.

Types

type AppNewProduct

type AppNewProduct struct {
	Name     string  `json:"name" validate:"required"`
	Cost     float64 `json:"cost" validate:"required,gte=0"`
	Quantity int     `json:"quantity" validate:"required,gte=1"`
}

AppNewProduct is what we require from clients when adding a Product.

func (AppNewProduct) Validate

func (app AppNewProduct) Validate() error

Validate checks the data in the model is considered clean.

type AppNewTran

type AppNewTran struct {
	Product AppNewProduct `json:"product"`
	User    AppNewUser    `json:"user"`
}

AppNewTran represents an example of cross domain transaction at the application layer.

type AppNewUser

type AppNewUser struct {
	Name            string   `json:"name" validate:"required"`
	Email           string   `json:"email" validate:"required,email"`
	Roles           []string `json:"roles" validate:"required"`
	Department      string   `json:"department"`
	Password        string   `json:"password" validate:"required"`
	PasswordConfirm string   `json:"passwordConfirm" validate:"eqfield=Password"`
}

AppNewUser contains information needed to create a new user.

func (AppNewUser) Validate

func (app AppNewUser) Validate() error

Validate checks the data in the model is considered clean.

type AppProduct

type AppProduct struct {
	ID          string  `json:"id"`
	UserID      string  `json:"userID"`
	Name        string  `json:"name"`
	Cost        float64 `json:"cost"`
	Quantity    int     `json:"quantity"`
	DateCreated string  `json:"dateCreated"`
	DateUpdated string  `json:"dateUpdated"`
}

AppProduct represents an individual product.

type Config

type Config struct {
	Log      *logger.Logger
	Delegate *delegate.Delegate
	Auth     *auth.Auth
	DB       *sqlx.DB
}

Config contains all the mandatory systems required by handlers.

Jump to

Keyboard shortcuts

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