db

package
v0.0.0-...-d0dd730 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

DB is the admin database

View Source
var DBC *sql.DB

DBC is the customer database

View Source
var DBSC *sql.DB

DBSC is the stellar core database

View Source
var MimeTypes map[string]string

MimeTypes - dictionary of mime types used

Functions

func ActivateUser

func ActivateUser(userID int, active bool, updatedBy string) error

ActivateUser activates or deactivates the state of a user

func AddAssetCode

func AddAssetCode(account *models.AdminStellarAccount, assetCode string, updatedBy string) error

AddAssetCode - adds new asset code to issuer account

func AddIcoPhase

func AddIcoPhase(icoPhase *models.IcoPhase, currencies models.IcoPhaseActivatedExchangeCurrencySlice) error

AddIcoPhase - adds a new ico phase

func AddKnownCurrency

func AddKnownCurrency(currency *models.AdminKnownCurrency) error

AddKnownCurrency adds new currency to known currencies

func AddKnownInflationDestination

func AddKnownInflationDestination(inflationDestination *models.AdminKnownInflationDestination) error

AddKnownInflationDestination adds new inflation destination to known inflation destinations

func AddPromo

func AddPromo(promo *models.AdminPromo) error

AddPromo adds a new promo the DB

func AddSigner

func AddSigner(account *models.AdminStellarAccount, signer *models.AdminStellarSigner, updatedBy string) error

AddSigner - adds new signer to issuer account

func AddStellarAccount

func AddStellarAccount(account *models.AdminStellarAccount, assetCode string) error

AddStellarAccount creates a new account

func AddTrustline

func AddTrustline(trustline *models.AdminUnauthorizedTrustline, updatedBy string) error

AddTrustline adds a new trustline

func AllActiveAdministrators

func AllActiveAdministrators() (models.AdminUserSlice, error)

AllActiveAdministrators - returns all users

func AllStellarAccounts

func AllStellarAccounts() (models.AdminStellarAccountSlice, error)

AllStellarAccounts - returns all stellar accounts

func AllUsers

func AllUsers() (models.AdminUserSlice, error)

AllUsers - returns all users

func ChangeKnownCurrencyOrder

func ChangeKnownCurrencyOrder(currency *models.AdminKnownCurrency, OrderModifier int, updatedBy string) error

ChangeKnownCurrencyOrder - changes the order of the currency

func ChangeKnownInflationDestinationOrder

func ChangeKnownInflationDestinationOrder(inflationDestination *models.AdminKnownInflationDestination, OrderModifier int, updatedBy string) error

ChangeKnownInflationDestinationOrder - changes the order of the inflation destination

func ChangePromoOrder

func ChangePromoOrder(promo *models.AdminPromo, OrderModifier int, updatedBy string) error

ChangePromoOrder - changes the order of the promo

func CreateNewDB

func CreateNewDB(cnf *config.Config) error

CreateNewDB creates a new DB connection

func DeleteIco

func DeleteIco(ico *models.Ico) error

DeleteIco - deletes the ico

func DeleteKnownCurrency

func DeleteKnownCurrency(currency *models.AdminKnownCurrency) error

DeleteKnownCurrency - deletes the currency

func DeleteKnownInflationDestination

func DeleteKnownInflationDestination(inflationDestination *models.AdminKnownInflationDestination) error

DeleteKnownInflationDestination - deletes the inflation destination

func DeletePromo

func DeletePromo(promo *models.AdminPromo) error

DeletePromo - deletes the promo

func DeleteStellarAccount

func DeleteStellarAccount(account *models.AdminStellarAccount) error

DeleteStellarAccount - deletes the account

func DeleteUnauthorizedTrustline

func DeleteUnauthorizedTrustline(trustorPublicKey string, issuingPublicKey string, assetCode string) error

DeleteUnauthorizedTrustline - removes the trustline

func ExistsCurrency

func ExistsCurrency(id int) (bool, error)

ExistsCurrency - true if a currency with the specified asset code and issuer is found

func ExistsIcoName

func ExistsIcoName(icoName string, selfID *int) (bool, error)

ExistsIcoName - true if an ico with the same name exists

func ExistsKnownCurrency

func ExistsKnownCurrency(issuerPublicKey, assetCode string) (bool, error)

ExistsKnownCurrency - true if a currency with the same public key and asset code exists

func ExistsKnownInflationDestination

func ExistsKnownInflationDestination(issuerPublicKey string) (bool, error)

ExistsKnownInflationDestination - true if a inflation destination with the same asset code exists

func ExistsStellarAccount

func ExistsStellarAccount(publicKey string) (bool, error)

ExistsStellarAccount - true if an account with the public key already exists

func ExistsUnauthorizedTrustline

func ExistsUnauthorizedTrustline(trustorPublicKey string, issuingPublicKey string, assetCode string) (bool, error)

ExistsUnauthorizedTrustline - true if trustline already exists

func GetActivePromos

func GetActivePromos() (models.AdminPromoSlice, error)

GetActivePromos - returns active promos

func GetCoreTrustlines

func GetCoreTrustlines(accountPublicKey string) (coremodels.TrustlineSlice, error)

GetCoreTrustlines - gets the trustlines

func GetIco

func GetIco(id int) (*models.Ico, error)

GetIco - returns the ico

func GetIcoEager

func GetIcoEager(id int) (*models.Ico, error)

GetIcoEager - gets ico and eager loads its children

func GetKnownCurrencies

func GetKnownCurrencies() (models.AdminKnownCurrencySlice, error)

