compnay select
This commit is contained in:
25
app/lib/dbsrv/dbsrv.go
Normal file
25
app/lib/dbsrv/dbsrv.go
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user