From 3b9b64ec9e3b6314eb7d7c16e840abd2e0560408 Mon Sep 17 00:00:00 2001 From: windyboy Date: Tue, 23 Jul 2024 12:01:58 +0800 Subject: [PATCH] refactor: Update ARR body parsing logic --- internal/repository/generated.go | 37 +- internal/repository/genqlient.yaml | 2 +- internal/repository/ginkgo.report | 104 +-- internal/repository/hasura.go | 12 +- internal/repository/hasura_test.go | 80 +- schema.graphql | 1289 ---------------------------- 6 files changed, 82 insertions(+), 1442 deletions(-) delete mode 100644 schema.graphql diff --git a/internal/repository/generated.go b/internal/repository/generated.go index b8c51e7..5aa35ed 100644 --- a/internal/repository/generated.go +++ b/internal/repository/generated.go @@ -4,7 +4,6 @@ package repository import ( "context" - "encoding/json" "time" "github.com/Khan/genqlient/graphql" @@ -13,29 +12,29 @@ import ( // input type for inserting data into table "aviation.telegrams" type Aviation_telegrams_insert_input struct { - Body_and_footer string `json:"body_and_footer"` - Body_data json.RawMessage `json:"body_data"` - Category string `json:"category"` - Date_time string `json:"date_time"` - Dispatched_at time.Time `json:"dispatched_at"` - Id int `json:"id"` - 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_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"` - Uuid uuid.UUID `json:"uuid"` + Body_and_footer string `json:"body_and_footer"` + Body_data string `json:"body_data"` + Category string `json:"category"` + Date_time string `json:"date_time"` + Dispatched_at time.Time `json:"dispatched_at"` + Id int `json:"id"` + 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_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 string `json:"secondary_addresses"` + Uuid uuid.UUID `json:"uuid"` } // 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 } +func (v *Aviation_telegrams_insert_input) GetBody_data() string { 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 } @@ -76,7 +75,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/genqlient.yaml b/internal/repository/genqlient.yaml index 096a8ae..933e695 100644 --- a/internal/repository/genqlient.yaml +++ b/internal/repository/genqlient.yaml @@ -6,7 +6,7 @@ operations: generated: generated.go bindings: jsonb: - type: encoding/json.RawMessage + type: string timestamp: type: time.Time uuid: diff --git a/internal/repository/ginkgo.report b/internal/repository/ginkgo.report index 57aa449..43d64f2 100644 --- a/internal/repository/ginkgo.report +++ b/internal/repository/ginkgo.report @@ -7,14 +7,14 @@ "SuiteHasProgrammaticFocus": false, "SpecialSuiteFailureReasons": null, "PreRunStats": { - "TotalSpecs": 3, + "TotalSpecs": 1, "SpecsThatWillRun": 1 }, - "StartTime": "2024-07-23T11:25:30.889407931+08:00", - "EndTime": "2024-07-23T11:25:30.892377154+08:00", - "RunTime": 2969222, + "StartTime": "2024-07-23T12:01:15.75278901+08:00", + "EndTime": "2024-07-23T12:01:15.764655302+08:00", + "RunTime": 11866337, "SuiteConfig": { - "RandomSeed": 1721705130, + "RandomSeed": 1721707275, "RandomizeAllSpecs": false, "FocusStrings": [ "Repositories Hasura Repository should mutate a parsed message" @@ -31,7 +31,7 @@ "DryRun": false, "PollProgressAfter": 0, "PollProgressInterval": 0, - "Timeout": 3599523895104, + "Timeout": 3599595734975, "EmitSpecProgress": false, "OutputInterceptorMode": "", "SourceRoots": null, @@ -41,76 +41,6 @@ "ParallelHost": "" }, "SpecReports": [ - { - "ContainerHierarchyTexts": [ - "Repositories", - "Just a simple test" - ], - "ContainerHierarchyLocations": [ - { - "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 19 - }, - { - "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 20 - } - ], - "ContainerHierarchyLabels": [ - [], - [] - ], - "LeafNodeType": "It", - "LeafNodeLocation": { - "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 56 - }, - "LeafNodeLabels": [], - "LeafNodeText": "should not error", - "State": "skipped", - "StartTime": "2024-07-23T11:25:30.889468443+08:00", - "EndTime": "0001-01-01T00:00:00Z", - "RunTime": 0, - "ParallelProcess": 1, - "NumAttempts": 0, - "MaxFlakeAttempts": 0, - "MaxMustPassRepeatedly": 0 - }, - { - "ContainerHierarchyTexts": [ - "Repositories", - "Just a simple test" - ], - "ContainerHierarchyLocations": [ - { - "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 19 - }, - { - "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 20 - } - ], - "ContainerHierarchyLabels": [ - [], - [] - ], - "LeafNodeType": "It", - "LeafNodeLocation": { - "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 60 - }, - "LeafNodeLabels": [], - "LeafNodeText": "name should be new", - "State": "skipped", - "StartTime": "2024-07-23T11:25:30.889483979+08:00", - "EndTime": "0001-01-01T00:00:00Z", - "RunTime": 0, - "ParallelProcess": 1, - "NumAttempts": 0, - "MaxFlakeAttempts": 0, - "MaxMustPassRepeatedly": 0 - }, { "ContainerHierarchyTexts": [ "Repositories", @@ -119,11 +49,11 @@ "ContainerHierarchyLocations": [ { "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 19 + "LineNumber": 17 }, { "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 66 + "LineNumber": 64 } ], "ContainerHierarchyLabels": [ @@ -133,14 +63,14 @@ "LeafNodeType": "It", "LeafNodeLocation": { "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 72 + "LineNumber": 70 }, "LeafNodeLabels": [], "LeafNodeText": "should mutate a parsed message", "State": "passed", - "StartTime": "2024-07-23T11:25:30.889488379+08:00", - "EndTime": "2024-07-23T11:25:30.89235263+08:00", - "RunTime": 2864253, + "StartTime": "2024-07-23T12:01:15.752849553+08:00", + "EndTime": "2024-07-23T12:01:15.764585492+08:00", + "RunTime": 11735991, "ParallelProcess": 1, "NumAttempts": 1, "MaxFlakeAttempts": 0, @@ -150,11 +80,11 @@ "SpecEventType": "Node", "CodeLocation": { "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 72 + "LineNumber": 70 }, "TimelineLocation": { "Order": 1, - "Time": "2024-07-23T11:25:30.889491289+08:00" + "Time": "2024-07-23T12:01:15.752859429+08:00" }, "Message": "should mutate a parsed message", "NodeType": "It" @@ -163,14 +93,14 @@ "SpecEventType": "Node (End)", "CodeLocation": { "FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/repository/hasura_test.go", - "LineNumber": 72 + "LineNumber": 70 }, "TimelineLocation": { "Order": 3, - "Time": "2024-07-23T11:25:30.892349748+08:00" + "Time": "2024-07-23T12:01:15.764576564+08:00" }, "Message": "should mutate a parsed message", - "Duration": 2858459, + "Duration": 11717183, "NodeType": "It" } ] diff --git a/internal/repository/hasura.go b/internal/repository/hasura.go index 24da6d3..41bb21f 100644 --- a/internal/repository/hasura.go +++ b/internal/repository/hasura.go @@ -2,6 +2,7 @@ package repository import ( "context" + "encoding/json" "os" "caatsm/internal/domain" @@ -28,14 +29,15 @@ func NewHasuraRepo(endpoint, secret string) *HasuraRepository { // InsertParsedMessage inserts a new ParsedMessage into the Hasura GraphQL API func (hr *HasuraRepository) InsertParsedMessage(pm *domain.ParsedMessage) error { + bodyString, _ := json.Marshal(pm.BodyData) variables := Aviation_telegrams_insert_input{ // Id: 10, Body_and_footer: pm.BodyAndFooter, - // Body_data: pm.BodyData.(json.RawMessage), - Category: pm.Category, - Date_time: pm.DateTime, - Dispatched_at: pm.DispatchedAt, - Uuid: uuid.New(), + Body_data: string(bodyString), + Category: pm.Category, + Date_time: pm.DateTime, + Dispatched_at: pm.DispatchedAt, + Uuid: uuid.New(), } _, err := newMessage(context.Background(), hr.client, variables) if err != nil { diff --git a/internal/repository/hasura_test.go b/internal/repository/hasura_test.go index d5c879f..9679436 100644 --- a/internal/repository/hasura_test.go +++ b/internal/repository/hasura_test.go @@ -2,11 +2,9 @@ package repository import ( "caatsm/internal/domain" - "context" "testing" "time" - "github.com/hasura/go-graphql-client" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -17,51 +15,51 @@ func TestConfig(t *testing.T) { } var _ = Describe("Repositories", func() { - Context("Just a simple test", func() { + // Context("Just a simple test", func() { - // Define a struct for the mutation input to match the expected GraphQL input - // Define a struct for the mutation input to match the expected GraphQL input - type aviation_user_insert_input struct { - Name graphql.String `json:"name"` - Email graphql.String `json:"email"` - UpdateAt graphql.String `json:"update_at"` // Use string for timestamp - } - // Get the current time in RFC3339 format - currentTime := time.Now().Format(time.RFC3339) + // // Define a struct for the mutation input to match the expected GraphQL input + // // Define a struct for the mutation input to match the expected GraphQL input + // type aviation_user_insert_input struct { + // Name graphql.String `json:"name"` + // Email graphql.String `json:"email"` + // UpdateAt graphql.String `json:"update_at"` // Use string for timestamp + // } + // // Get the current time in RFC3339 format + // currentTime := time.Now().Format(time.RFC3339) - input := aviation_user_insert_input{ - Name: graphql.String("new"), - Email: graphql.String("2@2.com"), - UpdateAt: graphql.String(currentTime), // Use formatted string - } + // input := aviation_user_insert_input{ + // Name: graphql.String("new"), + // Email: graphql.String("2@2.com"), + // UpdateAt: graphql.String(currentTime), // Use formatted string + // } - // Define the mutation - var mutation struct { - InsertAviationUserOne struct { - ID int `json:"id"` - Name string - } `graphql:"insert_aviation_user_one(object: $object)"` - } + // // Define the mutation + // var mutation struct { + // InsertAviationUserOne struct { + // ID int `json:"id"` + // Name string + // } `graphql:"insert_aviation_user_one(object: $object)"` + // } - // Define the mutation variables - // Define the mutation variables - variables := map[string]interface{}{ - "object": input, - } - // Define the mutation + // // Define the mutation variables + // // Define the mutation variables + // variables := map[string]interface{}{ + // "object": input, + // } + // // Define the mutation - client := graphql.NewClient("http://localhost:8080/v1/graphql", nil) + // client := graphql.NewClient("http://localhost:8080/v1/graphql", nil) - err := client.Mutate(context.Background(), &mutation, variables) - It("should not error", func() { - Expect(err).NotTo(HaveOccurred()) - }) + // err := client.Mutate(context.Background(), &mutation, variables) + // It("should not error", func() { + // Expect(err).NotTo(HaveOccurred()) + // }) - It("name should be new", func() { - Expect(mutation.InsertAviationUserOne.Name).To(Equal("new")) - }) + // It("name should be new", func() { + // Expect(mutation.InsertAviationUserOne.Name).To(Equal("new")) + // }) - }) + // }) Context("Hasura Repository", func() { // var repository *HasuraRepository @@ -82,8 +80,8 @@ var _ = Describe("Repositories", func() { OriginatorDateTime: "originator_date_time", Category: "category", BodyAndFooter: "body_and_footer", - // BodyData: &interface{}, - ReceivedAt: time.Now(), + BodyData: domain.ARR{AircraftID: "aircraft_id", Category: "ARR", DepartureAirport: "departure_airport", DepartureTime: "departure_time", ArrivalAirport: "arrival_airport", ArrivalTime: "arrival_time"}, + ReceivedAt: time.Now(), } err := repository.InsertParsedMessage(parseMessage) Expect(err).NotTo(HaveOccurred()) diff --git a/schema.graphql b/schema.graphql deleted file mode 100644 index 7afe380..0000000 --- a/schema.graphql +++ /dev/null @@ -1,1289 +0,0 @@ -schema { - query: query_root - mutation: mutation_root - subscription: subscription_root -} - -"""whether this query should be cached (Hasura Cloud only)""" -directive @cached( - """measured in seconds""" - ttl: Int! = 60 - - """refresh the cache entry""" - refresh: Boolean! = false -) on QUERY - -""" -Boolean expression to compare columns of type "Boolean". All fields are combined with logical 'AND'. -""" -input Boolean_comparison_exp { - _eq: Boolean - _gt: Boolean - _gte: Boolean - _in: [Boolean!] - _is_null: Boolean - _lt: Boolean - _lte: Boolean - _neq: Boolean - _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'. -""" -input String_comparison_exp { - _eq: String - _gt: String - _gte: String - - """does the column match the given case-insensitive pattern""" - _ilike: String - _in: [String!] - - """ - does the column match the given POSIX regular expression, case insensitive - """ - _iregex: String - _is_null: Boolean - - """does the column match the given pattern""" - _like: String - _lt: String - _lte: String - _neq: String - - """does the column NOT match the given case-insensitive pattern""" - _nilike: String - _nin: [String!] - - """ - does the column NOT match the given POSIX regular expression, case insensitive - """ - _niregex: String - - """does the column NOT match the given pattern""" - _nlike: String - - """ - does the column NOT match the given POSIX regular expression, case sensitive - """ - _nregex: String - - """does the column NOT match the given SQL regular expression""" - _nsimilar: String - - """ - does the column match the given POSIX regular expression, case sensitive - """ - _regex: String - - """does the column match the given SQL regular expression""" - _similar: String -} - -""" -columns and relationships of "aviation.telegrams" -""" -type aviation_telegrams { - body_and_footer: String - body_data( - """JSON select path""" - path: String - ): jsonb - category: String - date_time: String! - dispatched_at: timestamp - id: Int! - message_id: String! - need_dispatch: Boolean! - originator: String - originator_date_time: String - parsed_at: timestamp - primary_address: String! - priority_indicator: String! - received_at: timestamp! - secondary_addresses( - """JSON select path""" - path: String - ): jsonb - start_indicator: String! -} - -""" -aggregated selection of "aviation.telegrams" -""" -type aviation_telegrams_aggregate { - aggregate: aviation_telegrams_aggregate_fields - nodes: [aviation_telegrams!]! -} - -""" -aggregate fields of "aviation.telegrams" -""" -type aviation_telegrams_aggregate_fields { - avg: aviation_telegrams_avg_fields - count(columns: [aviation_telegrams_select_column!], distinct: Boolean): Int! - max: aviation_telegrams_max_fields - min: aviation_telegrams_min_fields - stddev: aviation_telegrams_stddev_fields - stddev_pop: aviation_telegrams_stddev_pop_fields - stddev_samp: aviation_telegrams_stddev_samp_fields - sum: aviation_telegrams_sum_fields - var_pop: aviation_telegrams_var_pop_fields - var_samp: aviation_telegrams_var_samp_fields - variance: aviation_telegrams_variance_fields -} - -"""append existing jsonb value of filtered columns with new jsonb value""" -input aviation_telegrams_append_input { - body_data: jsonb - secondary_addresses: jsonb -} - -"""aggregate avg on columns""" -type aviation_telegrams_avg_fields { - id: Float -} - -""" -Boolean expression to filter rows from the table "aviation.telegrams". All fields are combined with a logical 'AND'. -""" -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 - date_time: String_comparison_exp - dispatched_at: timestamp_comparison_exp - id: Int_comparison_exp - message_id: String_comparison_exp - need_dispatch: Boolean_comparison_exp - originator: String_comparison_exp - originator_date_time: String_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 - start_indicator: String_comparison_exp -} - -""" -unique or primary key constraints on table "aviation.telegrams" -""" -enum aviation_telegrams_constraint { - """ - unique or primary key constraint on columns "id" - """ - telegrams_pkey -} - -""" -delete the field or element with specified path (for JSON arrays, negative integers count from the end) -""" -input aviation_telegrams_delete_at_path_input { - body_data: [String!] - secondary_addresses: [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 aviation_telegrams_delete_elem_input { - body_data: Int - secondary_addresses: Int -} - -""" -delete key/value pair or string element. key/value pairs are matched based on their key value -""" -input aviation_telegrams_delete_key_input { - body_data: String - secondary_addresses: String -} - -""" -input type for incrementing numeric columns in table "aviation.telegrams" -""" -input aviation_telegrams_inc_input { - id: Int -} - -""" -input type for inserting data into table "aviation.telegrams" -""" -input aviation_telegrams_insert_input { - body_and_footer: String - body_data: jsonb - category: String - date_time: String - dispatched_at: timestamp - id: Int - message_id: String - need_dispatch: Boolean - originator: String - originator_date_time: String - parsed_at: timestamp - primary_address: String - priority_indicator: String - received_at: timestamp - secondary_addresses: jsonb - start_indicator: String -} - -"""aggregate max on columns""" -type aviation_telegrams_max_fields { - body_and_footer: String - category: String - date_time: String - dispatched_at: timestamp - id: Int - message_id: String - originator: String - originator_date_time: String - parsed_at: timestamp - primary_address: String - priority_indicator: String - received_at: timestamp - start_indicator: String -} - -"""aggregate min on columns""" -type aviation_telegrams_min_fields { - body_and_footer: String - category: String - date_time: String - dispatched_at: timestamp - id: Int - message_id: String - originator: String - originator_date_time: String - parsed_at: timestamp - primary_address: String - priority_indicator: String - received_at: timestamp - start_indicator: String -} - -""" -response of any mutation on the table "aviation.telegrams" -""" -type aviation_telegrams_mutation_response { - """number of rows affected by the mutation""" - affected_rows: Int! - - """data from the rows affected by the mutation""" - returning: [aviation_telegrams!]! -} - -""" -on_conflict condition type for table "aviation.telegrams" -""" -input aviation_telegrams_on_conflict { - constraint: aviation_telegrams_constraint! - update_columns: [aviation_telegrams_update_column!]! = [] - where: aviation_telegrams_bool_exp -} - -"""Ordering options when selecting data from "aviation.telegrams".""" -input aviation_telegrams_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 - start_indicator: order_by -} - -"""primary key columns input for table: aviation.telegrams""" -input aviation_telegrams_pk_columns_input { - id: Int! -} - -"""prepend existing jsonb value of filtered columns with new jsonb value""" -input aviation_telegrams_prepend_input { - body_data: jsonb - secondary_addresses: jsonb -} - -""" -select columns of table "aviation.telegrams" -""" -enum aviation_telegrams_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 - - """column name""" - start_indicator -} - -""" -input type for updating data in table "aviation.telegrams" -""" -input aviation_telegrams_set_input { - body_and_footer: String - body_data: jsonb - category: String - date_time: String - dispatched_at: timestamp - id: Int - message_id: String - need_dispatch: Boolean - originator: String - originator_date_time: String - parsed_at: timestamp - primary_address: String - priority_indicator: String - received_at: timestamp - secondary_addresses: jsonb - start_indicator: String -} - -"""aggregate stddev on columns""" -type aviation_telegrams_stddev_fields { - id: Float -} - -"""aggregate stddev_pop on columns""" -type aviation_telegrams_stddev_pop_fields { - id: Float -} - -"""aggregate stddev_samp on columns""" -type aviation_telegrams_stddev_samp_fields { - id: Float -} - -""" -Streaming cursor of the table "aviation_telegrams" -""" -input aviation_telegrams_stream_cursor_input { - """Stream column input with initial value""" - initial_value: aviation_telegrams_stream_cursor_value_input! - - """cursor ordering""" - ordering: cursor_ordering -} - -"""Initial value of the column from where the streaming should start""" -input aviation_telegrams_stream_cursor_value_input { - body_and_footer: String - body_data: jsonb - category: String - date_time: String - dispatched_at: timestamp - id: Int - message_id: String - need_dispatch: Boolean - originator: String - originator_date_time: String - parsed_at: timestamp - primary_address: String - priority_indicator: String - received_at: timestamp - secondary_addresses: jsonb - start_indicator: String -} - -"""aggregate sum on columns""" -type aviation_telegrams_sum_fields { - id: Int -} - -""" -update columns of table "aviation.telegrams" -""" -enum aviation_telegrams_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 - - """column name""" - start_indicator -} - -input aviation_telegrams_updates { - """append existing jsonb value of filtered columns with new jsonb value""" - _append: aviation_telegrams_append_input - - """ - delete the field or element with specified path (for JSON arrays, negative integers count from the end) - """ - _delete_at_path: aviation_telegrams_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: aviation_telegrams_delete_elem_input - - """ - delete key/value pair or string element. key/value pairs are matched based on their key value - """ - _delete_key: aviation_telegrams_delete_key_input - - """increments the numeric columns with given value of the filtered values""" - _inc: aviation_telegrams_inc_input - - """prepend existing jsonb value of filtered columns with new jsonb value""" - _prepend: aviation_telegrams_prepend_input - - """sets the columns of the filtered rows to the given values""" - _set: aviation_telegrams_set_input - - """filter the rows which have to be updated""" - where: aviation_telegrams_bool_exp! -} - -"""aggregate var_pop on columns""" -type aviation_telegrams_var_pop_fields { - id: Float -} - -"""aggregate var_samp on columns""" -type aviation_telegrams_var_samp_fields { - id: Float -} - -"""aggregate variance on columns""" -type aviation_telegrams_variance_fields { - id: Float -} - -"""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""" - ASC - - """descending ordering of the cursor""" - DESC -} - -scalar jsonb - -input jsonb_cast_exp { - String: String_comparison_exp -} - -""" -Boolean expression to compare columns of type "jsonb". All fields are combined with logical 'AND'. -""" -input jsonb_comparison_exp { - _cast: jsonb_cast_exp - - """is the column contained in the given json value""" - _contained_in: jsonb - - """does the column contain the given json value at the top level""" - _contains: jsonb - _eq: jsonb - _gt: jsonb - _gte: jsonb - - """does the string exist as a top-level key in the column""" - _has_key: String - - """do all of these strings exist as top-level keys in the column""" - _has_keys_all: [String!] - - """do any of these strings exist as top-level keys in the column""" - _has_keys_any: [String!] - _in: [jsonb!] - _is_null: Boolean - _lt: jsonb - _lte: jsonb - _neq: jsonb - _nin: [jsonb!] -} - -"""mutation root""" -type mutation_root { - """ - delete data from the table: "aviation.telegrams" - """ - delete_aviation_telegrams( - """filter the rows which have to be deleted""" - where: aviation_telegrams_bool_exp! - ): aviation_telegrams_mutation_response - - """ - delete single row from the table: "aviation.telegrams" - """ - delete_aviation_telegrams_by_pk(id: Int!): aviation_telegrams - - """ - delete data from the table: "aviation.user" - """ - delete_aviation_user( - """filter the rows which have to be deleted""" - where: aviation_user_bool_exp! - ): aviation_user_mutation_response - - """ - delete single row from the table: "aviation.user" - """ - delete_aviation_user_by_pk(id: Int!): aviation_user - - """ - insert data into the table: "aviation.telegrams" - """ - insert_aviation_telegrams( - """the rows to be inserted""" - objects: [aviation_telegrams_insert_input!]! - - """upsert condition""" - on_conflict: aviation_telegrams_on_conflict - ): aviation_telegrams_mutation_response - - """ - insert a single row into the table: "aviation.telegrams" - """ - insert_aviation_telegrams_one( - """the row to be inserted""" - object: aviation_telegrams_insert_input! - - """upsert condition""" - on_conflict: aviation_telegrams_on_conflict - ): aviation_telegrams - - """ - insert data into the table: "aviation.user" - """ - insert_aviation_user( - """the rows to be inserted""" - objects: [aviation_user_insert_input!]! - - """upsert condition""" - on_conflict: aviation_user_on_conflict - ): aviation_user_mutation_response - - """ - insert a single row into the table: "aviation.user" - """ - insert_aviation_user_one( - """the row to be inserted""" - object: aviation_user_insert_input! - - """upsert condition""" - on_conflict: aviation_user_on_conflict - ): aviation_user - - """ - update data of the table: "aviation.telegrams" - """ - update_aviation_telegrams( - """append existing jsonb value of filtered columns with new jsonb value""" - _append: aviation_telegrams_append_input - - """ - delete the field or element with specified path (for JSON arrays, negative integers count from the end) - """ - _delete_at_path: aviation_telegrams_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: aviation_telegrams_delete_elem_input - - """ - delete key/value pair or string element. key/value pairs are matched based on their key value - """ - _delete_key: aviation_telegrams_delete_key_input - - """increments the numeric columns with given value of the filtered values""" - _inc: aviation_telegrams_inc_input - - """prepend existing jsonb value of filtered columns with new jsonb value""" - _prepend: aviation_telegrams_prepend_input - - """sets the columns of the filtered rows to the given values""" - _set: aviation_telegrams_set_input - - """filter the rows which have to be updated""" - where: aviation_telegrams_bool_exp! - ): aviation_telegrams_mutation_response - - """ - update single row of the table: "aviation.telegrams" - """ - update_aviation_telegrams_by_pk( - """append existing jsonb value of filtered columns with new jsonb value""" - _append: aviation_telegrams_append_input - - """ - delete the field or element with specified path (for JSON arrays, negative integers count from the end) - """ - _delete_at_path: aviation_telegrams_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: aviation_telegrams_delete_elem_input - - """ - delete key/value pair or string element. key/value pairs are matched based on their key value - """ - _delete_key: aviation_telegrams_delete_key_input - - """increments the numeric columns with given value of the filtered values""" - _inc: aviation_telegrams_inc_input - - """prepend existing jsonb value of filtered columns with new jsonb value""" - _prepend: aviation_telegrams_prepend_input - - """sets the columns of the filtered rows to the given values""" - _set: aviation_telegrams_set_input - pk_columns: aviation_telegrams_pk_columns_input! - ): aviation_telegrams - - """ - update multiples rows of table: "aviation.telegrams" - """ - update_aviation_telegrams_many( - """updates to execute, in order""" - updates: [aviation_telegrams_updates!]! - ): [aviation_telegrams_mutation_response] - - """ - update data of the table: "aviation.user" - """ - update_aviation_user( - """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! - ): aviation_user_mutation_response - - """ - update single row of the table: "aviation.user" - """ - update_aviation_user_by_pk( - """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 - pk_columns: aviation_user_pk_columns_input! - ): aviation_user - - """ - update multiples rows of table: "aviation.user" - """ - update_aviation_user_many( - """updates to execute, in order""" - updates: [aviation_user_updates!]! - ): [aviation_user_mutation_response] -} - -"""column ordering options""" -enum order_by { - """in ascending order, nulls last""" - asc - - """in ascending order, nulls first""" - asc_nulls_first - - """in ascending order, nulls last""" - asc_nulls_last - - """in descending order, nulls first""" - desc - - """in descending order, nulls first""" - desc_nulls_first - - """in descending order, nulls last""" - desc_nulls_last -} - -type query_root { - """ - fetch data from the table: "aviation.telegrams" - """ - aviation_telegrams( - """distinct select on columns""" - distinct_on: [aviation_telegrams_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_telegrams_order_by!] - - """filter the rows returned""" - where: aviation_telegrams_bool_exp - ): [aviation_telegrams!]! - - """ - fetch aggregated fields from the table: "aviation.telegrams" - """ - aviation_telegrams_aggregate( - """distinct select on columns""" - distinct_on: [aviation_telegrams_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_telegrams_order_by!] - - """filter the rows returned""" - where: aviation_telegrams_bool_exp - ): aviation_telegrams_aggregate! - - """ - fetch data from the table: "aviation.telegrams" using primary key columns - """ - aviation_telegrams_by_pk(id: Int!): aviation_telegrams - - """ - fetch data from the table: "aviation.user" - """ - aviation_user( - """distinct select on columns""" - distinct_on: [aviation_user_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] - - """filter the rows returned""" - where: aviation_user_bool_exp - ): [aviation_user!]! - - """ - fetch aggregated fields from the table: "aviation.user" - """ - aviation_user_aggregate( - """distinct select on columns""" - distinct_on: [aviation_user_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] - - """filter the rows returned""" - where: aviation_user_bool_exp - ): aviation_user_aggregate! - - """fetch data from the table: "aviation.user" using primary key columns""" - aviation_user_by_pk(id: Int!): aviation_user -} - -type subscription_root { - """ - fetch data from the table: "aviation.telegrams" - """ - aviation_telegrams( - """distinct select on columns""" - distinct_on: [aviation_telegrams_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_telegrams_order_by!] - - """filter the rows returned""" - where: aviation_telegrams_bool_exp - ): [aviation_telegrams!]! - - """ - fetch aggregated fields from the table: "aviation.telegrams" - """ - aviation_telegrams_aggregate( - """distinct select on columns""" - distinct_on: [aviation_telegrams_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_telegrams_order_by!] - - """filter the rows returned""" - where: aviation_telegrams_bool_exp - ): aviation_telegrams_aggregate! - - """ - fetch data from the table: "aviation.telegrams" using primary key columns - """ - aviation_telegrams_by_pk(id: Int!): aviation_telegrams - - """ - fetch data from the table in a streaming manner: "aviation.telegrams" - """ - aviation_telegrams_stream( - """maximum number of rows returned in a single batch""" - batch_size: Int! - - """cursor to stream the results returned by the query""" - cursor: [aviation_telegrams_stream_cursor_input]! - - """filter the rows returned""" - where: aviation_telegrams_bool_exp - ): [aviation_telegrams!]! - - """ - fetch data from the table: "aviation.user" - """ - aviation_user( - """distinct select on columns""" - distinct_on: [aviation_user_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] - - """filter the rows returned""" - where: aviation_user_bool_exp - ): [aviation_user!]! - - """ - fetch aggregated fields from the table: "aviation.user" - """ - aviation_user_aggregate( - """distinct select on columns""" - distinct_on: [aviation_user_select_column!] - - """limit the number of rows returned""" - limit: Int - - """skip the first n rows. Use only with order_by""" - offset: Int - - """sort the rows by one or more columns""" - order_by: [aviation_user_order_by!] - - """filter the rows returned""" - where: aviation_user_bool_exp - ): aviation_user_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 in a streaming manner: "aviation.user" - """ - aviation_user_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]! - - """filter the rows returned""" - where: aviation_user_bool_exp - ): [aviation_user!]! -} - -scalar timestamp - -""" -Boolean expression to compare columns of type "timestamp". All fields are combined with logical 'AND'. -""" -input timestamp_comparison_exp { - _eq: timestamp - _gt: timestamp - _gte: timestamp - _in: [timestamp!] - _is_null: Boolean - _lt: timestamp - _lte: timestamp - _neq: timestamp - _nin: [timestamp!] -} - -scalar timestamptz - -""" -Boolean expression to compare columns of type "timestamptz". All fields are combined with logical 'AND'. -""" -input timestamptz_comparison_exp { - _eq: timestamptz - _gt: timestamptz - _gte: timestamptz - _in: [timestamptz!] - _is_null: Boolean - _lt: timestamptz - _lte: timestamptz - _neq: timestamptz - _nin: [timestamptz!] -} -