From a5b9efcc5c5613d3efb81f3cb391a6eb6d26ac26 Mon Sep 17 00:00:00 2001 From: Carson Meyer Date: Sat, 25 May 2024 09:47:14 -0500 Subject: [PATCH] Deprecated! --- data_structures/alert.go | 5 +++++ data_structures/convective_outlook.go | 3 +++ data_structures/geojson/geometry.go | 1 + data_structures/geojson/multipoint.go | 1 + data_structures/geojson/point.go | 1 + data_structures/geojson/polygon.go | 3 +++ data_structures/mesoscale_discussion.go | 1 + data_structures/server_notification_update.go | 1 + sql/alert_table.go | 9 +++++++++ sql/convective_outlook_table.go | 6 ++++++ sql/mesoscale_discussion_table.go | 7 +++++++ 11 files changed, 38 insertions(+) diff --git a/data_structures/alert.go b/data_structures/alert.go index 69480c9..e41e118 100644 --- a/data_structures/alert.go +++ b/data_structures/alert.go @@ -6,6 +6,7 @@ import ( "github.com/cmeyer18/weather-common/v4/data_structures/geojson" ) +// Deprecated: use AlertV2 type Alert struct { ID string `json:"id"` Type string `json:"type"` @@ -13,6 +14,7 @@ type Alert struct { Properties AlertProperties `json:"properties"` } +// Deprecated: use AlertV2 type AlertProperties struct { AtID string `json:"@id"` Type string `json:"@type"` @@ -42,11 +44,13 @@ type AlertProperties struct { Parameters AlertPropertiesParameters `json:"parameters"` } +// Deprecated: use AlertV2 type AlertPropertiesGeocode struct { SAME []string `json:"SAME"` UGC []string `json:"UGC"` } +// Deprecated: use AlertV2 type AlertPropertiesParameters struct { AWIPSIdentifier []string `json:"AWIPSidentifier"` WMOIdentifier []string `json:"WMOidentifier"` @@ -56,6 +60,7 @@ type AlertPropertiesParameters struct { ExpiredReferences []string `json:"expiredReferences"` } +// Deprecated: use AlertV2 type AlertPropertiesReferences struct { AtID string `json:"@id"` Identifier string `json:"identifier"` diff --git a/data_structures/convective_outlook.go b/data_structures/convective_outlook.go index 543a828..efc1acf 100644 --- a/data_structures/convective_outlook.go +++ b/data_structures/convective_outlook.go @@ -7,6 +7,7 @@ import ( "github.com/cmeyer18/weather-common/v4/generative/golang" ) +// Deprecated: use ConvectiveOutlookV2 type ConvectiveOutlook struct { Type string `json:"type"` PublishedTime time.Time `json:"publishedTime"` @@ -14,12 +15,14 @@ type ConvectiveOutlook struct { Features []ConvectiveOutlookFeature `json:"features"` } +// Deprecated: use ConvectiveOutlookV2 type ConvectiveOutlookFeature struct { Type string `json:"type"` Geometry *geojson.Geometry `json:"geometry"` Properties ConvectiveOutlookFeatureProperties `json:"properties"` } +// Deprecated: use ConvectiveOutlookV2 type ConvectiveOutlookFeatureProperties struct { DN int `json:"DN"` Valid time.Time `json:"VALID"` diff --git a/data_structures/geojson/geometry.go b/data_structures/geojson/geometry.go index bf97b5f..367f7b8 100644 --- a/data_structures/geojson/geometry.go +++ b/data_structures/geojson/geometry.go @@ -1,5 +1,6 @@ package geojson +// Deprecated: use GeometryV2 type Geometry struct { Type string `json:"type"` Polygon *Polygon `json:"Polygon,omitempty"` diff --git a/data_structures/geojson/multipoint.go b/data_structures/geojson/multipoint.go index 5913afb..853e59f 100644 --- a/data_structures/geojson/multipoint.go +++ b/data_structures/geojson/multipoint.go @@ -1,5 +1,6 @@ package geojson +// Deprecated: use MultiPointV2 type MultiPoint struct { Points []*Point `json:"points,omitempty"` } diff --git a/data_structures/geojson/point.go b/data_structures/geojson/point.go index bced849..553b719 100644 --- a/data_structures/geojson/point.go +++ b/data_structures/geojson/point.go @@ -1,5 +1,6 @@ package geojson +// Deprecated: use PointV2 type Point struct { Latitude float64 `json:"lat"` Longitude float64 `json:"lon"` diff --git a/data_structures/geojson/polygon.go b/data_structures/geojson/polygon.go index 694ca0d..256891e 100644 --- a/data_structures/geojson/polygon.go +++ b/data_structures/geojson/polygon.go @@ -1,14 +1,17 @@ package geojson +// Deprecated: use PolygonV2, not using go based location parsing type Polygon struct { OuterPath *MultiPoint `json:"outerPath"` InnerPaths []*MultiPoint `json:"innerPaths,omitempty"` } +// Deprecated: func NewPolygonShape(outerPath *MultiPoint, innerPaths []*MultiPoint) *Polygon { return &Polygon{OuterPath: outerPath, InnerPaths: innerPaths} } +// Deprecated: func (p *Polygon) ContainsPoint(point *Point) bool { return p.containedInOuterPath(point) && !p.containedInInnerPaths(point) } diff --git a/data_structures/mesoscale_discussion.go b/data_structures/mesoscale_discussion.go index 080b4b7..109d6cc 100644 --- a/data_structures/mesoscale_discussion.go +++ b/data_structures/mesoscale_discussion.go @@ -2,6 +2,7 @@ package data_structures import "github.com/cmeyer18/weather-common/v4/data_structures/geojson" +// Deprecated: use MesoscaleDiscussionV2 type MesoscaleDiscussion struct { MDNumber int Year int diff --git a/data_structures/server_notification_update.go b/data_structures/server_notification_update.go index 819dc36..e1b7b9a 100644 --- a/data_structures/server_notification_update.go +++ b/data_structures/server_notification_update.go @@ -1,5 +1,6 @@ package data_structures +// Deprecated: use NotificationUpdateV2 type NotificationUpdate struct { Alert *Alert `json:"alert,omitempty"` ConvectiveOutlook *ConvectiveOutlook `json:"convectiveOutlook,omitempty"` diff --git a/sql/alert_table.go b/sql/alert_table.go index 7c444f0..fe7583c 100644 --- a/sql/alert_table.go +++ b/sql/alert_table.go @@ -15,6 +15,7 @@ import ( var _ IAlertTable = (*PostgresAlertTable)(nil) +// Deprecated: use IAlertTableV2 type IAlertTable interface { common_tables.IIdTable[data_structures.Alert] @@ -25,16 +26,19 @@ type IAlertTable interface { Exists(id string) (bool, error) } +// Deprecated: use PostgresAlertTableV2 type PostgresAlertTable struct { db *sql.DB } +// Deprecated: use NewPostgresAlertTableV2 func NewPostgresAlertTable(db *sql.DB) PostgresAlertTable { return PostgresAlertTable{ db: db, } } +// Deprecated: func (p *PostgresAlertTable) Insert(alert data_structures.Alert) error { //language=SQL query := `INSERT INTO alerts (id, payload) VALUES ($1, $2)` @@ -52,6 +56,7 @@ func (p *PostgresAlertTable) Insert(alert data_structures.Alert) error { return nil } +// Deprecated: func (p *PostgresAlertTable) Select(id string) (*data_structures.Alert, error) { query := `SELECT payload FROM alerts WHERE id = $1` @@ -71,6 +76,7 @@ func (p *PostgresAlertTable) Select(id string) (*data_structures.Alert, error) { return &alert, nil } +// Deprecated: func (p *PostgresAlertTable) SelectAlertsByCode(codes []string) ([]data_structures.Alert, error) { query := ` SELECT payload @@ -111,6 +117,7 @@ func (p *PostgresAlertTable) SelectAlertsByCode(codes []string) ([]data_structur return alerts, nil } +// Deprecated: func (p *PostgresAlertTable) Exists(id string) (bool, error) { query := `SELECT count(id) FROM alerts WHERE id = $1` @@ -129,6 +136,7 @@ func (p *PostgresAlertTable) Exists(id string) (bool, error) { return false, nil } +// Deprecated: func (p *PostgresAlertTable) Delete(id string) error { query := `DELETE FROM alerts WHERE id = $1` @@ -149,6 +157,7 @@ func (p *PostgresAlertTable) Delete(id string) error { return nil } +// Deprecated: func (p *PostgresAlertTable) DeleteExpiredAlerts(id string) error { query := `DELETE FROM alerts WHERE id = $1` diff --git a/sql/convective_outlook_table.go b/sql/convective_outlook_table.go index ad30d14..33015e0 100644 --- a/sql/convective_outlook_table.go +++ b/sql/convective_outlook_table.go @@ -12,6 +12,7 @@ import ( var _ IConvectiveOutlookTable = (*PostgresConvectiveOutlookTable)(nil) +// Deprecated: use IConvectiveOutlookTableV2 type IConvectiveOutlookTable interface { Insert(outlook data_structures.ConvectiveOutlook) error @@ -20,16 +21,19 @@ type IConvectiveOutlookTable interface { SelectLatest(outlookType golang.ConvectiveOutlookType) (*data_structures.ConvectiveOutlook, error) } +// Deprecated: use PostgresConvectiveOutlookTableV2 type PostgresConvectiveOutlookTable struct { db *sql.DB } +// Deprecated: use NewPostgresConvectiveOutlookTableV2 func NewPostgresConvectiveOutlookTable(db *sql.DB) PostgresConvectiveOutlookTable { return PostgresConvectiveOutlookTable{ db: db, } } +// Deprecated: func (p *PostgresConvectiveOutlookTable) Insert(outlook data_structures.ConvectiveOutlook) error { //language=SQL query := `INSERT INTO convectiveOutlookTable (outlookType, outlook) VALUES ($1, $2)` @@ -46,6 +50,7 @@ func (p *PostgresConvectiveOutlookTable) Insert(outlook data_structures.Convecti return nil } +// Deprecated: func (p *PostgresConvectiveOutlookTable) Select(publishedTime time.Time, outlookType golang.ConvectiveOutlookType) (*data_structures.ConvectiveOutlook, error) { query := `SELECT outlook FROM convectiveOutlookTable WHERE outlookType = $1` @@ -68,6 +73,7 @@ func (p *PostgresConvectiveOutlookTable) Select(publishedTime time.Time, outlook return &outlook, nil } +// Deprecated: func (p *PostgresConvectiveOutlookTable) SelectLatest(outlookType golang.ConvectiveOutlookType) (*data_structures.ConvectiveOutlook, error) { query := `SELECT outlook FROM convectiveOutlookTable WHERE outlooktype = $1 ORDER BY (outlook->'features'->0->'properties'->>'VALID')::timestamptz DESC LIMIT 1` diff --git a/sql/mesoscale_discussion_table.go b/sql/mesoscale_discussion_table.go index 3bfff02..020b19d 100644 --- a/sql/mesoscale_discussion_table.go +++ b/sql/mesoscale_discussion_table.go @@ -12,6 +12,7 @@ import ( var _ IPostgresMesoscaleDiscussionTable = (*PostgresMesoscaleDiscussionTable)(nil) +// Deprecated: use IPostgresMesoscaleDiscussionTableV2 type IPostgresMesoscaleDiscussionTable interface { Insert(md data_structures.MesoscaleDiscussion) error @@ -20,16 +21,19 @@ type IPostgresMesoscaleDiscussionTable interface { SelectMDNotInTable(year int, mdsToCheck map[int]bool) ([]int, error) } +// Deprecated: use PostgresMesoscaleDiscussionTableV2 type PostgresMesoscaleDiscussionTable struct { db *sql.DB } +// Deprecated: use NewPostgresMesoscaleDicussionTableV2 func NewPostgresMesoscaleDicussionTable(db *sql.DB) PostgresMesoscaleDiscussionTable { return PostgresMesoscaleDiscussionTable{ db: db, } } +// Deprecated: func (p *PostgresMesoscaleDiscussionTable) Insert(md data_structures.MesoscaleDiscussion) error { //language=SQL query := `INSERT INTO mesoscaleDiscussion (mdNumber, year, affectedArea, rawText) VALUES ($1, $2, $3, $4)` @@ -47,6 +51,7 @@ func (p *PostgresMesoscaleDiscussionTable) Insert(md data_structures.MesoscaleDi return nil } +// Deprecated: func (p *PostgresMesoscaleDiscussionTable) Select(year, mdNumber int) (*data_structures.MesoscaleDiscussion, error) { query := `SELECT mdNumber, year, affectedArea, rawText FROM mesoscaleDiscussion WHERE year = $1 AND mdNumber = $2` @@ -76,6 +81,7 @@ func (p *PostgresMesoscaleDiscussionTable) Select(year, mdNumber int) (*data_str return &md, nil } +// Deprecated: func (p *PostgresMesoscaleDiscussionTable) SelectMDNotInTable(year int, mdsToCheck map[int]bool) ([]int, error) { query := `SELECT mdNumber FROM mesoscaleDiscussion WHERE year = $1` @@ -104,6 +110,7 @@ func (p *PostgresMesoscaleDiscussionTable) SelectMDNotInTable(year int, mdsToChe return mdsNotInTable, nil } +// Deprecated: func (p *PostgresMesoscaleDiscussionTable) Delete(year, mdNumber int) error { query := `DELETE FROM mesoscaleDiscussion WHERE year = $1 AND mdNumber = $2`