Documentation
¶
Index ¶
- func CreateDBConnection(uri string) (*pgxpool.Pool, error)
- type Account
- type AddAccountBalanceParams
- type AddLineTxParams
- type AddLineTxResult
- type AddMonthBalanceParams
- type AddYearBalanceParams
- type Category
- type CreateAccountParams
- type CreateCategoryParams
- type CreateLineParams
- type CreateMonthParams
- type CreateRecLineParams
- type CreateSessionParams
- type CreateUserParams
- type CreateYearParams
- type DBTX
- type DeleteLineTxParams
- type DeleteLineTxResult
- type GetExpliciteLineRow
- type Line
- type ListAccountsParams
- type ListCategoriesParams
- type ListExplicitLinesParams
- type ListExplicitLinesRow
- type ListLinesParams
- type ListMonthsParams
- type ListRecLinesParams
- type ListYearsParams
- type Month
- type Querier
- type Queries
- func (q *Queries) AddAccountBalance(ctx context.Context, arg AddAccountBalanceParams) (Account, error)
- func (q *Queries) AddMonthBalance(ctx context.Context, arg AddMonthBalanceParams) (Month, error)
- func (q *Queries) AddYearBalance(ctx context.Context, arg AddYearBalanceParams) (Year, error)
- func (q *Queries) CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)
- func (q *Queries) CreateCategory(ctx context.Context, arg CreateCategoryParams) (Category, error)
- func (q *Queries) CreateLine(ctx context.Context, arg CreateLineParams) (Line, error)
- func (q *Queries) CreateMonth(ctx context.Context, arg CreateMonthParams) (Month, error)
- func (q *Queries) CreateRecLine(ctx context.Context, arg CreateRecLineParams) (Recline, error)
- func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
- func (q *Queries) CreateYear(ctx context.Context, arg CreateYearParams) (Year, error)
- func (q *Queries) DeleteAccount(ctx context.Context, id int64) error
- func (q *Queries) DeleteCategory(ctx context.Context, id int64) error
- func (q *Queries) DeleteLine(ctx context.Context, id int64) error
- func (q *Queries) DeleteMonth(ctx context.Context, id int64) error
- func (q *Queries) DeleteRecLine(ctx context.Context, id int64) error
- func (q *Queries) DeleteUser(ctx context.Context, username string) error
- func (q *Queries) DeleteYear(ctx context.Context, id int64) error
- func (q *Queries) GetAccount(ctx context.Context, id int64) (Account, error)
- func (q *Queries) GetAccountForUpdate(ctx context.Context, id int64) (Account, error)
- func (q *Queries) GetCategory(ctx context.Context, id int64) (Category, error)
- func (q *Queries) GetCategoryForUpdate(ctx context.Context, id int64) (Category, error)
- func (q *Queries) GetExpliciteLine(ctx context.Context, id int64) (GetExpliciteLineRow, error)
- func (q *Queries) GetLine(ctx context.Context, id int64) (Line, error)
- func (q *Queries) GetLineForUpdate(ctx context.Context, id int64) (Line, error)
- func (q *Queries) GetMonth(ctx context.Context, id int64) (Month, error)
- func (q *Queries) GetMonthForUpdate(ctx context.Context, id int64) (Month, error)
- func (q *Queries) GetRecLine(ctx context.Context, id int64) (Recline, error)
- func (q *Queries) GetRecLineForUpdate(ctx context.Context, id int64) (Recline, error)
- func (q *Queries) GetSession(ctx context.Context, id uuid.UUID) (Session, error)
- func (q *Queries) GetUser(ctx context.Context, username string) (User, error)
- func (q *Queries) GetYear(ctx context.Context, id int64) (Year, error)
- func (q *Queries) GetYearForUpdate(ctx context.Context, id int64) (Year, error)
- func (q *Queries) ListAccounts(ctx context.Context, arg ListAccountsParams) ([]Account, error)
- func (q *Queries) ListCategories(ctx context.Context, arg ListCategoriesParams) ([]Category, error)
- func (q *Queries) ListExplicitLines(ctx context.Context, arg ListExplicitLinesParams) ([]ListExplicitLinesRow, error)
- func (q *Queries) ListLines(ctx context.Context, arg ListLinesParams) ([]Line, error)
- func (q *Queries) ListMonths(ctx context.Context, arg ListMonthsParams) ([]Month, error)
- func (q *Queries) ListRecLines(ctx context.Context, arg ListRecLinesParams) ([]Recline, error)
- func (q *Queries) ListYears(ctx context.Context, arg ListYearsParams) ([]Year, error)
- func (q *Queries) UpdateAccount(ctx context.Context, arg UpdateAccountParams) (Account, error)
- func (q *Queries) UpdateLine(ctx context.Context, arg UpdateLineParams) (Line, error)
- func (q *Queries) UpdateMonth(ctx context.Context, arg UpdateMonthParams) (Month, error)
- func (q *Queries) UpdateRecLine(ctx context.Context, arg UpdateRecLineParams) (Recline, error)
- func (q *Queries) UpdateYear(ctx context.Context, arg UpdateYearParams) (Year, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type Recline
- type SQLStore
- func (store *SQLStore) AddLineTx(ctx context.Context, arg AddLineTxParams) (AddLineTxResult, error)
- func (store *SQLStore) DeleteLineTx(ctx context.Context, arg DeleteLineTxParams) (DeleteLineTxResult, error)
- func (store *SQLStore) UpdateLineTx(ctx context.Context, arg UpdateLineTxParams) (UpdateLineTxResult, error)
- type Session
- type Store
- type UpdateAccountParams
- type UpdateLineParams
- type UpdateLineTxParams
- type UpdateLineTxResult
- type UpdateMonthParams
- type UpdateRecLineParams
- type UpdateYearParams
- type User
- type Year
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddAccountBalanceParams ¶
type AddLineTxParams ¶
type AddLineTxParams struct {
Title string `json:"title"`
Owner string `json:"owner"`
Amount decimal.Decimal `json:"amount"`
Checked bool `json:"checked"`
Description string `json:"description"`
DueDate time.Time `json:"due_date"`
AccountID int64 `json:"account_id"`
MonthID int64 `json:"month_id"`
YearID int64 `json:"year_id"`
CategoryID int64 `json:"category_id"`
}
AddLineTxParams contains all infos to create a new line
type AddLineTxResult ¶
AddLineTxResult contains all infos about the result of line creation
type AddMonthBalanceParams ¶
type AddYearBalanceParams ¶
type CreateAccountParams ¶
type CreateCategoryParams ¶
type CreateLineParams ¶
type CreateLineParams struct {
Title string `json:"title"`
Owner string `json:"owner"`
AccountID int64 `json:"account_id"`
MonthID int64 `json:"month_id"`
CategoryID int64 `json:"category_id"`
YearID int64 `json:"year_id"`
Amount decimal.Decimal `json:"amount"`
Checked bool `json:"checked"`
Description string `json:"description"`
DueDate time.Time `json:"due_date"`
}
type CreateMonthParams ¶
type CreateRecLineParams ¶
type CreateRecLineParams struct {
Title string `json:"title"`
Owner string `json:"owner"`
AccountID int64 `json:"account_id"`
CategoryID int64 `json:"category_id"`
Amount decimal.Decimal `json:"amount"`
Description string `json:"description"`
Recurrency string `json:"recurrency"`
DueDate time.Time `json:"due_date"`
}
type CreateSessionParams ¶
type CreateUserParams ¶
type CreateYearParams ¶
type DeleteLineTxParams ¶
type DeleteLineTxParams struct {
ID int64 `json:"id"`
}
DeleteLineTxParams contains all infos to create a new line
type DeleteLineTxResult ¶
AddLineTxResult contains all infos about the result of line creation
type GetExpliciteLineRow ¶
type GetExpliciteLineRow struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Title string `json:"title"`
Account string `json:"account"`
Month string `json:"month"`
Category string `json:"category"`
Amount decimal.Decimal `json:"amount"`
Checked bool `json:"checked"`
Description string `json:"description"`
DueDate time.Time `json:"due_date"`
}
type Line ¶
type Line struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Title string `json:"title"`
AccountID int64 `json:"account_id"`
MonthID int64 `json:"month_id"`
YearID int64 `json:"year_id"`
CategoryID int64 `json:"category_id"`
// can be negative or positive
Amount decimal.Decimal `json:"amount"`
Checked bool `json:"checked"`
Description string `json:"description"`
DueDate time.Time `json:"due_date"`
}
type ListAccountsParams ¶
type ListCategoriesParams ¶
type ListExplicitLinesParams ¶
type ListExplicitLinesRow ¶
type ListExplicitLinesRow struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Title string `json:"title"`
Account string `json:"account"`
Month string `json:"month"`
Category string `json:"category"`
Amount decimal.Decimal `json:"amount"`
Checked bool `json:"checked"`
Description string `json:"description"`
DueDate time.Time `json:"due_date"`
}
type ListLinesParams ¶
type ListMonthsParams ¶
type ListRecLinesParams ¶
type ListYearsParams ¶
type Month ¶
type Month struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Title string `json:"title"`
Description string `json:"description"`
YearID int64 `json:"year_id"`
Balance decimal.Decimal `json:"balance"`
FinalBalance decimal.Decimal `json:"final_balance"`
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
}
type Querier ¶
type Querier interface {
AddAccountBalance(ctx context.Context, arg AddAccountBalanceParams) (Account, error)
AddMonthBalance(ctx context.Context, arg AddMonthBalanceParams) (Month, error)
AddYearBalance(ctx context.Context, arg AddYearBalanceParams) (Year, error)
CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)
CreateCategory(ctx context.Context, arg CreateCategoryParams) (Category, error)
CreateLine(ctx context.Context, arg CreateLineParams) (Line, error)
CreateMonth(ctx context.Context, arg CreateMonthParams) (Month, error)
CreateRecLine(ctx context.Context, arg CreateRecLineParams) (Recline, error)
CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
CreateYear(ctx context.Context, arg CreateYearParams) (Year, error)
DeleteAccount(ctx context.Context, id int64) error
DeleteCategory(ctx context.Context, id int64) error
DeleteLine(ctx context.Context, id int64) error
DeleteMonth(ctx context.Context, id int64) error
DeleteRecLine(ctx context.Context, id int64) error
DeleteUser(ctx context.Context, username string) error
DeleteYear(ctx context.Context, id int64) error
GetAccount(ctx context.Context, id int64) (Account, error)
GetAccountForUpdate(ctx context.Context, id int64) (Account, error)
GetCategory(ctx context.Context, id int64) (Category, error)
GetCategoryForUpdate(ctx context.Context, id int64) (Category, error)
GetExpliciteLine(ctx context.Context, id int64) (GetExpliciteLineRow, error)
GetLine(ctx context.Context, id int64) (Line, error)
GetLineForUpdate(ctx context.Context, id int64) (Line, error)
GetMonth(ctx context.Context, id int64) (Month, error)
GetMonthForUpdate(ctx context.Context, id int64) (Month, error)
GetRecLine(ctx context.Context, id int64) (Recline, error)
GetRecLineForUpdate(ctx context.Context, id int64) (Recline, error)
GetSession(ctx context.Context, id uuid.UUID) (Session, error)
GetUser(ctx context.Context, username string) (User, error)
GetYear(ctx context.Context, id int64) (Year, error)
GetYearForUpdate(ctx context.Context, id int64) (Year, error)
ListAccounts(ctx context.Context, arg ListAccountsParams) ([]Account, error)
ListCategories(ctx context.Context, arg ListCategoriesParams) ([]Category, error)
ListExplicitLines(ctx context.Context, arg ListExplicitLinesParams) ([]ListExplicitLinesRow, error)
ListLines(ctx context.Context, arg ListLinesParams) ([]Line, error)
ListMonths(ctx context.Context, arg ListMonthsParams) ([]Month, error)
ListRecLines(ctx context.Context, arg ListRecLinesParams) ([]Recline, error)
ListYears(ctx context.Context, arg ListYearsParams) ([]Year, error)
UpdateAccount(ctx context.Context, arg UpdateAccountParams) (Account, error)
UpdateLine(ctx context.Context, arg UpdateLineParams) (Line, error)
UpdateMonth(ctx context.Context, arg UpdateMonthParams) (Month, error)
UpdateRecLine(ctx context.Context, arg UpdateRecLineParams) (Recline, error)
UpdateYear(ctx context.Context, arg UpdateYearParams) (Year, error)
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AddAccountBalance ¶
func (*Queries) AddMonthBalance ¶
func (*Queries) AddYearBalance ¶
func (*Queries) CreateAccount ¶
func (*Queries) CreateCategory ¶
func (*Queries) CreateLine ¶
func (*Queries) CreateMonth ¶
func (*Queries) CreateRecLine ¶
func (*Queries) CreateSession ¶
func (*Queries) CreateUser ¶
func (*Queries) CreateYear ¶
func (*Queries) DeleteAccount ¶
func (*Queries) DeleteCategory ¶
func (*Queries) DeleteRecLine ¶
func (*Queries) DeleteUser ¶
func (*Queries) GetAccount ¶
func (*Queries) GetAccountForUpdate ¶
func (*Queries) GetCategory ¶
func (*Queries) GetCategoryForUpdate ¶
func (*Queries) GetExpliciteLine ¶
func (*Queries) GetLineForUpdate ¶
func (*Queries) GetMonthForUpdate ¶
func (*Queries) GetRecLine ¶
func (*Queries) GetRecLineForUpdate ¶
func (*Queries) GetSession ¶
func (*Queries) GetYearForUpdate ¶
func (*Queries) ListAccounts ¶
func (*Queries) ListCategories ¶
func (*Queries) ListExplicitLines ¶
func (q *Queries) ListExplicitLines(ctx context.Context, arg ListExplicitLinesParams) ([]ListExplicitLinesRow, error)
func (*Queries) ListMonths ¶
func (*Queries) ListRecLines ¶
func (*Queries) UpdateAccount ¶
func (*Queries) UpdateLine ¶
func (*Queries) UpdateMonth ¶
func (*Queries) UpdateRecLine ¶
func (*Queries) UpdateYear ¶
type Recline ¶
type Recline struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Title string `json:"title"`
AccountID int64 `json:"account_id"`
// can be negative or position
Amount decimal.Decimal `json:"amount"`
CategoryID int64 `json:"category_id"`
Description string `json:"description"`
Recurrency string `json:"recurrency"`
DueDate time.Time `json:"due_date"`
}
type SQLStore ¶
type SQLStore struct {
*Queries
// contains filtered or unexported fields
}
Store provides all function to execute db queries and transactions
func (*SQLStore) AddLineTx ¶
func (store *SQLStore) AddLineTx(ctx context.Context, arg AddLineTxParams) (AddLineTxResult, error)
func (*SQLStore) DeleteLineTx ¶
func (store *SQLStore) DeleteLineTx(ctx context.Context, arg DeleteLineTxParams) (DeleteLineTxResult, error)
func (*SQLStore) UpdateLineTx ¶
func (store *SQLStore) UpdateLineTx(ctx context.Context, arg UpdateLineTxParams) (UpdateLineTxResult, error)
type Session ¶
type Session struct {
ID uuid.UUID `json:"id"`
Username string `json:"username"`
RefreshToken string `json:"refresh_token"`
UserAgent string `json:"user_agent"`
ClientIp string `json:"client_ip"`
IsBlocked bool `json:"is_blocked"`
ExpiresAt time.Time `json:"expires_at"`
CreateAt time.Time `json:"create_at"`
}
type Store ¶
type Store interface {
Querier
AddLineTx(ctx context.Context, arg AddLineTxParams) (AddLineTxResult, error)
DeleteLineTx(ctx context.Context, arg DeleteLineTxParams) (DeleteLineTxResult, error)
UpdateLineTx(ctx context.Context, arg UpdateLineTxParams) (UpdateLineTxResult, error)
}
Store provides all function to execute db queries and transactions
type UpdateAccountParams ¶
type UpdateLineParams ¶
type UpdateLineParams struct {
ID int64 `json:"id"`
Title string `json:"title"`
AccountID int64 `json:"account_id"`
MonthID int64 `json:"month_id"`
CategoryID int64 `json:"category_id"`
YearID int64 `json:"year_id"`
Amount decimal.Decimal `json:"amount"`
Checked bool `json:"checked"`
Description string `json:"description"`
DueDate time.Time `json:"due_date"`
}
type UpdateLineTxParams ¶
type UpdateLineTxParams struct {
ID int64 `json:"id"`
Title *string `json:"title"`
Owner *string `json:"owner"`
AccountID *int64 `json:"account_id"`
MonthID *int64 `json:"month_id"`
YearID *int64 `json:"year_id"`
CategoryID *int64 `json:"category_id"`
Amount decimal.NullDecimal `json:"amount"`
Checked *bool `json:"checked"`
Description *string `json:"description"`
DueDate *time.Time `json:"due_date"`
}
UpdateLineTxParams contains all infos to update a new line
type UpdateLineTxResult ¶
UpdateLineTxResult contains all infos about the result of line creation
type UpdateMonthParams ¶
type UpdateRecLineParams ¶
type UpdateRecLineParams struct {
ID int64 `json:"id"`
Title string `json:"title"`
AccountID int64 `json:"account_id"`
CategoryID int64 `json:"category_id"`
Amount decimal.Decimal `json:"amount"`
Description string `json:"description"`
Recurrency string `json:"recurrency"`
DueDate time.Time `json:"due_date"`
}
type UpdateYearParams ¶
type Year ¶
type Year struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Title string `json:"title"`
Description string `json:"description"`
Balance decimal.Decimal `json:"balance"`
FinalBalance decimal.Decimal `json:"final_balance"`
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
}
Click to show internal directories.
Click to hide internal directories.