Skip to content

Commit 7489256

Browse files
authored
Rename SearchAttributeKey::forString to SearchAttributeKey::forText (#565)
1 parent 2596ea5 commit 7489256

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

src/Common/SearchAttributes/SearchAttributeKey.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Temporal\Common\SearchAttributes\SearchAttributeKey\IntValue;
1111
use Temporal\Common\SearchAttributes\SearchAttributeKey\KeywordListValue;
1212
use Temporal\Common\SearchAttributes\SearchAttributeKey\KeywordValue;
13-
use Temporal\Common\SearchAttributes\SearchAttributeKey\StringValue;
13+
use Temporal\Common\SearchAttributes\SearchAttributeKey\TextValue;
1414
use Temporal\Common\SearchAttributes\SearchAttributeUpdate\ValueSet;
1515

1616
/**
@@ -61,9 +61,9 @@ public static function forKeyword(string $name): KeywordValue
6161
/**
6262
* @param non-empty-string $name
6363
*/
64-
public static function forString(string $name): StringValue
64+
public static function forText(string $name): TextValue
6565
{
66-
return new StringValue($name);
66+
return new TextValue($name);
6767
}
6868

6969
/**
@@ -92,7 +92,7 @@ public static function for(ValueType $tryFrom, string $name): self
9292
ValueType::Int => self::forInteger($name),
9393
ValueType::Float => self::forFloat($name),
9494
ValueType::Keyword => self::forKeyword($name),
95-
ValueType::String => self::forString($name),
95+
ValueType::Text => self::forText($name),
9696
ValueType::Datetime => self::forDatetime($name),
9797
ValueType::KeywordList => self::forKeywordList($name),
9898
};

src/Common/SearchAttributes/SearchAttributeKey/StringValue.php renamed to src/Common/SearchAttributes/SearchAttributeKey/TextValue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @psalm-immutable
1313
*/
14-
final class StringValue extends SearchAttributeKey
14+
final class TextValue extends SearchAttributeKey
1515
{
1616
public function valueSet(string|\Stringable $value): SearchAttributeUpdate
1717
{
@@ -20,6 +20,6 @@ public function valueSet(string|\Stringable $value): SearchAttributeUpdate
2020

2121
public function getType(): ValueType
2222
{
23-
return ValueType::String;
23+
return ValueType::Text;
2424
}
2525
}

src/Common/SearchAttributes/ValueType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ enum ValueType: string
1414
case Int = 'int64';
1515
case Keyword = 'keyword';
1616
case KeywordList = 'keyword_list';
17-
case String = 'string';
17+
case Text = 'string';
1818
case Datetime = 'datetime';
1919
}

src/Common/TypedSearchAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function withUntypedValue(string $name, mixed $value): self
112112
\is_float($value) => $this->withValue(SearchAttributeKey::forFloat($name), $value),
113113
\is_array($value) => $this->withValue(SearchAttributeKey::forKeywordList($name), $value),
114114
$value instanceof \Stringable,
115-
\is_string($value) => $this->withValue(SearchAttributeKey::forString($name), $value),
115+
\is_string($value) => $this->withValue(SearchAttributeKey::forText($name), $value),
116116
$value instanceof \DateTimeInterface => $this->withValue(SearchAttributeKey::forDatetime($name), $value),
117117
default => throw new \InvalidArgumentException('Unsupported value type.'),
118118
};

testing/src/Environment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function startTemporalServer(
8383
ValueType::Int => 'int',
8484
ValueType::Keyword => 'keyword',
8585
ValueType::KeywordList => 'keywordList',
86-
ValueType::String => 'text',
86+
ValueType::Text => 'text',
8787
ValueType::Datetime => 'datetime',
8888
};
8989
}

tests/Acceptance/App/Runtime/TemporalStarter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public function start(): void
2525
}
2626

