MCPcopy Index your code
hub / github.com/devpew/Muffin-REST-API / myRUBCurrentFunds

Function myRUBCurrentFunds

main.go:133–156  ·  view source on GitHub ↗
(fundType string)

Source from the content-addressed store, hash-verified

131}
132
133func myRUBCurrentFunds(fundType string) []Funds {
134 var amountShares []Funds
135
136 db, err := sql.Open("postgres", "postgres://postgres:1234@localhost/fin?sslmode=disable")
137
138 if err != nil {
139 log.Fatal(err)
140 }
141
142 rows, err := db.Query("SELECT * FROM funds WHERE type = $1 ORDER BY ticker ASC", fundType)
143
144 for rows.Next() {
145 bk := Funds{}
146 err = rows.Scan(&bk.Id, &bk.Name, &bk.Ticker, &bk.Amount, &bk.PricePerItem, &bk.PurchasePrice, &bk.PriceCurrent, &bk.PercentChanges, &bk.YearlyInvestment, &bk.ClearMoney, &bk.DatePurchase, &bk.DateLastUpdate, &bk.Type)
147 if err != nil {
148 fmt.Println(err)
149 }
150 amountShares = append(amountShares, bk)
151 }
152
153 defer rows.Close()
154
155 return amountShares
156}
157
158func myUSDCurrentFunds(fundType string) []Funds {
159 var amountShares []Funds

Callers 2

getRUBFundsSharesFunction · 0.85
getRUBFundsBondsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected