pages

package
v0.0.0-...-618a704 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineFunctions

func DefineFunctions(googleAnalyticsID string) template.FuncMap

DefineFunctions создает набор функций для отрисовки представлений

Types

type BondPageModel

type BondPageModel struct {
	Bond   *data.Bond
	Issuer *data.Issuer
	Report *recommender.Report
}

BondPageModel - модель для страницы "pages/bond.html"

func NewBondPageModel

func NewBondPageModel(app app.App, context context.Context, id string) (*BondPageModel, error)

NewBondPageModel создает новые объекты типа BondPageModel

type CollectionItemModel

type CollectionItemModel struct {
	Bond   *data.Bond
	Issuer *data.Issuer
	Report *recommender.Report
}

CollectionItemModel - модель элемента коллекции для страницы "pages/index.html"

type CollectionModel

type CollectionModel struct {
	ID       string
	Name     string
	Duration recommender.Duration
	Bonds    []CollectionItemModel
}

CollectionModel - модель коллекции для страницы "pages/index.html"

func NewCollectionModel

func NewCollectionModel(u app.UnitOfWork, collection recommender.Collection) (*CollectionModel, error)

NewCollectionModel создает объекты типа CollectionModel

type CollectionPageItemModel

type CollectionPageItemModel struct {
	Bond   *data.Bond
	Issuer *data.Issuer
	Report *recommender.Report
}

CollectionPageItemModel - модель отдельной записи в коллекции (для страницы "pages/collection.html")

type CollectionPageModel

type CollectionPageModel struct {
	ID               string
	Name             string
	ItemsPerDuration map[recommender.Duration][]CollectionPageItemModel
}

CollectionPageModel - модель для страницы "pages/collection.html"

func NewCollectionPageModel

func NewCollectionPageModel(app app.App, context context.Context, id string) (*CollectionPageModel, error)

NewCollectionPageModel создает новые объекты типа CollectionPageModel

type Controller

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

Controller - контроллер веб-страниц

func New

func New(app app.App, googleAnalyticsID string, debugMode bool, logger *log.Logger) *Controller

New создает новый Controller

func (*Controller) BondPage

func (ctrl *Controller) BondPage(c *gin.Context)

BondPage обрабатывает запросы "GET /bonds/:id"

func (*Controller) CollectionPage

func (ctrl *Controller) CollectionPage(c *gin.Context)

CollectionPage обрабатывает запросы "GET /collections/:id"

func (*Controller) ErrorPageMiddleware

func (ctrl *Controller) ErrorPageMiddleware() gin.HandlerFunc

ErrorPageMiddleware отвечает за обработку ошибок

func (*Controller) IndexPage

func (ctrl *Controller) IndexPage(c *gin.Context)

IndexPage обрабатывает запросы "GET /"

func (*Controller) SearchPage

func (ctrl *Controller) SearchPage(c *gin.Context)

SearchPage обрабатывает запросы "GET /search"

func (*Controller) SuggestPage

func (ctrl *Controller) SuggestPage(c *gin.Context)

SuggestPage обрабатывает запросы "GET /suggest"

type Error

type Error struct {
	StatusCode int
	Message    string
}

Error - ошибка бизнес-логики

func NewError

func NewError(statusCode int, message string, a ...interface{}) Error

NewError создает новый объект типа Error

func (Error) Error

func (e Error) Error() string

Error возвращает сообщение об ошибке

type ErrorPageModel

type ErrorPageModel struct {
	StatusCode int
	Message    string
}

ErrorPageModel - модель для страницы

type IndexPageModel

type IndexPageModel struct {
	Collections []CollectionModel
}

IndexPageModel - модель для страницы "pages/index.html"

func NewIndexPageModel

func NewIndexPageModel(app app.App, context context.Context) (*IndexPageModel, error)

NewIndexPageModel создает объекты типа IndexPageModel

type SearchPageModel

type SearchPageModel struct {
	Query          string
	Bonds          []*data.Bond
	Skip           int
	TotalCount     int
	DisplayedCount int
}

SearchPageModel - модель для страницы "pages/search.html"

func NewSearchPageModel

func NewSearchPageModel(app app.App, context context.Context, query string, skip int) (*SearchPageModel, error)

NewSearchPageModel создает объекты типа SearchPageModel

type SearchQueryModel

type SearchQueryModel struct {
	Text    string `form:"q"`
	Skip    int    `form:"skip"`
	Partial bool   `form:"partial"`
}

SearchQueryModel - модель для запроса "GET /search"

type SuggestPageCollectionModel

type SuggestPageCollectionModel struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

SuggestPageCollectionModel описывает коллекцию на странице "pages/suggest.html"

type SuggestPageModel

type SuggestPageModel struct {
	Collections []SuggestPageCollectionModel
}

SuggestPageModel - модель для страницы "pages/suggest.html"

type SuggestPortfolioRequest

type SuggestPortfolioRequest struct {
	Amount         float64                        `json:"amount"`
	MaxDuration    recommender.Duration           `json:"-"`
	MaxDurationRaw int                            `json:"max_duration"`
	Parts          []*SuggestPortfolioRequestPart `json:"parts"`
}

SuggestPortfolioRequest - параметры для запроса GET /api/suggest-portfolio

func NewSuggestPortfolioRequest

func NewSuggestPortfolioRequest(c *gin.Context, u app.UnitOfWork) (*SuggestPortfolioRequest, error)

NewSuggestPortfolioRequest создает объект SuggestPortfolioRequest из строки

func (*SuggestPortfolioRequest) String

func (r *SuggestPortfolioRequest) String() string

String преобразует значение в строку

type SuggestPortfolioRequestPart

type SuggestPortfolioRequestPart struct {
	Collection     recommender.Collection `json:"-"`
	CollectionName string                 `json:"-"`
	CollectionID   string                 `json:"collection"`
	Weight         float64                `json:"weight"`
}

SuggestPortfolioRequestPart - элемент параметра запроса GET /api/suggest-portfolio

type SuggestViewCashFlowPageModel

type SuggestViewCashFlowPageModel struct {
	Date            time.Time
	Amount          float64
	HasCoupon       bool
	HasAmortization bool
	HasMaturity     bool
}

SuggestViewCashFlowPageModel - модель выплаты для страницы "pages/suggest_view.html"

type SuggestViewPageModel

type SuggestViewPageModel struct {
	SuggestPageModel
	Request   *SuggestPortfolioRequest
	Portfolio *recommender.SuggestResult
	ShareUrl  string
	CashFlow  []*SuggestViewCashFlowPageModel
}

SuggestViewPageModel - модель для страницы "pages/suggest_view.html"

Jump to

Keyboard shortcuts

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