Skip to content

Commit

Permalink
Merge pull request #1164 from size12/variant-tuple
Browse files Browse the repository at this point in the history
feat: variant tuple params builder
  • Loading branch information
asmyasnikov authored Mar 26, 2024
2 parents 30d0d7f + 1fec927 commit 0ffb7af
Show file tree
Hide file tree
Showing 7 changed files with 1,339 additions and 588 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Added `Tuple` support for `Variant` in `ydb.ParamsBuilder()`

## v3.60.1
* Added additional traces for coordination service client internals

Expand Down
7 changes: 7 additions & 0 deletions internal/params/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ func (p *Parameter) BeginStruct() *structure {
}
}

func (p *Parameter) BeginVariant() *variant {
return &variant{
parent: p.parent,
name: p.name,
}
}

func (p *Parameter) Text(v string) Builder {
p.value = value.TextValue(v)
p.parent.params = append(p.parent.params, p)
Expand Down
18 changes: 18 additions & 0 deletions internal/params/tuple.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,21 @@ func (t *tupleItem) UUID(v [16]byte) *tuple {

return t.parent
}

func (t *tupleItem) TzDate(v time.Time) *tuple {
t.parent.values = append(t.parent.values, value.TzDateValueFromTime(v))

return t.parent
}

func (t *tupleItem) TzTimestamp(v time.Time) *tuple {
t.parent.values = append(t.parent.values, value.TzTimestampValueFromTime(v))

return t.parent
}

func (t *tupleItem) TzDatetime(v time.Time) *tuple {
t.parent.values = append(t.parent.values, value.TzDatetimeValueFromTime(v))

return t.parent
}
Loading

0 comments on commit 0ffb7af

Please sign in to comment.