2727
$this->environment->startTemporalServer(searchAttributes: [
28-
'foo' => ValueType::String->value,
28+
'foo' => ValueType::Text->value,
2929
'bar' => ValueType::Int->value,
3030
'testBool' => ValueType::Bool,
3131
'testInt' => ValueType::Int,
3232
'testFloat' => ValueType::Float,
33-
'testString' => ValueType::String,
33+
'testText' => ValueType::Text,
3434
'testKeyword' => ValueType::Keyword,
3535
'testKeywordList' => ValueType::KeywordList,
3636
'testDatetime' => ValueType::Datetime,

tests/Acceptance/Extra/Workflow/SearchAttributesTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testStartWithSearchAttributes(
3131
'testFloat' => 1.1,
3232
'testInt' => -2,
3333
'testBool' => false,
34-
'testString' => 'foo',
34+
'testText' => 'foo',
3535
'testKeyword' => 'bar',
3636
'testKeywordList' => ['baz'],
3737
'testDatetime' => new \DateTimeImmutable('2019-01-01T00:00:00Z'),
@@ -50,7 +50,7 @@ public function testStartWithSearchAttributes(
5050
'testBool' => false,
5151
'testInt' => -2,
5252
'testFloat' => 1.1,
53-
'testString' => 'foo',
53+
'testText' => 'foo',
5454
'testKeyword' => 'bar',
5555
'testKeywordList' => ['baz'],
5656
'testDatetime' => (new \DateTimeImmutable('2019-01-01T00:00:00Z'))
@@ -71,7 +71,7 @@ public function testUpsertSearchAttributes(
7171
'testFloat' => 1.1,
7272
'testInt' => -2,
7373
'testBool' => false,
74-
'testString' => 'foo',
74+
'testText' => 'foo',
7575
'testKeyword' => 'bar',
7676
'testKeywordList' => ['baz'],
7777
'testDatetime' => new \DateTimeImmutable('2019-01-01T00:00:00Z'),
@@ -82,7 +82,7 @@ public function testUpsertSearchAttributes(
8282
'testBool' => true,
8383
'testInt' => 42,
8484
'testFloat' => 1.0,
85-
'testString' => 'foo bar baz',
85+
'testText' => 'foo bar baz',
8686
'testKeyword' => 'foo-bar-baz',
8787
'testKeywordList' => ['foo', 'bar', 'baz'],
8888
'testDatetime' => '2021-01-01T00:00:00+00:00',
@@ -134,7 +134,7 @@ public function testUpsertSearchAttributesUnset(
134134
'testFloat' => 1.1,
135135
'testInt' => -2,
136136
'testBool' => false,
137-
'testString' => 'foo',
137+
'testText' => 'foo',
138138
'testKeyword' => 'bar',
139139
'testKeywordList' => ['baz'],
140140
'testDatetime' => new \DateTimeImmutable('2019-01-01T00:00:00Z'),
@@ -144,7 +144,7 @@ public function testUpsertSearchAttributesUnset(
144144
$toSend = [
145145
'testInt' => 42,
146146
'testBool' => null,
147-
'testString' => 'bar',
147+
'testText' => 'bar',
148148
'testKeyword' => null,
149149
'testKeywordList' => ['red'],
150150
'testDatetime' => null,

tests/Acceptance/Extra/Workflow/TypedSearchAttributesTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testStartWithTypedSearchAttributes(
3434
->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1)
3535
->withValue(SearchAttributeKey::forInteger('testInt'), -2)
3636
->withValue(SearchAttributeKey::forBool('testBool'), false)
37-
->withValue(SearchAttributeKey::forString('testString'), 'foo')
37+
->withValue(SearchAttributeKey::forText('testText'), 'foo')
3838
->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar')
3939
->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz'])
4040
->withValue(
@@ -56,7 +56,7 @@ public function testStartWithTypedSearchAttributes(
5656
'testBool' => false,
5757
'testInt' => -2,
5858
'testFloat' => 1.1,
59-
'testString' => 'foo',
59+
'testText' => 'foo',
6060
'testKeyword' => 'bar',
6161
'testKeywordList' => ['baz'],
6262
'testDatetime' => (new \DateTimeImmutable('2019-01-01T00:00:00Z'))
@@ -78,7 +78,7 @@ public function testUpsertTypedSearchAttributes(
7878
->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1)
7979
->withValue(SearchAttributeKey::forInteger('testInt'), -2)
8080
->withValue(SearchAttributeKey::forBool('testBool'), false)
81-
->withValue(SearchAttributeKey::forString('testString'), 'foo')
81+
->withValue(SearchAttributeKey::forText('testText'), 'foo')
8282
->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar')
8383
->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz'])
8484
->withValue(
@@ -92,7 +92,7 @@ public function testUpsertTypedSearchAttributes(
9292
'testBool' => true,
9393
'testInt' => 42,
9494
'testFloat' => 1.0,
95-
'testString' => 'foo bar baz',
95+
'testText' => 'foo bar baz',
9696
'testKeyword' => 'foo-bar-baz',
9797
'testKeywordList' => ['foo', 'bar', 'baz'],
9898
'testDatetime' => '2021-01-01T00:00:00+00:00',
@@ -145,7 +145,7 @@ public function testUpsertTypedSearchAttributesUnset(
145145
->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1)
146146
->withValue(SearchAttributeKey::forInteger('testInt'), -2)
147147
->withValue(SearchAttributeKey::forBool('testBool'), false)
148-
->withValue(SearchAttributeKey::forString('testString'), 'foo')
148+
->withValue(SearchAttributeKey::forText('testText'), 'foo')
149149
->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar')
150150
->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz'])
151151
->withValue(
@@ -158,7 +158,7 @@ public function testUpsertTypedSearchAttributesUnset(
158158
$toSend = [
159159
'testInt' => 42,
160160
'testBool' => null,
161-
'testString' => 'bar',
161+
'testText' => 'bar',
162162
'testKeyword' => null,
163163
'testKeywordList' => ['red'],
164164
'testDatetime' => null,

tests/Unit/Common/TypedSearchAttributesTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function testFromJsonArray(): void
187187
self::assertSame(42, $collection->get(SearchAttributeKey::forInteger('name3')));
188188
self::assertSame('bar', $collection->get(SearchAttributeKey::forKeyword('name4')));
189189
self::assertSame(3.14, $collection->get(SearchAttributeKey::forFloat('name5')));
190-
self::assertSame('foo', $collection->get(SearchAttributeKey::forString('name6')));
190+
self::assertSame('foo', $collection->get(SearchAttributeKey::forText('name6')));
191191
self::assertInstanceOf(\DateTimeImmutable::class, $collection->get(SearchAttributeKey::forDatetime('name7')));
192192
self::assertSame(
193193
'2021-01-01T00:00:00+00:00',
@@ -212,7 +212,7 @@ public function testFromUntypedCollection(): void
212212
self::assertTrue($collection->get(SearchAttributeKey::forBool('name1')));
213213
self::assertFalse($collection->get(SearchAttributeKey::forBool('name2')));
214214
self::assertSame(42, $collection->get(SearchAttributeKey::forInteger('name3')));
215-
self::assertSame('bar', $collection->get(SearchAttributeKey::forString('name4')));
215+
self::assertSame('bar', $collection->get(SearchAttributeKey::forText('name4')));
216216
self::assertSame(3.14, $collection->get(SearchAttributeKey::forFloat('name5')));
217217
self::assertInstanceOf(\DateTimeImmutable::class, $collection->get(SearchAttributeKey::forDatetime('name7')));
218218
self::assertSame('2021-01-01T00:00:00+00:00', $collection->get(SearchAttributeKey::forDatetime('name7'))->format(DATE_RFC3339));
@@ -225,7 +225,7 @@ public function testValues()
225225
->withValue(SearchAttributeKey::forFloat('testFloat'), 1.1)
226226
->withValue(SearchAttributeKey::forInteger('testInt'), -2)
227227
->withValue(SearchAttributeKey::forBool('testBool'), false)
228-
->withValue(SearchAttributeKey::forString('testString'), 'foo')
228+
->withValue(SearchAttributeKey::forText('testText'), 'foo')
229229
->withValue(SearchAttributeKey::forKeyword('testKeyword'), 'bar')
230230
->withValue(SearchAttributeKey::forKeywordList('testKeywordList'), ['baz'])
231231
->withValue(

0 commit comments

Comments
 (0)