controller

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	// contains filtered or unexported fields
}

Entity controller for category entity retrieval

func (*Entity) Data

func (controller *Entity) Data(c context.Context, r *web.Request, params web.RequestParams) interface{}

Data controller for category entities

func (*Entity) Inject

func (controller *Entity) Inject(service domain.CategoryService)

Inject the Entity controller required dependencies

type ProductSearchService

type ProductSearchService interface {
	Find(ctx context.Context, searchRequest *searchApplication.SearchRequest) (*productApplication.SearchResult, error)
}

ProductSearchService interface that describes the expected dependency. (Is fulfilled by the product package)

type QueryHandler

type QueryHandler interface {
	Execute(ctx context.Context, req Request) (*Result, *RedirectResult, error)
}

QueryHandler provides the base command logic that is agnostic to the actual view type

type QueryHandlerImpl

type QueryHandlerImpl struct {
	// contains filtered or unexported fields
}

QueryHandlerImpl is the default implementation of QueryHandler

func (*QueryHandlerImpl) Execute

func (c *QueryHandlerImpl) Execute(ctx context.Context, req Request) (*Result, *RedirectResult, error)

Execute Action to display a category page for any view error might be domain.ErrNotFound to indicate that the category was not found

func (*QueryHandlerImpl) Inject

func (c *QueryHandlerImpl) Inject(
	categoryService domain.CategoryService,
	searchService ProductSearchService,
)

Inject injects dependencies

type RedirectResult

type RedirectResult struct {
	Code string
	Name string
}

RedirectResult signals that a request for a category view shall be redirected using the defined parameters

type Request

type Request struct {
	Code     string
	Name     string
	QueryAll url.Values
	URL      url.URL
}

Request is a request for a category view

type Result

type Result struct {
	ProductSearchResult *productApplication.SearchResult
	Category            domain.Category
	CategoryTree        domain.Tree
	SearchMeta          searchDomain.SearchMeta
	PaginationInfo      utils.PaginationInfo
}

Result for found category

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

Tree controller for category tree retrieval

func (*Tree) Data

func (controller *Tree) Data(c context.Context, r *web.Request, params web.RequestParams) interface{}

Data controller for category trees

func (*Tree) Inject

func (controller *Tree) Inject(service domain.CategoryService)

Inject the Tree controller required dependencies

type ViewController

type ViewController struct {
	// contains filtered or unexported fields
}

ViewController provides web-specific actions for category single view

func (*ViewController) Get

func (vc *ViewController) Get(c context.Context, request *web.Request) web.Result

Get Action to display a category page for the web

func (*ViewController) Inject

func (vc *ViewController) Inject(
	queryCommandHandler QueryHandler,
	breadcrumbService *application.BreadcrumbService,
	responder *web.Responder,
	router *web.Router,
	config *struct {
		Template       string `inject:"config:commerce.category.view.template"`
		TeaserTemplate string `inject:"config:commerce.category.view.teaserTemplate"`
	},
) *ViewController

Inject the ViewController controller required dependencies

type ViewData

type ViewData struct {
	ProductSearchResult *productApplication.SearchResult
	Category            domain.Category
	CategoryTree        domain.Tree
	SearchMeta          searchDomain.SearchMeta
	PaginationInfo      utils.PaginationInfo
}

ViewData for rendering context

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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