47 lines
881 B
Go
47 lines
881 B
Go
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,
|
|
email,
|
|
) 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
|
|
}
|