date type
This commit is contained in:
parent
6928e2432c
commit
2c298bef33
3 changed files with 36 additions and 32 deletions
|
@ -7,9 +7,9 @@ package database
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/jackc/pgx/v5/pgtype"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const addCall = `-- name: AddCall :one
|
const addCall = `-- name: AddCall :one
|
||||||
|
@ -33,19 +33,19 @@ RETURNING id, submitter, system, talkgroup, call_date, audio_name, audio_blob, a
|
||||||
`
|
`
|
||||||
|
|
||||||
type AddCallParams struct {
|
type AddCallParams struct {
|
||||||
Submitter *int32 `json:"submitter"`
|
Submitter *int32 `json:"submitter"`
|
||||||
System int `json:"system"`
|
System int `json:"system"`
|
||||||
Talkgroup int `json:"talkgroup"`
|
Talkgroup int `json:"talkgroup"`
|
||||||
CallDate pgtype.Timestamp `json:"call_date"`
|
CallDate time.Time `json:"call_date"`
|
||||||
AudioName *string `json:"audio_name"`
|
AudioName *string `json:"audio_name"`
|
||||||
AudioBlob []byte `json:"audio_blob"`
|
AudioBlob []byte `json:"audio_blob"`
|
||||||
AudioType *string `json:"audio_type"`
|
AudioType *string `json:"audio_type"`
|
||||||
AudioUrl *string `json:"audio_url"`
|
AudioUrl *string `json:"audio_url"`
|
||||||
Frequency *int32 `json:"frequency"`
|
Frequency *int32 `json:"frequency"`
|
||||||
Frequencies []byte `json:"frequencies"`
|
Frequencies []byte `json:"frequencies"`
|
||||||
Patches []byte `json:"patches"`
|
Patches []byte `json:"patches"`
|
||||||
TgLabel *string `json:"tg_label"`
|
TgLabel *string `json:"tg_label"`
|
||||||
Source *string `json:"source"`
|
Source *string `json:"source"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (Call, error) {
|
func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (Call, error) {
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
package database
|
package database
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/jackc/pgx/v5/pgtype"
|
"github.com/jackc/pgx/v5/pgtype"
|
||||||
)
|
)
|
||||||
|
@ -12,28 +14,28 @@ import (
|
||||||
type ApiKey struct {
|
type ApiKey struct {
|
||||||
ID int32 `json:"id"`
|
ID int32 `json:"id"`
|
||||||
Owner *int32 `json:"owner"`
|
Owner *int32 `json:"owner"`
|
||||||
CreatedAt pgtype.Timestamp `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
Expires pgtype.Timestamp `json:"expires"`
|
Expires pgtype.Timestamp `json:"expires"`
|
||||||
Disabled *bool `json:"disabled"`
|
Disabled *bool `json:"disabled"`
|
||||||
ApiKey uuid.UUID `json:"api_key"`
|
ApiKey uuid.UUID `json:"api_key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Call struct {
|
type Call struct {
|
||||||
ID uuid.UUID `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
Submitter *int32 `json:"submitter"`
|
Submitter *int32 `json:"submitter"`
|
||||||
System int `json:"system"`
|
System int `json:"system"`
|
||||||
Talkgroup int `json:"talkgroup"`
|
Talkgroup int `json:"talkgroup"`
|
||||||
CallDate pgtype.Timestamp `json:"call_date"`
|
CallDate time.Time `json:"call_date"`
|
||||||
AudioName *string `json:"audio_name"`
|
AudioName *string `json:"audio_name"`
|
||||||
AudioBlob []byte `json:"audio_blob"`
|
AudioBlob []byte `json:"audio_blob"`
|
||||||
AudioType *string `json:"audio_type"`
|
AudioType *string `json:"audio_type"`
|
||||||
AudioUrl *string `json:"audio_url"`
|
AudioUrl *string `json:"audio_url"`
|
||||||
Frequency *int32 `json:"frequency"`
|
Frequency *int32 `json:"frequency"`
|
||||||
Frequencies []byte `json:"frequencies"`
|
Frequencies []byte `json:"frequencies"`
|
||||||
Patches []byte `json:"patches"`
|
Patches []byte `json:"patches"`
|
||||||
TgLabel *string `json:"tg_label"`
|
TgLabel *string `json:"tg_label"`
|
||||||
Source *string `json:"source"`
|
Source *string `json:"source"`
|
||||||
Transcript *string `json:"transcript"`
|
Transcript *string `json:"transcript"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Incident struct {
|
type Incident struct {
|
||||||
|
|
|
@ -20,5 +20,7 @@ sql:
|
||||||
go_type: "int"
|
go_type: "int"
|
||||||
- db_type: "pg_catalog.serial4"
|
- db_type: "pg_catalog.serial4"
|
||||||
go_type: "int"
|
go_type: "int"
|
||||||
|
- db_type: "int"
|
||||||
|
go_type: "int"
|
||||||
|
- db_type: "pg_catalog.timestamp"
|
||||||
|
go_type: "time.Time"
|
||||||
|
|
Loading…
Reference in a new issue