Minimal linting improvements

This commit is contained in:
2022-02-20 21:19:28 +00:00
parent 545f223a97
commit c03d16878a
10 changed files with 23 additions and 17 deletions

View File

@ -8,7 +8,7 @@ import (
"github.com/google/uuid"
)
// NewBudget creates a budget and adds it to the current user
// NewBudget creates a budget and adds it to the current user.
func (s *Database) NewBudget(context context.Context, name string, userID uuid.UUID) (*Budget, error) {
tx, err := s.BeginTx(context, &sql.TxOptions{})
if err != nil {

View File

@ -17,7 +17,7 @@ type Database struct {
*sql.DB
}
// Connect to a database
// Connect connects to a database.
func Connect(typ string, connString string) (*Database, error) {
conn, err := sql.Open(typ, connString)
if err != nil {

View File

@ -56,7 +56,7 @@ func NewYNABImport(context context.Context, queries *Queries, budgetID uuid.UUID
// "Month" "Category Group/Category" "Category Group" "Category" "Budgeted" "Activity" "Available"
// "Apr 2019" "Income: Next Month" "Income" "Next Month" 0,00€ 0,00€ 0,00€
//
// Activity and Available are not imported, since they are determined by the transactions and historic assignments
// Activity and Available are not imported, since they are determined by the transactions and historic assignments.
func (ynab *YNABImport) ImportAssignments(context context.Context, r io.Reader) error {
csv := csv.NewReader(r)
csv.Comma = '\t'
@ -184,7 +184,8 @@ func (ynab *YNABImport) ImportTransactions(context context.Context, r io.Reader)
// Transaction is a transfer to
var shouldReturn bool
var returnValue error
openTransfers, shouldReturn, returnValue = ynab.ImportTransaction(payeeName, context, transaction, accountName, openTransfers, account, amount)
openTransfers, shouldReturn, returnValue = ynab.ImportTransaction(
payeeName, context, transaction, accountName, openTransfers, account, amount)
if shouldReturn {
return returnValue
}
@ -368,13 +369,15 @@ func (ynab *YNABImport) GetCategory(context context.Context, group string, name
}
}
categoryGroup, err := ynab.queries.CreateCategoryGroup(context, CreateCategoryGroupParams{Name: group, BudgetID: ynab.budgetID})
newGroup := CreateCategoryGroupParams{Name: group, BudgetID: ynab.budgetID}
categoryGroup, err := ynab.queries.CreateCategoryGroup(context, newGroup)
if err != nil {
return uuid.NullUUID{}, err
}
ynab.categoryGroups = append(ynab.categoryGroups, categoryGroup)
category, err := ynab.queries.CreateCategory(context, CreateCategoryParams{Name: name, CategoryGroupID: categoryGroup.ID})
newCategory := CreateCategoryParams{Name: name, CategoryGroupID: categoryGroup.ID}
category, err := ynab.queries.CreateCategory(context, newCategory)
if err != nil {
return uuid.NullUUID{}, err
}