auto logout
This commit is contained in:
34
services/staff/staff.stores.go
Normal file
34
services/staff/staff.stores.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package staff
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"sismedika.com/sas/westone/types"
|
||||
)
|
||||
|
||||
type Store struct {
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
func NewStore(db *sqlx.DB) *Store {
|
||||
return &Store{db: db}
|
||||
}
|
||||
func (s *Store) GetStaff(name string) (*types.Staff, error) {
|
||||
term := new(types.Staff)
|
||||
|
||||
Keyword := "%" + name + "%"
|
||||
qry := `SELECT
|
||||
M_StaffID,
|
||||
M_StaffName,
|
||||
M_StaffEmail,
|
||||
M_StaffNakesID,
|
||||
M_StaffIsActive
|
||||
FROM m_staff
|
||||
WHERE (M_StaffName LIKE ? OR M_StaffEmail LIKE ? )
|
||||
AND M_StaffIsActive = 'Y'
|
||||
`
|
||||
if err := s.db.Get(term, qry, Keyword, Keyword); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return term, nil
|
||||
}
|
||||
Reference in New Issue
Block a user