GetKnownCurrencies - returns all known currencies

func GetKnownCurrency

func GetKnownCurrency(issuerPublicKey, assetCode string) (*models.AdminKnownCurrency, error)

GetKnownCurrency - returns the known currency

func GetKnownCurrencyByID

func GetKnownCurrencyByID(ID int) (*models.AdminKnownCurrency, error)

GetKnownCurrencyByID - returns the known currency associated to the id

func GetKnownInflationDestination

func GetKnownInflationDestination(issuerPublicKey string) (*models.AdminKnownInflationDestination, error)

GetKnownInflationDestination - returns the known inflation destination

func GetKnownInflationDestinationByID

func GetKnownInflationDestinationByID(ID int) (*models.AdminKnownInflationDestination, error)

GetKnownInflationDestinationByID - returns the known inflation destination associated to the id

func GetKnownInflationDestinations

func GetKnownInflationDestinations() (models.AdminKnownInflationDestinationSlice, error)

GetKnownInflationDestinations - returns all known inflation destinations

func GetPromoByID

func GetPromoByID(ID int) (*models.AdminPromo, error)

GetPromoByID - returns the promo associated to the id

func GetPromos

func GetPromos() (models.AdminPromoSlice, error)

GetPromos - returns all promos

func GetStellarAccount

func GetStellarAccount(publicKey string) (*models.AdminStellarAccount, error)

GetStellarAccount - returns the stellar account

func GetStellarIssuerAccounts

func GetStellarIssuerAccounts() (models.AdminStellarAccountSlice, error)

GetStellarIssuerAccounts - gets the stellar issuer accounts

func GetStellarSigner

func GetStellarSigner(publicKey string) (*models.AdminStellarSigner, error)

GetStellarSigner - returns the stellar signer

func GetUnauthorizedTrustlines

func GetUnauthorizedTrustlines(trustorPublicKey string) (models.AdminUnauthorizedTrustlineSlice, error)

GetUnauthorizedTrustlines - gets the trustlines

func IssuerAssetCodes

func IssuerAssetCodes(issuerPublicKey string) (models.AdminStellarAssetSlice, error)

IssuerAssetCodes - returns the asset codes

func IssuerStellarAccounts

func IssuerStellarAccounts() (models.AdminStellarAccountSlice, error)

IssuerStellarAccounts - returns the issuer stellar accounts

func KnownCurrencyNewOrderIndex

func KnownCurrencyNewOrderIndex() (int, error)

KnownCurrencyNewOrderIndex returns the greatest order from the db + 1, used when inserting a new currency

func KnownInflationDestinationNewOrderIndex

func KnownInflationDestinationNewOrderIndex() (int, error)

KnownInflationDestinationNewOrderIndex returns the greatest order from the db + 1, used when inserting a new inflation destination

func PromoNewOrderIndex

func PromoNewOrderIndex() (int, error)

PromoNewOrderIndex returns the greatest order from the db + 1, used when inserting a new promo

func RegisterUser

func RegisterUser(user *models.AdminUser, groups []string) error

RegisterUser creates a new user

func RemoveAssetCode

func RemoveAssetCode(account *models.AdminStellarAccount, assetCode string, updatedBy string) error

RemoveAssetCode - removes asset code from issuer account

func RemoveSigner

func RemoveSigner(account *models.AdminStellarAccount, signerPublicKey string, signerType string, updatedBy string) error

RemoveSigner - removes signer from issuer account

func SetGroups

func SetGroups(userID int, groups []string) error

SetGroups - sets the groups for the specified user

func UpdateKnownCurrency

func UpdateKnownCurrency(currency *models.AdminKnownCurrency, updatedBy string) error

UpdateKnownCurrency - updates the currency in the db

func UpdateKnownInflationDestination

func UpdateKnownInflationDestination(inflationDestination *models.AdminKnownInflationDestination, updatedBy string) error

UpdateKnownInflationDestination - updates the inflation destination in the db

func UpdateLastLogin

func UpdateLastLogin(user UserDetails) error

UpdateLastLogin updates in the db the last login date

func UpdatePromo

func UpdatePromo(promo *models.AdminPromo, updatedBy string) error

UpdatePromo - updates the promo in the db

func UpdateSigner

func UpdateSigner(signer *models.AdminStellarSigner, updatedBy string) error

UpdateSigner - updates the signer

func UpdateStellarAccount

func UpdateStellarAccount(account *models.AdminStellarAccount, updatedBy string) error

UpdateStellarAccount - updates the account in the db

func UpdateSupportedCurrencies

func UpdateSupportedCurrencies(icoID int, supportedCurrencies models.IcoSupportedExchangeCurrencySlice) error

UpdateSupportedCurrencies - updates the supported currencies of an ico

func UpdateUser

func UpdateUser(user models.AdminUser, updatedBy string) error

UpdateUser - edits the user properties

Types

type UserDetails

type UserDetails struct {
	ID        int      `json:"id"`
	Password  string   `json:"password"`
	Email     string   `json:"email"`
	FirstName string   `json:"firstname"`
	LastName  string   `json:"lastName"`
	Phone     string   `json:"phone"`
	Active    bool     `json:"active"`
	Groups    []string `json:"groups"`
}

UserDetails holds the user info

func GetUserByEmail

func GetUserByEmail(email string) (*UserDetails, error)

GetUserByEmail returns the user details for the specified email

func GetUserByID

func GetUserByID(userID int) (*UserDetails, error)

GetUserByID returns the user details for the specified ID

Jump to

Keyboard shortcuts

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