Skip to content

Commit ce9af36

Browse files
committed
update README.md
1 parent afed0be commit ce9af36

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

README.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,44 @@
22

33
> Check annotated functions arguments. If they don't change - return last result.
44
> Functions could be logged.
5+
> Support extra custom action on function processing
6+
7+
import compiler plugin:
58

6-
import compiler plugin:
79
```kotlin
810
dependencies {
9-
implementation("io.github.stslex:compiler-plugin:0.0.1")
10-
kotlinCompilerPluginClasspath("io.github.stslex:compiler-plugin:0.0.1")
11+
implementation("io.github.stslex:compiler-plugin:$version")
12+
kotlinCompilerPluginClasspath("io.github.stslex:compiler-plugin:$version")
1113
}
1214
```
1315

14-
in code:
16+
in code (all annotation properties are optional):
17+
1518
```kotlin
19+
1620
import io.github.stslex.compiler_plugin.DistinctUntilChangeFun
1721

18-
@DistinctUntilChangeFun
19-
fun setUserName(username: String){
20-
// function logic
22+
@DistinctUntilChangeFun(
23+
logging = true,
24+
singletonAllow = false,
25+
name = "set_user_second_name",
26+
action = TestLogger::class
27+
)
28+
fun setUserName(username: String) {
29+
// function logic
2130
}
2231
```
32+
33+
for custom actions:
34+
35+
```kotlin
36+
class TestLogger : Action {
37+
38+
override fun invoke(
39+
name: String,
40+
isProcess: Boolean
41+
) {
42+
println("test action $name procession: $isProcess")
43+
}
44+
}
45+
```

0 commit comments

Comments
 (0)