From 6a4524469447ca43e44df5656611ed2e19d29838 Mon Sep 17 00:00:00 2001 From: windyboy Date: Wed, 24 Jul 2024 16:38:22 +0800 Subject: [PATCH] refactor: Update BodyParser constructor to accept body parameter --- go.mod | 14 +- go.sum | 28 +- internal/domain/aviation.go | 3 +- internal/parsers/aviation_parser.go | 15 +- internal/repository/generated.go | 10 +- internal/repository/hasura.go | 4 +- internal/repository/schema.graphql | 865 ++++++++++++++++------------ 7 files changed, 550 insertions(+), 389 deletions(-) diff --git a/go.mod b/go.mod index 8359422..6e28a3e 100644 --- a/go.mod +++ b/go.mod @@ -40,17 +40,17 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/vektah/gqlparser/v2 v2.5.11 // indirect + github.com/vektah/gqlparser/v2 v2.5.16 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/crypto v0.23.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.21.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 7274bfe..84227df 100644 --- a/go.sum +++ b/go.sum @@ -104,8 +104,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/vektah/gqlparser/v2 v2.5.11 h1:JJxLtXIoN7+3x6MBdtIP59TP1RANnY7pXOaDnADQSf8= -github.com/vektah/gqlparser/v2 v2.5.11/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc= +github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0vy5p8= +github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -121,8 +121,8 @@ go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -134,8 +134,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -149,23 +149,23 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= -golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -174,8 +174,8 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/internal/domain/aviation.go b/internal/domain/aviation.go index 2b3e50b..d6a99dc 100644 --- a/internal/domain/aviation.go +++ b/internal/domain/aviation.go @@ -96,7 +96,8 @@ type ParsedMessage struct { Originator string `json:"originator,omitempty"` // 发件人: The sender of the message. OriginatorDateTime string `json:"originatorDateTime,omitempty"` // 发件日期时间: The date and time when the originator sent the message. Category string `json:"category,omitempty"` // 类别: The category of the message. - BodyAndFooter string `json:"bodyAndFooter,omitempty"` // 正文和页脚: The body and footer of the message (e.g., 'CALLSIGN/ABC123\nFPL/AB1234-AB\n...'). + Text string `json:"bodyAndFooter,omitempty"` // 正文和页脚: The body and footer of the message (e.g., 'CALLSIGN/ABC123\nFPL/AB1234-AB\n...'). + Body string `json:"body,omitempty"` // 正文: The body of the message. BodyData interface{} `json:"bodyData,omitempty"` // 正文数据: Parsed body data. ReceivedAt time.Time `json:"receivedAt"` // 接收时间: The time when the message was received. ParsedAt time.Time `json:"parsedAt,omitempty"` // 解析时间: The time when the message was parsed. diff --git a/internal/parsers/aviation_parser.go b/internal/parsers/aviation_parser.go index 438bb08..05dd25f 100644 --- a/internal/parsers/aviation_parser.go +++ b/internal/parsers/aviation_parser.go @@ -152,7 +152,7 @@ func Parse(rawText string) (*domain.ParsedMessage, error) { return nil, err } - bodyParser := NewBodyParser(message.BodyAndFooter) + bodyParser := NewBodyParser(message.Body) category, bodyData, err := bodyParser.Parse() message.Category = category message.ParsedAt = time.Now() @@ -180,21 +180,21 @@ func cleanMessage(text string) string { func ParseHeader(fullMessage string) (domain.ParsedMessage, error) { log := utils.GetSugaredLogger() - fullMessage = cleanMessage(fullMessage) - lines := strings.Split(fullMessage, "\n") + cleaned := cleanMessage(fullMessage) + lines := strings.Split(cleaned, "\n") if len(lines) < 3 { log.Warnf("invalid message format: %s", fullMessage) - return domain.ParsedMessage{}, fmt.Errorf("invalid message format: %s", fullMessage) + return domain.ParsedMessage{Text: fullMessage}, fmt.Errorf("invalid message format: %s", fullMessage) } _, messageID, dateTime, err := parseStartIndicator(lines[0]) if err != nil { - return domain.ParsedMessage{}, err + return domain.ParsedMessage{Text: fullMessage}, err } priorityIndicator, primaryAddress := parsePriorityAndPrimary(lines[1]) - secondaryAddresses, originator, originatorDateTime, bodyAndFooter := parseRemainingLines(lines[2:]) + secondaryAddresses, originator, originatorDateTime, body := parseRemainingLines(lines[2:]) return domain.ParsedMessage{ MessageID: messageID, @@ -204,7 +204,8 @@ func ParseHeader(fullMessage string) (domain.ParsedMessage, error) { SecondaryAddresses: secondaryAddresses, Originator: originator, OriginatorDateTime: originatorDateTime, - BodyAndFooter: bodyAndFooter, + Text: fullMessage, + Body: body, ReceivedAt: time.Now(), }, nil } diff --git a/internal/repository/generated.go b/internal/repository/generated.go index 1536f20..a184737 100644 --- a/internal/repository/generated.go +++ b/internal/repository/generated.go @@ -13,7 +13,7 @@ import ( // input type for inserting data into table "aviation.telegrams" type Aviation_telegrams_insert_input struct { - Body_and_footer string `json:"body_and_footer"` + Text string `json:"Text"` Body_data json.RawMessage `json:"body_data"` Category string `json:"category"` Date_time string `json:"date_time"` @@ -26,12 +26,12 @@ type Aviation_telegrams_insert_input struct { 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"` } -// 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 } +// 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_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 } @@ -72,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 2c905dd..9518c0d 100644 --- a/internal/repository/hasura.go +++ b/internal/repository/hasura.go @@ -37,8 +37,8 @@ func (hr *HasuraRepository) CreateNew(pm *domain.ParsedMessage) error { Message_id: pm.MessageID, Priority_indicator: pm.PriorityIndicator, Primary_address: pm.PrimaryAddress, - Secondary_addresses: secondAddress, - Body_and_footer: pm.BodyAndFooter, + Secondary_addresses: string(secondAddress), + Text: pm.Text, Body_data: bodyString, Category: pm.Category, Date_time: pm.DateTime, diff --git a/internal/repository/schema.graphql b/internal/repository/schema.graphql index 16dbf1d..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,7 +85,7 @@ input String_comparison_exp { columns and relationships of "aviation.telegrams" """ type aviation_telegrams { - body_and_footer: String + Text: String body_data( """JSON select path""" path: String @@ -108,7 +93,7 @@ type aviation_telegrams { category: String date_time: String dispatched_at: timestamp - message_id: String! + message_id: String need_dispatch: Boolean originator: String originator_date_time: String @@ -116,11 +101,8 @@ type aviation_telegrams { primary_address: String priority_indicator: String received_at: timestamp! - secondary_addresses( - """JSON select path""" - path: String - ): jsonb - uuid: uuid + secondary_addresses: String + uuid: uuid! } """ @@ -143,17 +125,16 @@ 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 } """ Boolean expression to filter rows from the table "aviation.telegrams". All fields are combined with a logical 'AND'. """ input aviation_telegrams_bool_exp { + Text: String_comparison_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 @@ -166,7 +147,7 @@ input aviation_telegrams_bool_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 } @@ -174,15 +155,10 @@ input aviation_telegrams_bool_exp { unique or primary key constraints on table "aviation.telegrams" """ enum aviation_telegrams_constraint { - """ - unique or primary key constraint on columns "message_id" - """ - telegrams_pkey - """ unique or primary key constraint on columns "uuid" """ - telegrams_uuid_key + telegrams_pkey } """ @@ -190,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!] } """ @@ -198,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 } """ @@ -206,14 +180,13 @@ 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 } """ input type for inserting data into table "aviation.telegrams" """ input aviation_telegrams_insert_input { - body_and_footer: String + Text: String body_data: jsonb category: String date_time: String @@ -226,13 +199,13 @@ input aviation_telegrams_insert_input { 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 { - body_and_footer: String + Text: String category: String date_time: String dispatched_at: timestamp @@ -243,12 +216,13 @@ 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 { - body_and_footer: String + Text: String category: String date_time: String dispatched_at: timestamp @@ -259,6 +233,7 @@ type aviation_telegrams_min_fields { primary_address: String priority_indicator: String received_at: timestamp + secondary_addresses: String uuid: uuid } @@ -284,7 +259,7 @@ input aviation_telegrams_on_conflict { """Ordering options when selecting data from "aviation.telegrams".""" input aviation_telegrams_order_by { - body_and_footer: order_by + Text: order_by body_data: order_by category: order_by date_time: order_by @@ -303,13 +278,12 @@ input aviation_telegrams_order_by { """primary key columns input for table: aviation.telegrams""" input aviation_telegrams_pk_columns_input { - message_id: String! + uuid: uuid! } """prepend existing jsonb value of filtered columns with new jsonb value""" input aviation_telegrams_prepend_input { body_data: jsonb - secondary_addresses: jsonb } """ @@ -317,7 +291,7 @@ select columns of table "aviation.telegrams" """ enum aviation_telegrams_select_column { """column name""" - body_and_footer + Text """column name""" body_data @@ -366,7 +340,7 @@ enum aviation_telegrams_select_column { input type for updating data in table "aviation.telegrams" """ input aviation_telegrams_set_input { - body_and_footer: String + Text: String body_data: jsonb category: String date_time: String @@ -379,7 +353,7 @@ input aviation_telegrams_set_input { primary_address: String priority_indicator: String received_at: timestamp - secondary_addresses: jsonb + secondary_addresses: String uuid: uuid } @@ -396,7 +370,7 @@ input aviation_telegrams_stream_cursor_input { """Initial value of the column from where the streaming should start""" input aviation_telegrams_stream_cursor_value_input { - body_and_footer: String + Text: String body_data: jsonb category: String date_time: String @@ -409,7 +383,7 @@ input aviation_telegrams_stream_cursor_value_input { primary_address: String priority_indicator: String received_at: timestamp - secondary_addresses: jsonb + secondary_addresses: String uuid: uuid } @@ -418,7 +392,7 @@ update columns of table "aviation.telegrams" """ enum aviation_telegrams_update_column { """column name""" - body_and_footer + Text """column name""" body_data @@ -492,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""" @@ -774,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 { """ @@ -787,20 +910,20 @@ type mutation_root { """ delete single row from the table: "aviation.telegrams" """ - delete_aviation_telegrams_by_pk(message_id: String!): aviation_telegrams + 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" @@ -825,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" @@ -917,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""" @@ -1016,14 +1175,14 @@ type query_root { """ fetch data from the table: "aviation.telegrams" using primary key columns """ - aviation_telegrams_by_pk(message_id: String!): aviation_telegrams + 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 @@ -1032,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 @@ -1052,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 { @@ -1106,7 +1265,7 @@ type subscription_root { """ fetch data from the table: "aviation.telegrams" using primary key columns """ - aviation_telegrams_by_pk(message_id: String!): aviation_telegrams + aviation_telegrams_by_pk(uuid: uuid!): aviation_telegrams """ fetch data from the table in a streaming manner: "aviation.telegrams" @@ -1123,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 @@ -1136,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 @@ -1156,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