From 0ea7ce22c9aa2b5d7077b8803b4f737c5b4a2536 Mon Sep 17 00:00:00 2001 From: windyboy Date: Wed, 31 Jul 2024 12:25:21 +0800 Subject: [PATCH] refactor: Update parsing of flight schedule data for improved accuracy and functionality --- go.mod | 10 +- internal/domain/pln.go | 28 +- internal/parsers/schedule_parser.go | 17 +- internal/repository/generated.go | 16 +- internal/repository/hasura.go | 2 +- internal/repository/schema.graphql | 875 ++++++++++++++++------------ 6 files changed, 521 insertions(+), 427 deletions(-) diff --git a/go.mod b/go.mod index d54f3b1..90b4b93 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/google/uuid v1.6.0 github.com/nats-io/nats.go v1.36.0 github.com/onsi/ginkgo/v2 v2.19.1 - github.com/onsi/gomega v1.34.0 + github.com/onsi/gomega v1.34.1 github.com/spf13/viper v1.19.0 go.uber.org/zap v1.27.0 golang.org/x/oauth2 v0.21.0 @@ -17,11 +17,14 @@ require ( ) require ( + github.com/agnivade/levenshtein v1.1.1 // indirect + github.com/alexflint/go-arg v1.4.2 // indirect + github.com/alexflint/go-scalar v1.0.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect + github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/lithammer/shortuuid/v3 v3.0.7 // indirect @@ -43,10 +46,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/mod v0.19.0 // indirect golang.org/x/net v0.27.0 // indirect + golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/tools v0.23.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/internal/domain/pln.go b/internal/domain/pln.go index a4a88ee..3bb2de2 100644 --- a/internal/domain/pln.go +++ b/internal/domain/pln.go @@ -2,7 +2,7 @@ package domain import "fmt" -type FlightSchedule struct { +type ScheduleLine struct { Index string `json:"index,omitempty"` // Date of the flight schedule. @@ -15,7 +15,7 @@ type FlightSchedule struct { // Flight number of the flight schedule. This is a unique identifier for the flight. // Example: "CA1014" - FlightNumber string `json:"flight_number"` + FlightNumber []string `json:"flight_number"` // Aircraft registration number. This is a unique identifier for the aircraft used for the flight. // Example: "B2458" @@ -29,26 +29,6 @@ type FlightSchedule struct { // Example: "ILS(0)" ILS string `json:"ils,omitempty"` - // // ICAO code for the departure airport. - // // Example: "ZBTJ" - // DepartureAirport string `json:"departure_airport"` - - // // Scheduled departure time of the flight. This field may be formatted as HHMM or include date information. - // // Example: "1845" - // DepartureTime string `json:"departure_time,omitempty"` - - // // Additional schedule information. This field may include special instructions or additional scheduling details. - // // Example: "SI:TSN1845" - // ScheduleInfo string `json:"schedule_info,omitempty"` - - // // Estimated or scheduled arrival time of the flight. This field may be formatted as HHMM or include date information. - // // Example: "2100" - // ArrivalTime string `json:"arrival_time,omitempty"` - - // // ICAO code for the arrival airport. - // // Example: "ZSPD" - // ArrivalAirport string `json:"arrival_airport"` - Waypoints []WayPoint `json:"waypoints"` // Additional comments or remarks about the flight schedule. This field may include any relevant notes or observations. @@ -65,11 +45,11 @@ type WayPoint struct { DepartureTime string } -func (f *FlightSchedule) Validate() error { +func (f *ScheduleLine) Validate() error { if f.Date == "" { return fmt.Errorf("date is required") } - if f.FlightNumber == "" { + if len(f.FlightNumber) == 0 { return fmt.Errorf("flight number is required") } if f.AircraftReg == "" { diff --git a/internal/parsers/schedule_parser.go b/internal/parsers/schedule_parser.go index 427ff3e..a6a2ebd 100644 --- a/internal/parsers/schedule_parser.go +++ b/internal/parsers/schedule_parser.go @@ -11,12 +11,12 @@ const ( AirportCode = "airport" Date = "date" Task = "task" - IndexPattern = `(?P\(?L?[0-9]+\)?\.?)` - DatePattern = `\s?(?P\d{2}\w{3})` - TaskPattern = `\s?(?P[A-Z]\/[A-Z])` + IndexPattern = `^(?P\(?L?[0-9]+\)?\.?)$` + DatePattern = `^(?P\d{2}\w{3})$` + TaskPattern = `^(?P[A-Z]\/[A-Z])$` WaypointPattern = `^(SI:)?(?P\d{4}(\(\d{2}[A-Z]{3}\))?)?\/?(?P[A-Z]{3})\/?(?P\d{4}(\(\d{2}[A-Z]{3}\))?)?$` - FlightNumberPattern = `\s?(?P[0-9A-Z][0-9A-Z]\d{3,5})` - RegisterPattern = `\s?(?PB\d{4})` + FlightNumberPattern = `^(?P[0-9A-Z][0-9A-Z]\d{3,5})$` + RegisterPattern = `^(?PB\d{4})$` ) var ( @@ -57,11 +57,11 @@ func ExtractWaypoint(message string) *domain.WayPoint { return result } -func ParseLine(line string) *domain.FlightSchedule { +func ParseLine(line string) *domain.ScheduleLine { log := utils.GetSugaredLogger() cleanLine := strings.TrimSpace(line) words := strings.Split(cleanLine, " ") - var flightSchedule = &domain.FlightSchedule{ + var flightSchedule = &domain.ScheduleLine{ Reference: line, } var data map[string]string @@ -104,7 +104,8 @@ func ParseLine(line string) *domain.FlightSchedule { parsed[Date] = true maxParsed = i case FlightNumber: - flightSchedule.FlightNumber = data[FlightNumber] + //TODO: Handle multiple flight numbers + flightSchedule.FlightNumber = append(flightSchedule.FlightNumber, data[FlightNumber]) parsed[FlightNumber] = true maxParsed = i case Register: diff --git a/internal/repository/generated.go b/internal/repository/generated.go index 2a63040..a184737 100644 --- a/internal/repository/generated.go +++ b/internal/repository/generated.go @@ -14,40 +14,31 @@ import ( // input type for inserting data into table "aviation.telegrams" type Aviation_telegrams_insert_input struct { Text string `json:"Text"` - Body_and_footer string `json:"body_and_footer"` Body_data json.RawMessage `json:"body_data"` Category string `json:"category"` - Comments string `json:"comments"` Date_time string `json:"date_time"` Dispatched_at time.Time `json:"dispatched_at"` Message_id string `json:"message_id"` Need_dispatch bool `json:"need_dispatch"` Originator string `json:"originator"` Originator_date_time string `json:"originator_date_time"` - Parsed bool `json:"parsed"` Parsed_at time.Time `json:"parsed_at"` Primary_address string `json:"primary_address"` Priority_indicator string `json:"priority_indicator"` Received_at time.Time `json:"received_at"` - Secondary_addresses json.RawMessage `json:"secondary_addresses"` + Secondary_addresses string `json:"secondary_addresses"` Uuid uuid.UUID `json:"uuid"` } // GetText returns Aviation_telegrams_insert_input.Text, and is useful for accessing the field via an interface. func (v *Aviation_telegrams_insert_input) GetText() string { return v.Text } -// GetBody_and_footer returns Aviation_telegrams_insert_input.Body_and_footer, and is useful for accessing the field via an interface. -func (v *Aviation_telegrams_insert_input) GetBody_and_footer() string { return v.Body_and_footer } - // GetBody_data returns Aviation_telegrams_insert_input.Body_data, and is useful for accessing the field via an interface. func (v *Aviation_telegrams_insert_input) GetBody_data() json.RawMessage { return v.Body_data } // GetCategory returns Aviation_telegrams_insert_input.Category, and is useful for accessing the field via an interface. func (v *Aviation_telegrams_insert_input) GetCategory() string { return v.Category } -// GetComments returns Aviation_telegrams_insert_input.Comments, and is useful for accessing the field via an interface. -func (v *Aviation_telegrams_insert_input) GetComments() string { return v.Comments } - // GetDate_time returns Aviation_telegrams_insert_input.Date_time, and is useful for accessing the field via an interface. func (v *Aviation_telegrams_insert_input) GetDate_time() string { return v.Date_time } @@ -68,9 +59,6 @@ func (v *Aviation_telegrams_insert_input) GetOriginator_date_time() string { return v.Originator_date_time } -// GetParsed returns Aviation_telegrams_insert_input.Parsed, and is useful for accessing the field via an interface. -func (v *Aviation_telegrams_insert_input) GetParsed() bool { return v.Parsed } - // GetParsed_at returns Aviation_telegrams_insert_input.Parsed_at, and is useful for accessing the field via an interface. func (v *Aviation_telegrams_insert_input) GetParsed_at() time.Time { return v.Parsed_at } @@ -84,7 +72,7 @@ func (v *Aviation_telegrams_insert_input) GetPriority_indicator() string { retur func (v *Aviation_telegrams_insert_input) GetReceived_at() time.Time { return v.Received_at } // GetSecondary_addresses returns Aviation_telegrams_insert_input.Secondary_addresses, and is useful for accessing the field via an interface. -func (v *Aviation_telegrams_insert_input) GetSecondary_addresses() json.RawMessage { +func (v *Aviation_telegrams_insert_input) GetSecondary_addresses() string { return v.Secondary_addresses } diff --git a/internal/repository/hasura.go b/internal/repository/hasura.go index f419846..9518c0d 100644 --- a/internal/repository/hasura.go +++ b/internal/repository/hasura.go @@ -37,7 +37,7 @@ func (hr *HasuraRepository) CreateNew(pm *domain.ParsedMessage) error { Message_id: pm.MessageID, Priority_indicator: pm.PriorityIndicator, Primary_address: pm.PrimaryAddress, - Secondary_addresses: []byte(secondAddress), + Secondary_addresses: string(secondAddress), Text: pm.Text, Body_data: bodyString, Category: pm.Category, diff --git a/internal/repository/schema.graphql b/internal/repository/schema.graphql index 5c05b4d..4a56af6 100644 --- a/internal/repository/schema.graphql +++ b/internal/repository/schema.graphql @@ -28,21 +28,6 @@ input Boolean_comparison_exp { _nin: [Boolean!] } -""" -Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'. -""" -input Int_comparison_exp { - _eq: Int - _gt: Int - _gte: Int - _in: [Int!] - _is_null: Boolean - _lt: Int - _lte: Int - _neq: Int - _nin: [Int!] -} - """ Boolean expression to compare columns of type "String". All fields are combined with logical 'AND'. """ @@ -100,29 +85,23 @@ input String_comparison_exp { columns and relationships of "aviation.telegrams" """ type aviation_telegrams { - Text: String! - body_and_footer: String + Text: String body_data( """JSON select path""" path: String ): jsonb category: String - comments: String date_time: String dispatched_at: timestamp - message_id: String! + message_id: String need_dispatch: Boolean originator: String originator_date_time: String - parsed: Boolean! parsed_at: timestamp primary_address: String priority_indicator: String received_at: timestamp! - secondary_addresses( - """JSON select path""" - path: String - ): jsonb + secondary_addresses: String uuid: uuid! } @@ -146,7 +125,6 @@ type aviation_telegrams_aggregate_fields { """append existing jsonb value of filtered columns with new jsonb value""" input aviation_telegrams_append_input { body_data: jsonb - secondary_addresses: jsonb } """ @@ -157,22 +135,19 @@ input aviation_telegrams_bool_exp { _and: [aviation_telegrams_bool_exp!] _not: aviation_telegrams_bool_exp _or: [aviation_telegrams_bool_exp!] - body_and_footer: String_comparison_exp body_data: jsonb_comparison_exp category: String_comparison_exp - comments: String_comparison_exp date_time: String_comparison_exp dispatched_at: timestamp_comparison_exp message_id: String_comparison_exp need_dispatch: Boolean_comparison_exp originator: String_comparison_exp originator_date_time: String_comparison_exp - parsed: Boolean_comparison_exp parsed_at: timestamp_comparison_exp primary_address: String_comparison_exp priority_indicator: String_comparison_exp received_at: timestamp_comparison_exp - secondary_addresses: jsonb_comparison_exp + secondary_addresses: String_comparison_exp uuid: uuid_comparison_exp } @@ -184,11 +159,6 @@ enum aviation_telegrams_constraint { unique or primary key constraint on columns "uuid" """ telegrams_pkey - - """ - unique or primary key constraint on columns "uuid" - """ - telegrams_uuid_key } """ @@ -196,7 +166,6 @@ delete the field or element with specified path (for JSON arrays, negative integ """ input aviation_telegrams_delete_at_path_input { body_data: [String!] - secondary_addresses: [String!] } """ @@ -204,7 +173,6 @@ delete the array element with specified index (negative integers count from the """ input aviation_telegrams_delete_elem_input { body_data: Int - secondary_addresses: Int } """ @@ -212,7 +180,6 @@ delete key/value pair or string element. key/value pairs are matched based on th """ input aviation_telegrams_delete_key_input { body_data: String - secondary_addresses: String } """ @@ -220,31 +187,26 @@ input type for inserting data into table "aviation.telegrams" """ input aviation_telegrams_insert_input { Text: String - body_and_footer: String body_data: jsonb category: String - comments: String date_time: String dispatched_at: timestamp message_id: String need_dispatch: Boolean originator: String originator_date_time: String - parsed: Boolean parsed_at: timestamp primary_address: String priority_indicator: String received_at: timestamp - secondary_addresses: jsonb + secondary_addresses: String uuid: uuid } """aggregate max on columns""" type aviation_telegrams_max_fields { Text: String - body_and_footer: String category: String - comments: String date_time: String dispatched_at: timestamp message_id: String @@ -254,15 +216,14 @@ type aviation_telegrams_max_fields { primary_address: String priority_indicator: String received_at: timestamp + secondary_addresses: String uuid: uuid } """aggregate min on columns""" type aviation_telegrams_min_fields { Text: String - body_and_footer: String category: String - comments: String date_time: String dispatched_at: timestamp message_id: String @@ -272,6 +233,7 @@ type aviation_telegrams_min_fields { primary_address: String priority_indicator: String received_at: timestamp + secondary_addresses: String uuid: uuid } @@ -298,17 +260,14 @@ input aviation_telegrams_on_conflict { """Ordering options when selecting data from "aviation.telegrams".""" input aviation_telegrams_order_by { Text: order_by - body_and_footer: order_by body_data: order_by category: order_by - comments: order_by date_time: order_by dispatched_at: order_by message_id: order_by need_dispatch: order_by originator: order_by originator_date_time: order_by - parsed: order_by parsed_at: order_by primary_address: order_by priority_indicator: order_by @@ -325,7 +284,6 @@ input aviation_telegrams_pk_columns_input { """prepend existing jsonb value of filtered columns with new jsonb value""" input aviation_telegrams_prepend_input { body_data: jsonb - secondary_addresses: jsonb } """ @@ -335,18 +293,12 @@ enum aviation_telegrams_select_column { """column name""" Text - """column name""" - body_and_footer - """column name""" body_data """column name""" category - """column name""" - comments - """column name""" date_time @@ -365,9 +317,6 @@ enum aviation_telegrams_select_column { """column name""" originator_date_time - """column name""" - parsed - """column name""" parsed_at @@ -392,22 +341,19 @@ input type for updating data in table "aviation.telegrams" """ input aviation_telegrams_set_input { Text: String - body_and_footer: String body_data: jsonb category: String - comments: String date_time: String dispatched_at: timestamp message_id: String need_dispatch: Boolean originator: String originator_date_time: String - parsed: Boolean parsed_at: timestamp primary_address: String priority_indicator: String received_at: timestamp - secondary_addresses: jsonb + secondary_addresses: String uuid: uuid } @@ -425,22 +371,19 @@ input aviation_telegrams_stream_cursor_input { """Initial value of the column from where the streaming should start""" input aviation_telegrams_stream_cursor_value_input { Text: String - body_and_footer: String body_data: jsonb category: String - comments: String date_time: String dispatched_at: timestamp message_id: String need_dispatch: Boolean originator: String originator_date_time: String - parsed: Boolean parsed_at: timestamp primary_address: String priority_indicator: String received_at: timestamp - secondary_addresses: jsonb + secondary_addresses: String uuid: uuid } @@ -451,18 +394,12 @@ enum aviation_telegrams_update_column { """column name""" Text - """column name""" - body_and_footer - """column name""" body_data """column name""" category - """column name""" - comments - """column name""" date_time @@ -481,9 +418,6 @@ enum aviation_telegrams_update_column { """column name""" originator_date_time - """column name""" - parsed - """column name""" parsed_at @@ -532,242 +466,6 @@ input aviation_telegrams_updates { where: aviation_telegrams_bool_exp! } -"""user for test simple graphql""" -type aviation_user { - email: String! - id: Int! - name: String! - update_at: timestamptz -} - -""" -aggregated selection of "aviation.user" -""" -type aviation_user_aggregate { - aggregate: aviation_user_aggregate_fields - nodes: [aviation_user!]! -} - -""" -aggregate fields of "aviation.user" -""" -type aviation_user_aggregate_fields { - avg: aviation_user_avg_fields - count(columns: [aviation_user_select_column!], distinct: Boolean): Int! - max: aviation_user_max_fields - min: aviation_user_min_fields - stddev: aviation_user_stddev_fields - stddev_pop: aviation_user_stddev_pop_fields - stddev_samp: aviation_user_stddev_samp_fields - sum: aviation_user_sum_fields - var_pop: aviation_user_var_pop_fields - var_samp: aviation_user_var_samp_fields - variance: aviation_user_variance_fields -} - -"""aggregate avg on columns""" -type aviation_user_avg_fields { - id: Float -} - -""" -Boolean expression to filter rows from the table "aviation.user". All fields are combined with a logical 'AND'. -""" -input aviation_user_bool_exp { - _and: [aviation_user_bool_exp!] - _not: aviation_user_bool_exp - _or: [aviation_user_bool_exp!] - email: String_comparison_exp - id: Int_comparison_exp - name: String_comparison_exp - update_at: timestamptz_comparison_exp -} - -""" -unique or primary key constraints on table "aviation.user" -""" -enum aviation_user_constraint { - """ - unique or primary key constraint on columns "id" - """ - user_pkey -} - -""" -input type for incrementing numeric columns in table "aviation.user" -""" -input aviation_user_inc_input { - id: Int -} - -""" -input type for inserting data into table "aviation.user" -""" -input aviation_user_insert_input { - email: String - id: Int - name: String - update_at: timestamptz -} - -"""aggregate max on columns""" -type aviation_user_max_fields { - email: String - id: Int - name: String - update_at: timestamptz -} - -"""aggregate min on columns""" -type aviation_user_min_fields { - email: String - id: Int - name: String - update_at: timestamptz -} - -""" -response of any mutation on the table "aviation.user" -""" -type aviation_user_mutation_response { - """number of rows affected by the mutation""" - affected_rows: Int! - - """data from the rows affected by the mutation""" - returning: [aviation_user!]! -} - -""" -on_conflict condition type for table "aviation.user" -""" -input aviation_user_on_conflict { - constraint: aviation_user_constraint! - update_columns: [aviation_user_update_column!]! = [] - where: aviation_user_bool_exp -} - -"""Ordering options when selecting data from "aviation.user".""" -input aviation_user_order_by { - email: order_by - id: order_by - name: order_by - update_at: order_by -} - -"""primary key columns input for table: aviation.user""" -input aviation_user_pk_columns_input { - id: Int! -} - -""" -select columns of table "aviation.user" -""" -enum aviation_user_select_column { - """column name""" - email - - """column name""" - id - - """column name""" - name - - """column name""" - update_at -} - -""" -input type for updating data in table "aviation.user" -""" -input aviation_user_set_input { - email: String - id: Int - name: String - update_at: timestamptz -} - -"""aggregate stddev on columns""" -type aviation_user_stddev_fields { - id: Float -} - -"""aggregate stddev_pop on columns""" -type aviation_user_stddev_pop_fields { - id: Float -} - -"""aggregate stddev_samp on columns""" -type aviation_user_stddev_samp_fields { - id: Float -} - -""" -Streaming cursor of the table "aviation_user" -""" -input aviation_user_stream_cursor_input { - """Stream column input with initial value""" - initial_value: aviation_user_stream_cursor_value_input! - - """cursor ordering""" - ordering: cursor_ordering -} - -"""Initial value of the column from where the streaming should start""" -input aviation_user_stream_cursor_value_input { - email: String - id: Int - name: String - update_at: timestamptz -} - -"""aggregate sum on columns""" -type aviation_user_sum_fields { - id: Int -} - -""" -update columns of table "aviation.user" -""" -enum aviation_user_update_column { - """column name""" - email - - """column name""" - id - - """column name""" - name - - """column name""" - update_at -} - -input aviation_user_updates { - """increments the numeric columns with given value of the filtered values""" - _inc: aviation_user_inc_input - - """sets the columns of the filtered rows to the given values""" - _set: aviation_user_set_input - - """filter the rows which have to be updated""" - where: aviation_user_bool_exp! -} - -"""aggregate var_pop on columns""" -type aviation_user_var_pop_fields { - id: Float -} - -"""aggregate var_samp on columns""" -type aviation_user_var_samp_fields { - id: Float -} - -"""aggregate variance on columns""" -type aviation_user_variance_fields { - id: Float -} - """ordering argument of a cursor""" enum cursor_ordering { """ascending ordering of the cursor""" @@ -814,6 +512,391 @@ input jsonb_comparison_exp { _nin: [jsonb!] } +""" +columns and relationships of "messages" +""" +type messages { + body_and_footer: String + body_data( + """JSON select path""" + path: String + ): jsonb + category: String + date_time: String + dispatched_at: timestamptz + id: uuid! + message_id: String! + need_dispatch: Boolean + originator: String + originator_date_time: String + parsed_at: timestamptz + primary_address: String + priority_indicator: String + received_at: timestamptz + secondary_addresses: String +} + +""" +aggregated selection of "messages" +""" +type messages_aggregate { + aggregate: messages_aggregate_fields + nodes: [messages!]! +} + +""" +aggregate fields of "messages" +""" +type messages_aggregate_fields { + count(columns: [messages_select_column!], distinct: Boolean): Int! + max: messages_max_fields + min: messages_min_fields +} + +"""append existing jsonb value of filtered columns with new jsonb value""" +input messages_append_input { + body_data: jsonb +} + +""" +Boolean expression to filter rows from the table "messages". All fields are combined with a logical 'AND'. +""" +input messages_bool_exp { + _and: [messages_bool_exp!] + _not: messages_bool_exp + _or: [messages_bool_exp!] + body_and_footer: String_comparison_exp + body_data: jsonb_comparison_exp + category: String_comparison_exp + date_time: String_comparison_exp + dispatched_at: timestamptz_comparison_exp + id: uuid_comparison_exp + message_id: String_comparison_exp + need_dispatch: Boolean_comparison_exp + originator: String_comparison_exp + originator_date_time: String_comparison_exp + parsed_at: timestamptz_comparison_exp + primary_address: String_comparison_exp + priority_indicator: String_comparison_exp + received_at: timestamptz_comparison_exp + secondary_addresses: String_comparison_exp +} + +""" +unique or primary key constraints on table "messages" +""" +enum messages_constraint { + """ + unique or primary key constraint on columns "id" + """ + parsed_messages_pkey +} + +""" +delete the field or element with specified path (for JSON arrays, negative integers count from the end) +""" +input messages_delete_at_path_input { + body_data: [String!] +} + +""" +delete the array element with specified index (negative integers count from the end). throws an error if top level container is not an array +""" +input messages_delete_elem_input { + body_data: Int +} + +""" +delete key/value pair or string element. key/value pairs are matched based on their key value +""" +input messages_delete_key_input { + body_data: String +} + +""" +input type for inserting data into table "messages" +""" +input messages_insert_input { + body_and_footer: String + body_data: jsonb + category: String + date_time: String + dispatched_at: timestamptz + id: uuid + message_id: String + need_dispatch: Boolean + originator: String + originator_date_time: String + parsed_at: timestamptz + primary_address: String + priority_indicator: String + received_at: timestamptz + secondary_addresses: String +} + +"""aggregate max on columns""" +type messages_max_fields { + body_and_footer: String + category: String + date_time: String + dispatched_at: timestamptz + id: uuid + message_id: String + originator: String + originator_date_time: String + parsed_at: timestamptz + primary_address: String + priority_indicator: String + received_at: timestamptz + secondary_addresses: String +} + +"""aggregate min on columns""" +type messages_min_fields { + body_and_footer: String + category: String + date_time: String + dispatched_at: timestamptz + id: uuid + message_id: String + originator: String + originator_date_time: String + parsed_at: timestamptz + primary_address: String + priority_indicator: String + received_at: timestamptz + secondary_addresses: String +} + +""" +response of any mutation on the table "messages" +""" +type messages_mutation_response { + """number of rows affected by the mutation""" + affected_rows: Int! + + """data from the rows affected by the mutation""" + returning: [messages!]! +} + +""" +on_conflict condition type for table "messages" +""" +input messages_on_conflict { + constraint: messages_constraint! + update_columns: [messages_update_column!]! = [] + where: messages_bool_exp +} + +"""Ordering options when selecting data from "messages".""" +input messages_order_by { + body_and_footer: order_by + body_data: order_by + category: order_by + date_time: order_by + dispatched_at: order_by + id: order_by + message_id: order_by + need_dispatch: order_by + originator: order_by + originator_date_time: order_by + parsed_at: order_by + primary_address: order_by + priority_indicator: order_by + received_at: order_by + secondary_addresses: order_by +} + +"""primary key columns input for table: messages""" +input messages_pk_columns_input { + id: uuid! +} + +"""prepend existing jsonb value of filtered columns with new jsonb value""" +input messages_prepend_input { + body_data: jsonb +} + +""" +select columns of table "messages" +""" +enum messages_select_column { + """column name""" + body_and_footer + + """column name""" + body_data + + """column name""" + category + + """column name""" + date_time + + """column name""" + dispatched_at + + """column name""" + id + + """column name""" + message_id + + """column name""" + need_dispatch + + """column name""" + originator + + """column name""" + originator_date_time + + """column name""" + parsed_at + + """column name""" + primary_address + + """column name""" + priority_indicator + + """column name""" + received_at + + """column name""" + secondary_addresses +} + +""" +input type for updating data in table "messages" +""" +input messages_set_input { + body_and_footer: String + body_data: jsonb + category: String + date_time: String + dispatched_at: timestamptz + id: uuid + message_id: String + need_dispatch: Boolean + originator: String + originator_date_time: String + parsed_at: timestamptz + primary_address: String + priority_indicator: String + received_at: timestamptz + secondary_addresses: String +} + +""" +Streaming cursor of the table "messages" +""" +input messages_stream_cursor_input { + """Stream column input with initial value""" + initial_value: messages_stream_cursor_value_input! + + """cursor ordering""" + ordering: cursor_ordering +} + +"""Initial value of the column from where the streaming should start""" +input messages_stream_cursor_value_input { + body_and_footer: String + body_data: jsonb + category: String + date_time: String + dispatched_at: timestamptz + id: uuid + message_id: String + need_dispatch: Boolean + originator: String + originator_date_time: String + parsed_at: timestamptz + primary_address: String + priority_indicator: String + received_at: timestamptz + secondary_addresses: String +} + +""" +update columns of table "messages" +""" +enum messages_update_column { + """column name""" + body_and_footer + + """column name""" + body_data + + """column name""" + category + + """column name""" + date_time + + """column name""" + dispatched_at + + """column name""" + id + + """column name""" + message_id + + """column name""" + need_dispatch + + """column name""" + originator + + """column name""" + originator_date_time + + """column name""" + parsed_at + + """column name""" + primary_address + + """column name""" + priority_indicator + + """column name""" + received_at + + """column name""" + secondary_addresses +} + +input messages_updates { + """append existing jsonb value of filtered columns with new jsonb value""" + _append: messages_append_input + + """ + delete the field or element with specified path (for JSON arrays, negative integers count from the end) + """ + _delete_at_path: messages_delete_at_path_input + + """ + delete the array element with specified index (negative integers count from the end). throws an error if top level container is not an array + """ + _delete_elem: messages_delete_elem_input + + """ + delete key/value pair or string element. key/value pairs are matched based on their key value + """ + _delete_key: messages_delete_key_input + + """prepend existing jsonb value of filtered columns with new jsonb value""" + _prepend: messages_prepend_input + + """sets the columns of the filtered rows to the given values""" + _set: messages_set_input + + """filter the rows which have to be updated""" + where: messages_bool_exp! +} + """mutation root""" type mutation_root { """ @@ -830,17 +913,17 @@ type mutation_root { delete_aviation_telegrams_by_pk(uuid: uuid!): aviation_telegrams """ - delete data from the table: "aviation.user" + delete data from the table: "messages" """ - delete_aviation_user( + delete_messages( """filter the rows which have to be deleted""" - where: aviation_user_bool_exp! - ): aviation_user_mutation_response + where: messages_bool_exp! + ): messages_mutation_response """ - delete single row from the table: "aviation.user" + delete single row from the table: "messages" """ - delete_aviation_user_by_pk(id: Int!): aviation_user + delete_messages_by_pk(id: uuid!): messages """ insert data into the table: "aviation.telegrams" @@ -865,26 +948,26 @@ type mutation_root { ): aviation_telegrams """ - insert data into the table: "aviation.user" + insert data into the table: "messages" """ - insert_aviation_user( + insert_messages( """the rows to be inserted""" - objects: [aviation_user_insert_input!]! + objects: [messages_insert_input!]! """upsert condition""" - on_conflict: aviation_user_on_conflict - ): aviation_user_mutation_response + on_conflict: messages_on_conflict + ): messages_mutation_response """ - insert a single row into the table: "aviation.user" + insert a single row into the table: "messages" """ - insert_aviation_user_one( + insert_messages_one( """the row to be inserted""" - object: aviation_user_insert_input! + object: messages_insert_input! """upsert condition""" - on_conflict: aviation_user_on_conflict - ): aviation_user + on_conflict: messages_on_conflict + ): messages """ update data of the table: "aviation.telegrams" @@ -957,38 +1040,74 @@ type mutation_root { ): [aviation_telegrams_mutation_response] """ - update data of the table: "aviation.user" + update data of the table: "messages" """ - update_aviation_user( - """increments the numeric columns with given value of the filtered values""" - _inc: aviation_user_inc_input + update_messages( + """append existing jsonb value of filtered columns with new jsonb value""" + _append: messages_append_input + + """ + delete the field or element with specified path (for JSON arrays, negative integers count from the end) + """ + _delete_at_path: messages_delete_at_path_input + + """ + delete the array element with specified index (negative integers count from the end). throws an error if top level container is not an array + """ + _delete_elem: messages_delete_elem_input + + """ + delete key/value pair or string element. key/value pairs are matched based on their key value + """ + _delete_key: messages_delete_key_input + + """prepend existing jsonb value of filtered columns with new jsonb value""" + _prepend: messages_prepend_input """sets the columns of the filtered rows to the given values""" - _set: aviation_user_set_input + _set: messages_set_input """filter the rows which have to be updated""" - where: aviation_user_bool_exp! - ): aviation_user_mutation_response + where: messages_bool_exp! + ): messages_mutation_response """ - update single row of the table: "aviation.user" + update single row of the table: "messages" """ - update_aviation_user_by_pk( - """increments the numeric columns with given value of the filtered values""" - _inc: aviation_user_inc_input + update_messages_by_pk( + """append existing jsonb value of filtered columns with new jsonb value""" + _append: messages_append_input + + """ + delete the field or element with specified path (for JSON arrays, negative integers count from the end) + """ + _delete_at_path: messages_delete_at_path_input + + """ + delete the array element with specified index (negative integers count from the end). throws an error if top level container is not an array + """ + _delete_elem: messages_delete_elem_input + + """ + delete key/value pair or string element. key/value pairs are matched based on their key value + """ + _delete_key: messages_delete_key_input + + """prepend existing jsonb value of filtered columns with new jsonb value""" + _prepend: messages_prepend_input """sets the columns of the filtered rows to the given values""" - _set: aviation_user_set_input - pk_columns: aviation_user_pk_columns_input! - ): aviation_user + _set: messages_set_input + pk_columns: messages_pk_columns_input! + ): messages """ - update multiples rows of table: "aviation.user" + update multiples rows of table: "messages" """ - update_aviation_user_many( + update_messages_many( """updates to execute, in order""" - updates: [aviation_user_updates!]! - ): [aviation_user_mutation_response] + updates: [messages_updates!]! + ): [messages_mutation_response] } """column ordering options""" @@ -1059,11 +1178,11 @@ type query_root { aviation_telegrams_by_pk(uuid: uuid!): aviation_telegrams """ - fetch data from the table: "aviation.user" + fetch data from the table: "messages" """ - aviation_user( + messages( """distinct select on columns""" - distinct_on: [aviation_user_select_column!] + distinct_on: [messages_select_column!] """limit the number of rows returned""" limit: Int @@ -1072,18 +1191,18 @@ type query_root { offset: Int """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] + order_by: [messages_order_by!] """filter the rows returned""" - where: aviation_user_bool_exp - ): [aviation_user!]! + where: messages_bool_exp + ): [messages!]! """ - fetch aggregated fields from the table: "aviation.user" + fetch aggregated fields from the table: "messages" """ - aviation_user_aggregate( + messages_aggregate( """distinct select on columns""" - distinct_on: [aviation_user_select_column!] + distinct_on: [messages_select_column!] """limit the number of rows returned""" limit: Int @@ -1092,14 +1211,14 @@ type query_root { offset: Int """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] + order_by: [messages_order_by!] """filter the rows returned""" - where: aviation_user_bool_exp - ): aviation_user_aggregate! + where: messages_bool_exp + ): messages_aggregate! - """fetch data from the table: "aviation.user" using primary key columns""" - aviation_user_by_pk(id: Int!): aviation_user + """fetch data from the table: "messages" using primary key columns""" + messages_by_pk(id: uuid!): messages } type subscription_root { @@ -1163,11 +1282,11 @@ type subscription_root { ): [aviation_telegrams!]! """ - fetch data from the table: "aviation.user" + fetch data from the table: "messages" """ - aviation_user( + messages( """distinct select on columns""" - distinct_on: [aviation_user_select_column!] + distinct_on: [messages_select_column!] """limit the number of rows returned""" limit: Int @@ -1176,18 +1295,18 @@ type subscription_root { offset: Int """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] + order_by: [messages_order_by!] """filter the rows returned""" - where: aviation_user_bool_exp - ): [aviation_user!]! + where: messages_bool_exp + ): [messages!]! """ - fetch aggregated fields from the table: "aviation.user" + fetch aggregated fields from the table: "messages" """ - aviation_user_aggregate( + messages_aggregate( """distinct select on columns""" - distinct_on: [aviation_user_select_column!] + distinct_on: [messages_select_column!] """limit the number of rows returned""" limit: Int @@ -1196,28 +1315,28 @@ type subscription_root { offset: Int """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] + order_by: [messages_order_by!] """filter the rows returned""" - where: aviation_user_bool_exp - ): aviation_user_aggregate! + where: messages_bool_exp + ): messages_aggregate! - """fetch data from the table: "aviation.user" using primary key columns""" - aviation_user_by_pk(id: Int!): aviation_user + """fetch data from the table: "messages" using primary key columns""" + messages_by_pk(id: uuid!): messages """ - fetch data from the table in a streaming manner: "aviation.user" + fetch data from the table in a streaming manner: "messages" """ - aviation_user_stream( + messages_stream( """maximum number of rows returned in a single batch""" batch_size: Int! """cursor to stream the results returned by the query""" - cursor: [aviation_user_stream_cursor_input]! + cursor: [messages_stream_cursor_input]! """filter the rows returned""" - where: aviation_user_bool_exp - ): [aviation_user!]! + where: messages_bool_exp + ): [messages!]! } scalar timestamp