calendrier/services/user.go
2024-02-24 16:01:08 +01:00

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
}