Skip to content

Commit

Permalink
Merge branch 'master' into rename-file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored Jun 27, 2024
2 parents 46ba90a + 0e51830 commit 9076a37
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 88 deletions.
4 changes: 2 additions & 2 deletions clients/bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const (
describeNameCol = "column_name"
describeTypeCol = "data_type"
describeCommentCol = "description"
// Storage Write API is limited to 10 MiB, subtract 50 KiB to account for request overhead.
maxRequestByteSize = (10 * 1024 * 1024) - (50 * 1024)
// Storage Write API is limited to 10 MiB, subtract 250 KiB to account for request overhead.
maxRequestByteSize = (10 * 1024 * 1024) - (250 * 1024)
)

type Store struct {
Expand Down
4 changes: 2 additions & 2 deletions clients/redshift/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package redshift
import (
"fmt"

_ "github.com/lib/pq"
_ "github.com/jackc/pgx/v5/stdlib"

"github.com/artie-labs/transfer/clients/redshift/dialect"
"github.com/artie-labs/transfer/clients/shared"
Expand Down Expand Up @@ -129,7 +129,7 @@ func LoadRedshift(cfg config.Config, _store *db.Store) (*Store, error) {
cfg.Redshift.Host, cfg.Redshift.Port, cfg.Redshift.Username,
cfg.Redshift.Password, cfg.Redshift.Database)

store, err := db.Open("postgres", connStr)
store, err := db.Open("pgx", connStr)
if err != nil {
return nil, err
}
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ require (
github.com/cockroachdb/apd/v3 v3.2.1
github.com/getsentry/sentry-go v0.27.0
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.6.0
github.com/jessevdk/go-flags v1.5.0
github.com/lib/pq v1.10.9
github.com/lmittmann/tint v1.0.4
github.com/mattn/go-isatty v0.0.20
github.com/microsoft/go-mssqldb v1.7.1
Expand Down Expand Up @@ -91,6 +91,9 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/asmfmt v1.3.2 // indirect
github.com/klauspost/compress v1.16.7 // indirect
Expand Down
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY=
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jcmturner/gofork v0.0.0-20180107083740-2aebee971930/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
Expand Down Expand Up @@ -448,6 +456,7 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down
40 changes: 8 additions & 32 deletions lib/cdc/util/optional_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,38 +64,14 @@ func TestGetOptionalSchema(t *testing.T) {
"boolean_test": typing.Boolean,
"bool_test": typing.Boolean,
"bit_test": typing.Boolean,
"numeric_test": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(decimal.PrecisionNotSpecified, decimal.DefaultScale),
},
"numeric_5": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(5, 0),
},
"numeric_5_2": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(5, 2),
},
"numeric_5_6": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(5, 6),
},
"numeric_5_0": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(5, 0),
},
"numeric_39_0": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(39, 0),
},
"numeric_39_2": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(39, 2),
},
"numeric_39_6": {
Kind: typing.EDecimal.Kind,
ExtendedDecimalDetails: decimal.NewDecimalDetails(39, 6),
},
"numeric_test": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(decimal.PrecisionNotSpecified, decimal.DefaultScale)),
"numeric_5": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(5, 0)),
"numeric_5_0": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(5, 0)),
"numeric_5_2": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(5, 2)),
"numeric_5_6": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(5, 6)),
"numeric_39_0": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(39, 0)),
"numeric_39_2": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(39, 2)),
"numeric_39_6": typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(39, 6)),
},
},
}
Expand Down
8 changes: 2 additions & 6 deletions lib/debezium/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,12 @@ func (f Field) ToKindDetails() typing.KindDetails {
precision = *precisionPtr
}

eDecimal := typing.EDecimal
eDecimal.ExtendedDecimalDetails = decimal.NewDecimalDetails(precision, scale)
return eDecimal
return typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(precision, scale))
case KafkaVariableNumericType:
// For variable numeric types, we are defaulting to a scale of 5
// This is because scale is not specified at the column level, rather at the row level
// It shouldn't matter much anyway since the column type we are creating is `TEXT` to avoid boundary errors.
eDecimal := typing.EDecimal
eDecimal.ExtendedDecimalDetails = decimal.NewDecimalDetails(decimal.PrecisionNotSpecified, decimal.DefaultScale)
return eDecimal
return typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(decimal.PrecisionNotSpecified, decimal.DefaultScale))
}

