Documentation
¶
Index ¶
- Constants
- Variables
- func TableFromReportType(reportType ReportType) string
- func ValidateEmail(v *validator.Validator, email string)
- func ValidatePaging(v *validator.Validator, p Paging)
- func ValidatePasswordPlaintext(v *validator.Validator, password string)
- func ValidateUser(v *validator.Validator, user *User)
- type Economic
- type EconomicRepository
- type EconomicStats
- type EconomicStatsResult
- type EconomicWithChange
- type EconomicWithChangeResult
- type Extras
- type Metadata
- type Paging
- type Permissions
- type PermissionsRepository
- type Report
- type ReportRepository
- type ReportType
- type Summary
- type Token
- type TokenRepository
- type TreasuryMaturity
- type User
- type UserRepository
Constants ¶
View Source
const ( ScopeActivation = "activation" ScopeAuthentication = "authentication" )
Variables ¶
View Source
var ( ErrRecordNotFound = errors.New("record not found") ErrEditConflict = errors.New("edit conflict") ErrDuplicateEmail = errors.New("duplicate email") )
View Source
var AnonymousUser = &User{}
Functions ¶
func TableFromReportType ¶
func TableFromReportType(reportType ReportType) string
func ValidateEmail ¶
func ValidatePaging ¶
func ValidateUser ¶
Types ¶
type EconomicRepository ¶
type EconomicRepository interface {
LatestWithPercentChange(ctx context.Context, table string) (*EconomicWithChange, error)
GetIntervalWithPercentChange(ctx context.Context, table string, years int, paging Paging) (*EconomicWithChangeResult, error)
GetStats(ctx context.Context, table string, years int, timeBucketDays int, paging Paging) (*EconomicStatsResult, error)
GetAll(ctx context.Context, table string) (*[]Economic, error)
Insert(ctx context.Context, table string, data *Economic) error
InsertMany(ctx context.Context, table string, data *[]Economic) error
}
type EconomicStats ¶
type EconomicStats struct {
StartDate time.Time `db:"start_date" json:"from"`
EndDate time.Time `db:"end_date" json:"to"`
Stddev decimal.Decimal `db:"stddev" json:"stddev"`
Mean decimal.Decimal `db:"mean" json:"mean"`
Min decimal.Decimal `db:"min" json:"min"`
Max decimal.Decimal `db:"max" json:"max"`
}
type EconomicStatsResult ¶
type EconomicStatsResult struct {
Data *[]EconomicStats
Meta *Metadata
}
type EconomicWithChange ¶
type EconomicWithChangeResult ¶
type EconomicWithChangeResult struct {
Data *[]EconomicWithChange
Meta *Metadata
}
type Metadata ¶
type Metadata struct {
CurrentPage int `json:"current_page"`
PageSize int `json:"page_size"`
FirstPage int `json:"first_page"`
LastPage int `json:"last_page"`
TotalRecords int `json:"total_records"`
Props map[string]interface{} `json:"props"`
}
func CalculateMetadata ¶
type Permissions ¶
type Permissions []string
func (*Permissions) Included ¶
func (p *Permissions) Included(code string) bool
type PermissionsRepository ¶
type Report ¶
type Report struct {
Id int64 `db:"id" json:"id"`
Slug string `db:"slug" json:"slug"`
DisplayName string `db:"display_name" json:"displayName"`
Description string `db:"description" json:"description"`
Image string `db:"image" json:"image"`
LastPullDate time.Time `db:"last_data_pull" json:"lastPullDate"`
InitialSyncDelayMinutes int `db:"initial_sync_delay_minutes" json:"initialSyncDelayMinutes"`
Extras Extras `json:"extras"`
}
type ReportRepository ¶
type ReportType ¶
type ReportType int8
const ( CPI ReportType = iota ConsumerSentiment RetailSales TreasuryYieldThreeMonth TreasuryYieldTwoYear TreasuryYieldFiveYear TreasuryYieldSevenYear TreasuryYieldTenYear TreasuryYieldThirtyYear RealGDP RealGdpPerCapita FederalFundsRate DurableGoodsOrders Unemployment NonfarmPayroll Inflation InflationExpectation Unknown )
func ReportTypeTreasuryYieldMaturity ¶
func ReportTypeTreasuryYieldMaturity(maturity string) ReportType
func (ReportType) String ¶
func (r ReportType) String() string
func (ReportType) ToTable ¶
func (r ReportType) ToTable() string
type Token ¶
type TokenRepository ¶
type TreasuryMaturity ¶
type TreasuryMaturity string
func MaturityFromReportType ¶
func MaturityFromReportType(report ReportType) TreasuryMaturity
type User ¶
type User struct {
ID int64 `json:"id" db:"id"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
Name string `json:"name" db:"name"`
Email string `json:"email" db:"email"`
Password password `json:"-" db:"password_hash"`
Activated bool `json:"activated" db:"activated"`
Version int `json:"-" db:"version"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.