updates on the api endpoints on the customer page and more
This commit is contained in:
38
scratch/check_phone.go
Normal file
38
scratch/check_phone.go
Normal file
@@ -0,0 +1,38 @@
|
||||
//go:build ignore
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"doormile/config"
|
||||
"doormile/db"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
_ = godotenv.Load()
|
||||
cfg := config.Load()
|
||||
db.Connect(cfg)
|
||||
if db.DB == nil {
|
||||
log.Fatal("no DB")
|
||||
}
|
||||
type c struct {
|
||||
Appcustomerid int
|
||||
Firstname string
|
||||
Phone string
|
||||
Configid int
|
||||
Status string
|
||||
}
|
||||
var rows []c
|
||||
db.DB.Raw(`SELECT appcustomerid,firstname,phone,configid,status FROM appcustomers
|
||||
WHERE phone IN ('9876543210') OR appcustomerid = 5`).Scan(&rows)
|
||||
if len(rows) == 0 {
|
||||
fmt.Println("no appcustomer with phone 9876543210, and no id 5")
|
||||
}
|
||||
for _, r := range rows {
|
||||
fmt.Printf(" id=%d name=%q phone=%s configid=%d status=%s\n",
|
||||
r.Appcustomerid, r.Firstname, r.Phone, r.Configid, r.Status)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user