switch f.Type {
Expand Down
8 changes: 2 additions & 6 deletions lib/debezium/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,8 @@ func TestField_ToKindDetails(t *testing.T) {
expectedKindDetails typing.KindDetails
}

eDecimal := typing.EDecimal
eDecimal.ExtendedDecimalDetails = decimal.NewDecimalDetails(decimal.PrecisionNotSpecified, decimal.DefaultScale)

kafkaDecimalType := typing.EDecimal
kafkaDecimalType.ExtendedDecimalDetails = decimal.NewDecimalDetails(10, 5)

eDecimal := typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(decimal.PrecisionNotSpecified, decimal.DefaultScale))
kafkaDecimalType := typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(10, 5))
tcs := []_tc{
{
name: "int16",
Expand Down
6 changes: 2 additions & 4 deletions lib/optimization/event_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ func TestTableData_UpdateInMemoryColumnsFromDestination(t *testing.T) {
tableDataCols.AddColumn(columns.NewColumn("ext_datetime", typing.String))
tableDataCols.AddColumn(columns.NewColumn("ext_dec", typing.String))

extDecimalType := typing.EDecimal
extDecimalType.ExtendedDecimalDetails = decimal.NewDecimalDetails(22, 2)
extDecimalType := typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(22, 2))
tableDataCols.AddColumn(columns.NewColumn("ext_dec_filled", extDecimalType))

tableDataCols.AddColumn(columns.NewColumn(strCol, typing.String))
Expand Down Expand Up @@ -120,8 +119,7 @@ func TestTableData_UpdateInMemoryColumnsFromDestination(t *testing.T) {
assert.True(t, isOk)
assert.Equal(t, typing.String, extDecCol.KindDetails)

extDecimal := typing.EDecimal
extDecimal.ExtendedDecimalDetails = decimal.NewDecimalDetails(30, 2)
extDecimal := typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(30, 2))
assert.NoError(t, tableData.MergeColumnsFromDestination(columns.NewColumn("ext_dec", extDecimal)))
// Now it should be ext decimal type
extDecCol, isOk = tableData.inMemoryColumns.GetColumn("ext_dec")
Expand Down
3 changes: 1 addition & 2 deletions lib/parquetutil/parse_values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
)

func TestParseValue(t *testing.T) {
eDecimal := typing.EDecimal
eDecimal.ExtendedDecimalDetails = decimal.NewDecimalDetails(30, 5)
eDecimal := typing.NewDecimalDetailsFromTemplate(typing.EDecimal, decimal.NewDetails(30, 5))

eTime := typing.ETime
eTime.ExtendedTimeDetails = &ext.Time
Expand Down
6 changes: 3 additions & 3 deletions lib/typing/decimal/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/artie-labs/transfer/lib/numbers"
)

func (d *DecimalDetails) isNumeric() bool {
func (d Details) isNumeric() bool {
if d.precision == PrecisionNotSpecified {
return false
}
Expand All @@ -20,7 +20,7 @@ func (d *DecimalDetails) isNumeric() bool {
return numbers.BetweenEq(max(1, d.scale), d.scale+29, d.precision)
}

func (d *DecimalDetails) isBigNumeric() bool {
func (d Details) isBigNumeric() bool {
if d.precision == PrecisionNotSpecified {
return false
}
Expand All @@ -34,7 +34,7 @@ func (d *DecimalDetails) isBigNumeric() bool {
return numbers.BetweenEq(max(1, d.scale), d.scale+38, d.precision)
}

func (d *DecimalDetails) toKind(maxPrecision int32, exceededKind string) string {
func (d Details) toKind(maxPrecision int32, exceededKind string) string {
if d.precision > maxPrecision || d.precision == PrecisionNotSpecified {
return exceededKind
}
Expand Down
4 changes: 2 additions & 2 deletions lib/typing/decimal/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ func (d *Decimal) String() string {
return d.value.Text('f')
}

func (d *Decimal) Details() DecimalDetails {
return DecimalDetails{scale: d.Scale(), precision: d.precision}
func (d *Decimal) Details() Details {
return Details{scale: d.Scale(), precision: d.precision}
}
28 changes: 14 additions & 14 deletions lib/typing/decimal/decimal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ func TestNewDecimal(t *testing.T) {

func TestNewDecimalWithPrecision(t *testing.T) {
// Precision = -1 (PrecisionNotSpecified):
assert.Equal(t, DecimalDetails{scale: 2, precision: -1}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), PrecisionNotSpecified).Details())
assert.Equal(t, Details{scale: 2, precision: -1}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), PrecisionNotSpecified).Details())
// Precision = scale:
assert.Equal(t, DecimalDetails{scale: 2, precision: 2}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), 2).Details())
assert.Equal(t, Details{scale: 2, precision: 2}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), 2).Details())
// Precision < scale:
assert.Equal(t, DecimalDetails{scale: 2, precision: 3}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), 1).Details())
assert.Equal(t, Details{scale: 2, precision: 3}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), 1).Details())
// Precision > scale:
assert.Equal(t, DecimalDetails{scale: 2, precision: 4}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), 4).Details())
assert.Equal(t, Details{scale: 2, precision: 4}, NewDecimalWithPrecision(numbers.MustParseDecimal("12.34"), 4).Details())
}

