Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type Allowance
- type AllowanceBreakdown
- type BatchGetCalculationsQuery
- type Breakdown
- type CalculateReq
- type Calculation
- type CalculationQuery
- type Commission
- type CommissionBreakdown
- type GetTransactionReq
- type ListCalculationsResult
- type ListTransactionsResult
- type ListWordlistsResult
- type MonthlySalary
- type RecalculateReq
- type SalaryBreakdown
- type Service
- func (s *Service) CalculateIncome(ctx context.Context, in *CalculateReq) (*Calculation, error)
- func (s *Service) CompleteCalculation(ctx context.Context, number string) (*Calculation, error)
- func (s *Service) CreateWordlist(ctx context.Context, in *WordlistReq) (*Wordlist, error)
- func (s *Service) ExportCalculationToExcelByNumber(ctx context.Context, number string) (*bytes.Buffer, error)
- func (s *Service) ExportCalculationsToExcel(ctx context.Context, in *BatchGetCalculationsQuery) (*bytes.Buffer, error)
- func (s *Service) GetCalculationByNumber(ctx context.Context, number string) (*Calculation, error)
- func (s *Service) GetIncomeTransactionByBillNumber(ctx context.Context, in *GetTransactionReq) (*Transaction, error)
- func (s *Service) GetWordlistByID(ctx context.Context, id int64) (*Wordlist, error)
- func (s *Service) ListCalculations(ctx context.Context, in *CalculationQuery) (*ListCalculationsResult, error)
- func (s *Service) ListIncomeTransactionsByNumber(ctx context.Context, in *TransactionReq) (*ListTransactionsResult, error)
- func (s *Service) ListWordlists(ctx context.Context, in *WordlistQuery) (*ListWordlistsResult, error)
- func (s *Service) ReCalculateIncome(ctx context.Context, in *RecalculateReq) (*Calculation, error)
- func (s *Service) UpdateWordlist(ctx context.Context, in *WordlistReq) (*Wordlist, error)
- type Source
- type Transaction
- type TransactionReq
- type Wordlist
- type WordlistQuery
- type WordlistReq
Constants ¶
View Source
const ( SourceUnSpecified source = iota SourceSalary SourceAllowance SourceCommission SourceBasicSalaryInterview )
Variables ¶
View Source
var ErrCalculationNotFound = fmt.Errorf("calculation not found")
ErrCalculationNotFound is returned when a calculation is not found in the database.
View Source
var ErrWordlistNotFound = errors.New("wordlist not found")
ErrWordlistNotFound is returned when a wordlist is not found in the database.
Functions ¶
This section is empty.
Types ¶
type AllowanceBreakdown ¶
type AllowanceBreakdown struct {
Allowances []Allowance `json:"allowances"`
Total decimal.Decimal `json:"total"`
}
func (*AllowanceBreakdown) Bytes ¶
func (l *AllowanceBreakdown) Bytes() []byte
type BatchGetCalculationsQuery ¶
type BatchGetCalculationsQuery struct {
ID int64 `query:"id"`
Product string `query:"product"`
Number string `query:"number"`
AccountDisplayName string `query:"accountDisplayName"`
CreatedAfter time.Time `query:"createdAfter"`
CreatedBefore time.Time `query:"createdBefore"`
// contains filtered or unexported fields
}
type CalculateReq ¶
type CalculateReq struct {
Number string `json:"number"`
Product types.ProductType `json:"product"`
StatementFileName string `json:"statementFileName"`
}
func (*CalculateReq) Validate ¶
func (r *CalculateReq) Validate() error
type Calculation ¶
type Calculation struct {
ID int64 `json:"id"`
StatementFileName string `json:"statementFileName"`
Number string `json:"number"`
Product types.ProductType `json:"product"`
Account Account `json:"account"`
ExchangeRate decimal.Decimal `json:"exchangeRate"`
BasicSalaryFromInterview decimal.Decimal `json:"basicSalaryFromInterview"`
MonthlyAverageIncome decimal.Decimal `json:"monthlyAverageIncome"`
MonthlyNetIncome decimal.Decimal `json:"monthlyNetIncome"`
MonthlyOtherIncome decimal.Decimal `json:"monthlyOtherIncome"`
EightyPercentOfMonthlyOtherIncome decimal.Decimal `json:"eightyPercentOfMonthlyOtherIncome"`
TotalOtherIncome decimal.Decimal `json:"totalOtherIncome"`
TotalBasicSalary decimal.Decimal `json:"totalBasicSalary"`
TotalIncome decimal.Decimal `json:"totalIncome"`
PeriodInMonth decimal.Decimal `json:"periodInMonth"`
StartedAt time.Time `json:"startedAt"`
EndedAt time.Time `json:"endedAt"`
Status types.AnalysisStatus `json:"status"`
CreatedBy string `json:"createdBy"`
UpdatedBy string `json:"updatedBy"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
SalaryBreakdown *SalaryBreakdown `json:"salaryBreakdown"`
AllowanceBreakdown *AllowanceBreakdown `json:"allowanceBreakdown"`
CommissionBreakdown *CommissionBreakdown `json:"commissionBreakdown"`
Source *Source `json:"source"`
}
func (*Calculation) Complete ¶
func (c *Calculation) Complete(by string)
func (*Calculation) IsCompleted ¶
func (c *Calculation) IsCompleted() bool
func (*Calculation) ReCalculate ¶
func (c *Calculation) ReCalculate(by string, in *RecalculateReq) error
type CalculationQuery ¶
type CalculationQuery struct {
ID int64 `query:"id"`
Product string `query:"product"`
Number string `query:"number"`
AccountDisplayName string `query:"accountDisplayName"`
CreatedAfter time.Time `query:"createdAfter"`
CreatedBefore time.Time `query:"createdBefore"`
PageSize uint64 `query:"pageSize"`
PageToken string `query:"pageToken"`
}
type Commission ¶
type Commission struct {
Month string `json:"month"`
Transactions []Transaction `json:"transactions"`
Total decimal.Decimal `json:"total"`
}
type CommissionBreakdown ¶
type CommissionBreakdown struct {
Commissions []Commission `json:"commissions"`
MonthlyAverage decimal.Decimal `json:"monthlyAverage"`
Total decimal.Decimal `json:"total"`
}
func (*CommissionBreakdown) Bytes ¶
func (l *CommissionBreakdown) Bytes() []byte
type GetTransactionReq ¶
type GetTransactionReq struct {
Number string `json:"number" param:"number"`
BillNumber string `json:"billNumber" param:"billNumber"`
}
func (*GetTransactionReq) Validate ¶
func (r *GetTransactionReq) Validate() error
type ListCalculationsResult ¶
type ListCalculationsResult struct {
Calculations []*Calculation `json:"calculations"`
NextPageToken string `json:"nextPageToken"`
}
type ListTransactionsResult ¶
type ListTransactionsResult struct {
Transactions []*Transaction `json:"transactions"`
}
type ListWordlistsResult ¶
type MonthlySalary ¶
type RecalculateReq ¶
type RecalculateReq struct {
Number string `param:"number"`
BasicSalaryFromInterview decimal.Decimal `json:"basicSalaryFromInterview"`
MonthlySalaries []MonthlySalary `json:"monthlySalaries"`
Allowances []Allowance `json:"allowances"`
Commissions []Commission `json:"commissions"`
}
type SalaryBreakdown ¶
type SalaryBreakdown struct {
MonthlySalaries []MonthlySalary `json:"monthlySalaries"`
BasicSalary decimal.Decimal `json:"basicSalary"`
Total decimal.Decimal `json:"total"`
}
func (*SalaryBreakdown) Bytes ¶
func (l *SalaryBreakdown) Bytes() []byte
func (SalaryBreakdown) Length ¶
func (s SalaryBreakdown) Length() decimal.Decimal
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CalculateIncome ¶
func (s *Service) CalculateIncome(ctx context.Context, in *CalculateReq) (*Calculation, error)
func (*Service) CompleteCalculation ¶
func (*Service) CreateWordlist ¶
func (*Service) ExportCalculationToExcelByNumber ¶
func (*Service) ExportCalculationsToExcel ¶
func (*Service) GetCalculationByNumber ¶
func (*Service) GetIncomeTransactionByBillNumber ¶
func (s *Service) GetIncomeTransactionByBillNumber(ctx context.Context, in *GetTransactionReq) (*Transaction, error)
func (*Service) GetWordlistByID ¶
func (*Service) ListCalculations ¶
func (s *Service) ListCalculations(ctx context.Context, in *CalculationQuery) (*ListCalculationsResult, error)
func (*Service) ListIncomeTransactionsByNumber ¶
func (s *Service) ListIncomeTransactionsByNumber(ctx context.Context, in *TransactionReq) (*ListTransactionsResult, error)
func (*Service) ListWordlists ¶
func (s *Service) ListWordlists(ctx context.Context, in *WordlistQuery) (*ListWordlistsResult, error)
func (*Service) ReCalculateIncome ¶
func (s *Service) ReCalculateIncome(ctx context.Context, in *RecalculateReq) (*Calculation, error)
func (*Service) UpdateWordlist ¶
type Source ¶
type Source struct {
BasicSalary Breakdown `json:"basicSalary"`
Allowance Breakdown `json:"allowance"`
Commission Breakdown `json:"commission"`
}
Source represents the source of income.
type Transaction ¶
type TransactionReq ¶
type TransactionReq struct {
// The statement calculation number
Number string `json:"number" param:"number"`
// Category is the source of the income
Category source `json:"category"`
// Month in MMYYYY format
Month types.MMYYY `json:"month"`
}
func (*TransactionReq) Validate ¶
func (r *TransactionReq) Validate() error
type Wordlist ¶
type WordlistQuery ¶
type WordlistQuery struct {
ID int64 `json:"id" param:"id" query:"id"`
Word string `json:"word" query:"word"`
Category string `json:"category" query:"category"`
PageToken string `json:"pageToken" query:"pageToken"`
PageSize uint64 `json:"pageSize" query:"pageSize"`
CreatedAfter time.Time `json:"createdAfter" query:"createdAfter"`
CreatedBefore time.Time `json:"createdBefore" query:"createdBefore"`
// contains filtered or unexported fields
}
type WordlistReq ¶
type WordlistReq struct {
// ID is used for updating an existing wordlist.
ID int64 `json:"-" param:"id"`
Word string `json:"word"`
Category source `json:"category"`
}
func (*WordlistReq) ToWordlist ¶
func (r *WordlistReq) ToWordlist(by string) *Wordlist
func (*WordlistReq) Validate ¶
func (r *WordlistReq) Validate() error
Click to show internal directories.
Click to hide internal directories.