Skip to content

Commit c363c4a

Browse files
sokomishalovmp911de
authored andcommitted
Add RedisScript and PartialUpdate extensions.
Closes #2234
1 parent 9f3c993 commit c363c4a

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.redis.core
17+
18+
/**
19+
* Inline fun variant with reified generics for [PartialUpdate]
20+
*
21+
* @author Mikhael Sokolov
22+
* @since 2.7
23+
*/
24+
@Suppress("FunctionName")
25+
inline fun <reified T : Any> PartialUpdate(id: Any): PartialUpdate<T> =
26+
PartialUpdate.newPartialUpdate(id, T::class.java)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.redis.core.script
17+
18+
import org.springframework.core.io.Resource
19+
20+
21+
/**
22+
* Inline fun variant with reified generics for [RedisScript]
23+
*
24+
* @author Mikhael Sokolov
25+
* @since 2.7
26+
*/
27+
@Suppress("FunctionName")
28+
inline fun <reified T : Any> RedisScript(script: String): RedisScript<T> =
29+
RedisScript.of(script, T::class.java)
30+
31+
/**
32+
* Inline fun variant with reified generics for [RedisScript]
33+
*
34+
* @author Mikhael Sokolov
35+
* @since 2.7
36+
*/
37+
@Suppress("FunctionName")
38+
inline fun <reified T : Any> RedisScript(script: Resource): RedisScript<T> =
39+
RedisScript.of(script, T::class.java)

0 commit comments

Comments
 (0)