repository

package
v0.0.0-...-f5427db Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCrypto

func AddCrypto(database *sql.DB, ctx context.Context, crypto m.CryptoCurrency) (*m.CryptoCurrency, error)

Function to Add a new Cryptocurrency

func BuildDatabase

func BuildDatabase(database *sql.DB, seedData bool)

Function to Build Database, Create Tables and Data Seeding

func CleanTable

func CleanTable(database *sql.DB, tableName string)

func DownvoteCryptoById

func DownvoteCryptoById(database *sql.DB, ctx context.Context, cryptoId int) (int, error)

Function to Subtract a Vote to Given Crypto

func DropTable

func DropTable(database *sql.DB, tableName string)

func ExecuteCustomStatement

func ExecuteCustomStatement(database *sql.DB, statement string)

func FindAllCryptos

func FindAllCryptos(database *sql.DB, ctx context.Context, sortParameter string) ([]m.CryptoCurrency, error)

Function to Get All Cryptos according to given parameter

func FindCryptoById

func FindCryptoById(database *sql.DB, ctx context.Context, cryptoId int) (m.CryptoCurrency, error)

//Function to return a CRYPTO by ID

func RemoveCryptoById

func RemoveCryptoById(database *sql.DB, ctx context.Context, cryptoId int) error

Function to Delete a Crypto by its ID

func ReseedTable

func ReseedTable(database *sql.DB, tableName string)

func UpdateCrypto

func UpdateCrypto(database *sql.DB, ctx context.Context, crypto m.CryptoCurrency) (*m.CryptoCurrency, error)

func UpvoteCryptoById

func UpvoteCryptoById(database *sql.DB, ctx context.Context, cryptoId int) (int, error)

Function to Add a Vote to Given Crypto

Types

type Klever

type Klever struct {
	DB *sql.DB
}

Struct to store the Database connection to share it across the application

func DatabaseInit

func DatabaseInit() *Klever

Function to Open the Database Connection and store it in the Klever Struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL