26 lines
437 B
Go
26 lines
437 B
Go
package services
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.gnous.eu/Rick/calendrier/models"
|
|
)
|
|
|
|
func CreateUser(c *models.User) error {
|
|
ctx := context.Background()
|
|
db := get()
|
|
|
|
_, err := db.NewInsert().Model(c).Exec(ctx)
|
|
|
|
return err
|
|
}
|
|
|
|
func GetUserByName(n string) (models.User, error) {
|
|
var res models.User
|
|
ctx := context.Background()
|
|
db := get()
|
|
|
|
err := db.NewSelect().Table("c_user").Where("name = ?", n).Scan(ctx, &res)
|
|
|
|
return res, err
|
|
}
|