mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
fixed code documentation
This commit is contained in:
@@ -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{}{
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user