mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2024-12-22 11:39:23 +00:00
Lowercase & upperase initialism acronyms
See https://google.github.io/styleguide/go/decisions#initialisms
This commit is contained in:
parent
5f5ebd81a9
commit
cd52dc7b70
4 changed files with 13 additions and 13 deletions
|
@ -68,8 +68,8 @@ xmr-nodes probers list -s last_submit_ts -d asc sin1`,
|
|||
fmt.Fprintf(w, "%d\t| %s\t| %s\t| %s\n",
|
||||
prober.ID,
|
||||
prober.Name,
|
||||
time.Unix(prober.LastSubmitTs, 0).Format(time.RFC3339),
|
||||
prober.ApiKey,
|
||||
time.Unix(prober.LastSubmitTS, 0).Format(time.RFC3339),
|
||||
prober.APIKey,
|
||||
)
|
||||
}
|
||||
w.Flush()
|
||||
|
@ -115,7 +115,7 @@ This command will display the prober name and API key when successfully executed
|
|||
return
|
||||
}
|
||||
|
||||
fmt.Printf("Name: %s\nAPI Key: %s\n", prober.Name, prober.ApiKey)
|
||||
fmt.Printf("Name: %s\nAPI Key: %s\n", prober.Name, prober.APIKey)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ func CheckProber(c *fiber.Ctx) error {
|
|||
})
|
||||
}
|
||||
|
||||
prober, err := monero.NewProber().CheckApi(key)
|
||||
prober, err := monero.NewProber().CheckAPI(key)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
|
||||
"status": "error",
|
||||
|
|
|
@ -15,7 +15,7 @@ type ProberRepository interface {
|
|||
Add(name string) (Prober, error)
|
||||
Edit(id int, name string) error
|
||||
Probers(QueryProbers) ([]Prober, error)
|
||||
CheckApi(key string) (Prober, error)
|
||||
CheckAPI(key string) (Prober, error)
|
||||
Delete(id int) error
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ type ProberRepo struct {
|
|||
type Prober struct {
|
||||
ID int64 `json:"id" db:"id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
ApiKey uuid.UUID `json:"api_key" db:"api_key"`
|
||||
LastSubmitTs int64 `json:"last_submit_ts" db:"last_submit_ts"`
|
||||
APIKey uuid.UUID `json:"api_key" db:"api_key"`
|
||||
LastSubmitTS int64 `json:"last_submit_ts" db:"last_submit_ts"`
|
||||
}
|
||||
|
||||
// Initializes a new ProberRepository
|
||||
|
@ -54,7 +54,7 @@ func (r *ProberRepo) Add(name string) (Prober, error) {
|
|||
if err != nil {
|
||||
return Prober{}, err
|
||||
}
|
||||
return Prober{Name: name, ApiKey: apiKey}, nil
|
||||
return Prober{Name: name, APIKey: apiKey}, nil
|
||||
}
|
||||
|
||||
// Edit an existing prober
|
||||
|
@ -143,7 +143,7 @@ func (r *ProberRepo) Probers(q QueryProbers) ([]Prober, error) {
|
|||
|
||||
for row.Next() {
|
||||
var p Prober
|
||||
err = row.Scan(&p.ID, &p.Name, &p.ApiKey, &p.LastSubmitTs)
|
||||
err = row.Scan(&p.ID, &p.Name, &p.APIKey, &p.LastSubmitTS)
|
||||
if err != nil {
|
||||
return probers, err
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ func (r *ProberRepo) Probers(q QueryProbers) ([]Prober, error) {
|
|||
return probers, nil
|
||||
}
|
||||
|
||||
func (r *ProberRepo) CheckApi(key string) (Prober, error) {
|
||||
func (r *ProberRepo) CheckAPI(key string) (Prober, error) {
|
||||
var p Prober
|
||||
query := `
|
||||
SELECT
|
||||
|
@ -165,6 +165,6 @@ func (r *ProberRepo) CheckApi(key string) (Prober, error) {
|
|||
WHERE
|
||||
api_key = ?
|
||||
LIMIT 1`
|
||||
err := r.db.QueryRow(query, key).Scan(&p.ID, &p.Name, &p.ApiKey, &p.LastSubmitTs)
|
||||
err := r.db.QueryRow(query, key).Scan(&p.ID, &p.Name, &p.APIKey, &p.LastSubmitTS)
|
||||
return p, err
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ func TestProberRepo_CheckApi(t *testing.T) {
|
|||
repo := NewProber()
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
_, err := repo.CheckApi(tt.apiKey)
|
||||
_, err := repo.CheckAPI(tt.apiKey)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("ProberRepo.CheckApi() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
|
@ -143,6 +143,6 @@ func BenchmarkProberRepo_CheckApi(b *testing.B) {
|
|||
}
|
||||
repo := NewProber()
|
||||
for i := 0; i < b.N; i++ {
|
||||
repo.CheckApi("")
|
||||
repo.CheckAPI("")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue