2024-02-22 10:43:39 +07:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"git.nochill.in/nochill/excel_import_playground/model"
|
|
|
|
"github.com/jackc/pgx/v5"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (q *Queries) CreateKeluarga(ctx context.Context, arg model.Keluarga) (model.Keluarga, error) {
|
|
|
|
createKeluargaQuery := `
|
|
|
|
INSERT INTO "Keluarga"(
|
|
|
|
pasien_id,
|
|
|
|
nama,
|
|
|
|
hubungan,
|
|
|
|
no_identitas,
|
|
|
|
no_hp,
|
|
|
|
kota_lahir,
|
|
|
|
alamat,
|
|
|
|
tanggal_lahir,
|
|
|
|
jenis_kelamin,
|
|
|
|
pendidikan,
|
|
|
|
pekerjaan,
|
2024-02-23 14:10:40 +07:00
|
|
|
email
|
2024-02-22 10:43:39 +07:00
|
|
|
) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
|
|
|
|
`
|
|
|
|
|
|
|
|
row, _ := q.db.Query(ctx, createKeluargaQuery,
|
|
|
|
arg.PasienId,
|
|
|
|
arg.Nama,
|
|
|
|
arg.Hubungan,
|
|
|
|
arg.NoIdentitas,
|
|
|
|
arg.NoHp,
|
|
|
|
arg.KotaLahir,
|
|
|
|
arg.Alamat,
|
|
|
|
arg.TanggalLahir,
|
|
|
|
arg.JenisKelamin,
|
|
|
|
arg.Pendidikan,
|
|
|
|
arg.Pekerjaan,
|
|
|
|
arg.Email,
|
|
|
|
)
|
|
|
|
|
|
|
|
result, err := pgx.CollectExactlyOneRow[model.Keluarga](row, pgx.RowToStructByName[model.Keluarga])
|
|
|
|
|
|
|
|
return result, err
|
|
|
|
}
|