refactor: Rename 'text' field to 'content' in telegrams table

This commit is contained in:
windyboy
2024-08-09 10:29:17 +08:00
parent 9768bad108
commit 091a054eab
5 changed files with 26 additions and 44 deletions
+4 -4
View File
@@ -46,11 +46,11 @@ require (
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+4 -8
View File
@@ -13,9 +13,9 @@ 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"`
Content string `json:"content"`
Date_time string `json:"date_time"`
Dispatched_at time.Time `json:"dispatched_at"`
Message_id string `json:"message_id"`
@@ -27,19 +27,18 @@ type Aviation_telegrams_insert_input struct {
Priority_indicator string `json:"priority_indicator"`
Received_at time.Time `json:"received_at"`
Secondary_addresses string `json:"secondary_addresses"`
Text string `json:"text"`
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 }
// 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 }
// GetContent returns Aviation_telegrams_insert_input.Content, and is useful for accessing the field via an interface.
func (v *Aviation_telegrams_insert_input) GetContent() string { return v.Content }
// 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 }
@@ -77,9 +76,6 @@ func (v *Aviation_telegrams_insert_input) GetSecondary_addresses() string {
return v.Secondary_addresses
}
// 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 }
// GetUuid returns Aviation_telegrams_insert_input.Uuid, and is useful for accessing the field via an interface.
func (v *Aviation_telegrams_insert_input) GetUuid() uuid.UUID { return v.Uuid }
+1 -1
View File
@@ -38,7 +38,7 @@ func (hr *HasuraRepository) CreateNew(pm *domain.ParsedMessage) error {
Priority_indicator: pm.PriorityIndicator,
Primary_address: pm.PrimaryAddress,
Secondary_addresses: string(secondAddress),
Text: pm.Text,
Content: pm.Text,
Body_data: bodyString,
Category: pm.Category,
Date_time: pm.DateTime,
+14 -28
View File
@@ -85,12 +85,12 @@ input String_comparison_exp {
columns and relationships of "aviation.telegrams"
"""
type aviation_telegrams {
body_and_footer: String
body_data(
"""JSON select path"""
path: String
): jsonb
category: String
content: String
date_time: String
dispatched_at: timestamp
message_id: String
@@ -102,7 +102,6 @@ type aviation_telegrams {
priority_indicator: String
received_at: timestamp!
secondary_addresses: String
text: String!
uuid: uuid!
}
@@ -135,9 +134,9 @@ 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
content: String_comparison_exp
date_time: String_comparison_exp
dispatched_at: timestamp_comparison_exp
message_id: String_comparison_exp
@@ -149,7 +148,6 @@ input aviation_telegrams_bool_exp {
priority_indicator: String_comparison_exp
received_at: timestamp_comparison_exp
secondary_addresses: String_comparison_exp
text: String_comparison_exp
uuid: uuid_comparison_exp
}
@@ -188,9 +186,9 @@ input aviation_telegrams_delete_key_input {
input type for inserting data into table "aviation.telegrams"
"""
input aviation_telegrams_insert_input {
body_and_footer: String
body_data: jsonb
category: String
content: String
date_time: String
dispatched_at: timestamp
message_id: String
@@ -202,14 +200,13 @@ input aviation_telegrams_insert_input {
priority_indicator: String
received_at: timestamp
secondary_addresses: String
text: String
uuid: uuid
}
"""aggregate max on columns"""
type aviation_telegrams_max_fields {
body_and_footer: String
category: String
content: String
date_time: String
dispatched_at: timestamp
message_id: String
@@ -220,14 +217,13 @@ type aviation_telegrams_max_fields {
priority_indicator: String
received_at: timestamp
secondary_addresses: String
text: String
uuid: uuid
}
"""aggregate min on columns"""
type aviation_telegrams_min_fields {
body_and_footer: String
category: String
content: String
date_time: String
dispatched_at: timestamp
message_id: String
@@ -238,7 +234,6 @@ type aviation_telegrams_min_fields {
priority_indicator: String
received_at: timestamp
secondary_addresses: String
text: String
uuid: uuid
}
@@ -264,9 +259,9 @@ input aviation_telegrams_on_conflict {
"""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
content: order_by
date_time: order_by
dispatched_at: order_by
message_id: order_by
@@ -278,7 +273,6 @@ input aviation_telegrams_order_by {
priority_indicator: order_by
received_at: order_by
secondary_addresses: order_by
text: order_by
uuid: order_by
}
@@ -296,15 +290,15 @@ input aviation_telegrams_prepend_input {
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"""
content
"""column name"""
date_time
@@ -338,9 +332,6 @@ enum aviation_telegrams_select_column {
"""column name"""
secondary_addresses
"""column name"""
text
"""column name"""
uuid
}
@@ -349,9 +340,9 @@ enum aviation_telegrams_select_column {
input type for updating data in table "aviation.telegrams"
"""
input aviation_telegrams_set_input {
body_and_footer: String
body_data: jsonb
category: String
content: String
date_time: String
dispatched_at: timestamp
message_id: String
@@ -363,7 +354,6 @@ input aviation_telegrams_set_input {
priority_indicator: String
received_at: timestamp
secondary_addresses: String
text: String
uuid: uuid
}
@@ -380,9 +370,9 @@ 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
body_data: jsonb
category: String
content: String
date_time: String
dispatched_at: timestamp
message_id: String
@@ -394,7 +384,6 @@ input aviation_telegrams_stream_cursor_value_input {
priority_indicator: String
received_at: timestamp
secondary_addresses: String
text: String
uuid: uuid
}
@@ -402,15 +391,15 @@ input aviation_telegrams_stream_cursor_value_input {
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"""
content
"""column name"""
date_time
@@ -444,9 +433,6 @@ enum aviation_telegrams_update_column {
"""column name"""
secondary_addresses
"""column name"""
text
"""column name"""
uuid
}
+3 -3
View File
@@ -6,12 +6,12 @@ CREATE TABLE aviation.telegrams (
date_time VARCHAR(255) ,
priority_indicator VARCHAR(255) ,
primary_address VARCHAR(255) ,
secondary_addresses TEXT[], -- Array of strings
secondary_addresses TEXT,
originator VARCHAR(255),
originator_date_time VARCHAR(255),
category VARCHAR(255),
text TEXT,
body_data JSONB, -- JSONB to store parsed body data
content TEXT,
body_data JSONB,
received_at TIMESTAMP NOT NULL,
parsed_at TIMESTAMP,
dispatched_at TIMESTAMP,