fixed code documentation

This commit is contained in:
Fran Jurmanović
2021-08-29 10:51:29 +02:00
parent 655f136008
commit 72b086b2ff
35 changed files with 674 additions and 70 deletions

View File

@@ -10,7 +10,15 @@ import (
"github.com/go-pg/pg/v10/orm"
)
// Creates api table if it does not exist.
/*
CreateTableApi
Creates api table if it does not exist.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with table creation
*/
func CreateTableApi(db pg.DB) error {
models := []interface{}{

View File

@@ -10,7 +10,15 @@ import (
"github.com/go-pg/pg/v10/orm"
)
// Creates api users if it does not exist.
/*
CreateTableUsers
Creates users table if it does not exist.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with table creation
*/
func CreateTableUsers(db pg.DB) error {
models := []interface{}{
(*models.User)(nil),

View File

@@ -10,7 +10,15 @@ import (
"github.com/go-pg/pg/v10/orm"
)
// Creates wallets table if it does not exist.
/*
CreateTableWallets
Creates wallets table if it does not exist.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with table creation
*/
func CreateTableWallets(db pg.DB) error {
models := []interface{}{
(*models.Wallet)(nil),

View File

@@ -10,7 +10,15 @@ import (
"github.com/go-pg/pg/v10/orm"
)
// Creates transactionTypes table if it does not exist.
/*
CreateTableTransactionTypes
Creates transaction_types table if it does not exist.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with table creation
*/
func CreateTableTransactionTypes(db pg.DB) error {
models := []interface{}{
(*models.TransactionType)(nil),

View File

@@ -10,7 +10,15 @@ import (
"github.com/go-pg/pg/v10/orm"
)
// Creates api transactions if it does not exist.
/*
CreateTableTransactions
Creates transactions table if it does not exist.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with table creation
*/
func CreateTableTransactions(db pg.DB) error {
models := []interface{}{
(*models.Transaction)(nil),

View File

@@ -10,7 +10,15 @@ import (
"github.com/go-pg/pg/v10/orm"
)
// Creates subscriptionTypes table if it does not exist.
/*
CreateTableSubscriptionTypes
Creates subscription_types table if it does not exist.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with table creation
*/
func CreateTableSubscriptionTypes(db pg.DB) error {
models := []interface{}{
(*models.SubscriptionType)(nil),

View File

@@ -9,7 +9,15 @@ import (
"github.com/go-pg/pg/v10/orm"
)
// Creates subscriptions table if it does not exist.
/*
CreateTableSubscriptions
Creates subscriptions table if it does not exist.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with table creation
*/
func CreateTableSubscriptions(db pg.DB) error {
models := []interface{}{
(*models.Subscription)(nil),

View File

@@ -8,7 +8,15 @@ import (
"github.com/go-pg/pg/v10"
)
// Populates subscriptionTypes table if it does not exist.
/*
PopulateSubscriptionTypes
Populates subscription_types table if it exists.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with populating table
*/
func PopulateSubscriptionTypes(db pg.DB) error {
daily := new(models.SubscriptionType)
weekly := new(models.SubscriptionType)

View File

@@ -8,7 +8,15 @@ import (
"github.com/go-pg/pg/v10"
)
// Populates transactionTypes table if it does not exist.
/*
PopulateTransactionTypes
Populates transaction_types table if it exists.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with populating table
*/
func PopulateTransactionTypes(db pg.DB) error {
gain := new(models.TransactionType)
expense := new(models.TransactionType)

View File

@@ -4,7 +4,15 @@ import (
"github.com/go-pg/pg/v10"
)
// Starts database migration.
/*
Start
Starts database migration.
Args:
*pg.DB: Postgres database client
Returns:
error: Returns if there is an error with populating table
*/
func Start(conn *pg.DB, version string) {
migration001 := Migration{
Version: "001",