package bd import ( "context" "fmt" "git.ukamnya.ru/stulyaganov/RestApi/internal/bd/model" ) type Userrepo struct { db Bd } func (u *Userrepo) Create(user *model.User) (*model.User, error) { err := u.db.db.QueryRow(context.Background(), "INSERT INTO users (id, login, email, password, avatar_url, token, permissionLVL) VALUES($1, $2, $3, $4, $5, $6, $7)"). Scan(user.Id, user.Login, user.Email, user.Password, user.Avatar_Url, user.Token, user.PermisionLVL) if err != nil { return nil, err } return user, nil } func (u *Userrepo) FindById(id string) (*model.User, error) { var user model.User query := fmt.Sprintf("SELECT * FROM users WHERE Id = %s;", id) err := u.db.db.QueryRow(context.Background(), query). Scan(user.Id, user.Login, user.Email, user.Password, user.Avatar_Url, user.Token, user.PermisionLVL) if err != nil { return nil, err } return &user, nil } func (u *Userrepo) FindByAll() (*model.User, error) { return nil, nil }