func TestDecimal_Scale(t *testing.T) {
Expand All @@ -36,16 +36,16 @@ func TestDecimal_Scale(t *testing.T) {

func TestDecimal_Details(t *testing.T) {
// -1 precision (PrecisionNotSpecified):
assert.Equal(t, DecimalDetails{scale: 0, precision: -1}, NewDecimal(numbers.MustParseDecimal("0")).Details())
assert.Equal(t, DecimalDetails{scale: 0, precision: -1}, NewDecimal(numbers.MustParseDecimal("12345")).Details())
assert.Equal(t, DecimalDetails{scale: 0, precision: -1}, NewDecimal(numbers.MustParseDecimal("-12")).Details())
assert.Equal(t, DecimalDetails{scale: 2, precision: -1}, NewDecimal(numbers.MustParseDecimal("12345.12")).Details())
assert.Equal(t, DecimalDetails{scale: 3, precision: -1}, NewDecimal(numbers.MustParseDecimal("-12345.123")).Details())
assert.Equal(t, Details{scale: 0, precision: -1}, NewDecimal(numbers.MustParseDecimal("0")).Details())
assert.Equal(t, Details{scale: 0, precision: -1}, NewDecimal(numbers.MustParseDecimal("12345")).Details())
assert.Equal(t, Details{scale: 0, precision: -1}, NewDecimal(numbers.MustParseDecimal("-12")).Details())
assert.Equal(t, Details{scale: 2, precision: -1}, NewDecimal(numbers.MustParseDecimal("12345.12")).Details())
assert.Equal(t, Details{scale: 3, precision: -1}, NewDecimal(numbers.MustParseDecimal("-12345.123")).Details())

// 10 precision:
assert.Equal(t, DecimalDetails{scale: 0, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("0"), 10).Details())
assert.Equal(t, DecimalDetails{scale: 0, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("12345"), 10).Details())
assert.Equal(t, DecimalDetails{scale: 0, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("-12"), 10).Details())
assert.Equal(t, DecimalDetails{scale: 2, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("12345.12"), 10).Details())
assert.Equal(t, DecimalDetails{scale: 3, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("-12345.123"), 10).Details())
assert.Equal(t, Details{scale: 0, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("0"), 10).Details())
assert.Equal(t, Details{scale: 0, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("12345"), 10).Details())
assert.Equal(t, Details{scale: 0, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("-12"), 10).Details())
assert.Equal(t, Details{scale: 2, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("12345.12"), 10).Details())
assert.Equal(t, Details{scale: 3, precision: 10}, NewDecimalWithPrecision(numbers.MustParseDecimal("-12345.123"), 10).Details())
}
18 changes: 9 additions & 9 deletions lib/typing/decimal/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
)

type DecimalDetails struct {
type Details struct {
scale int32
precision int32
}

func NewDecimalDetails(precision int32, scale int32) *DecimalDetails {
func NewDetails(precision int32, scale int32) Details {
if scale > precision && precision != PrecisionNotSpecified {
// Note: -1 precision means it's not specified.

Expand All @@ -18,38 +18,38 @@ func NewDecimalDetails(precision int32, scale int32) *DecimalDetails {
precision = scale + 1
}

return &DecimalDetails{
return Details{
scale: scale,
precision: precision,
}
}

func (d DecimalDetails) Scale() int32 {
func (d Details) Scale() int32 {
return d.scale
}

func (d DecimalDetails) Precision() int32 {
func (d Details) Precision() int32 {
return d.precision
}

// SnowflakeKind - is used to determine whether a NUMERIC data type should be a STRING or NUMERIC(p, s).
func (d *DecimalDetails) SnowflakeKind() string {
func (d Details) SnowflakeKind() string {
return d.toKind(MaxPrecisionBeforeString, "STRING")
}

// MsSQLKind - Has the same limitation as Redshift
// Spec: https://learn.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql?view=sql-server-ver16#arguments
func (d *DecimalDetails) MsSQLKind() string {
func (d Details) MsSQLKind() string {
return d.toKind(MaxPrecisionBeforeString, "TEXT")
}

// RedshiftKind - is used to determine whether a NUMERIC data type should be a TEXT or NUMERIC(p, s).
func (d *DecimalDetails) RedshiftKind() string {
func (d Details) RedshiftKind() string {
return d.toKind(MaxPrecisionBeforeString, "TEXT")
}

// BigQueryKind - is inferring logic from: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#decimal_types
func (d *DecimalDetails) BigQueryKind() string {
func (d Details) BigQueryKind() string {
if d.isNumeric() {
return fmt.Sprintf("NUMERIC(%v, %v)", d.precision, d.scale)
} else if d.isBigNumeric() {
Expand Down
2 changes: 1 addition & 1 deletion lib/typing/decimal/details_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestDecimalDetailsKind(t *testing.T) {
}

for _, testCase := range testCases {
d := NewDecimalDetails(testCase.Precision, testCase.Scale)
d := NewDetails(testCase.Precision, testCase.Scale)
assert.Equal(t, testCase.ExpectedSnowflakeKind, d.SnowflakeKind(), testCase.Name)
assert.Equal(t, testCase.ExpectedRedshiftKind, d.RedshiftKind(), testCase.Name)
assert.Equal(t, testCase.ExpectedBigQueryKind, d.BigQueryKind(), testCase.Name)
Expand Down
4 changes: 1 addition & 3 deletions lib/typing/numeric.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ func ParseNumeric(parts []string) KindDetails {
return Integer
}

eDec := EDecimal
eDec.ExtendedDecimalDetails = decimal.NewDecimalDetails(parsedNumbers[0], parsedNumbers[1])
return eDec
return NewDecimalDetailsFromTemplate(EDecimal, decimal.NewDetails(parsedNumbers[0], parsedNumbers[1]))
}
10 changes: 9 additions & 1 deletion lib/typing/typing.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Settings struct {
type KindDetails struct {
Kind string
ExtendedTimeDetails *ext.NestedKind
ExtendedDecimalDetails *decimal.DecimalDetails
ExtendedDecimalDetails *decimal.Details

// Optional kind details metadata
OptionalStringPrecision *int
Expand Down Expand Up @@ -66,6 +66,14 @@ var (
}
)

func NewDecimalDetailsFromTemplate(details KindDetails, decimalDetails decimal.Details) KindDetails {
if details.ExtendedDecimalDetails == nil {
details.ExtendedDecimalDetails = &decimalDetails
}

return details
}

func NewKindDetailsFromTemplate(details KindDetails, extendedType ext.ExtendedTimeKindType) KindDetails {
if details.ExtendedTimeDetails == nil {
details.ExtendedTimeDetails = &ext.NestedKind{}
Expand Down

0 comments on commit 9076a37

Please sign in to comment.