compnay select

This commit is contained in:
ctengiz
2024-03-25 23:09:30 +03:00
parent 18ff9ddbfd
commit 888d0800bb
18 changed files with 315 additions and 280 deletions

25
app/lib/dbsrv/dbsrv.go Normal file
View File

@@ -0,0 +1,25 @@
package dbsrv
import (
"bordrobot/lib/company"
"bordrobot/lib/db"
)
type Srv struct{}
func (ds *Srv) Companies() ([]company.Company, error) {
var res []company.Company
err := db.DB.Select(&res, "SELECT * FROM company order by 1")
return res, err
}
func (ds *Srv) CreateCompany(name, memberNumber, username, password string) error {
c := &company.Company{
Name: name,
MemberNumber: memberNumber,
Username: username,
Password: password,
}
return c.Create()
}