-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #525 from waahhh/feature/add-string-functions-trim
Add String functions(�trim)
- Loading branch information
Showing
29 changed files
with
1,512 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/TrimFromStep.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression | ||
|
||
import com.linecorp.kotlinjdsl.SinceJdsl | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressionable | ||
|
||
@SinceJdsl("3.1.0") | ||
interface TrimFromStep { | ||
/** | ||
* Creates a from in a trim expression. | ||
*/ | ||
@SinceJdsl("3.1.0") | ||
fun from(value: String): Expressionable<String> | ||
|
||
/** | ||
* Creates a from in a trim expression. | ||
*/ | ||
@SinceJdsl("3.1.0") | ||
fun from(value: Expressionable<String>): Expressionable<String> | ||
} |
23 changes: 23 additions & 0 deletions
23
dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimBothBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
internal data class TrimBothBuilder( | ||
private val character: Expression<Char>? = null, | ||
) { | ||
private lateinit var value: Expression<String> | ||
|
||
fun from(value: Expression<String>): TrimBothBuilder { | ||
this.value = value | ||
|
||
return this | ||
} | ||
|
||
fun build(): Expression<String> { | ||
return Expressions.trimBoth( | ||
character = character, | ||
value = value, | ||
) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimBothDsl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.dsl.jpql.expression.TrimFromStep | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressionable | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
@PublishedApi | ||
internal data class TrimBothDsl( | ||
private val builder: TrimBothBuilder, | ||
) : TrimFromStep, Expressionable<String> { | ||
constructor( | ||
character: Expression<Char>? = null, | ||
) : this(TrimBothBuilder(character)) | ||
|
||
override fun from(value: String): Expressionable<String> { | ||
builder.from(Expressions.value(value)) | ||
|
||
return this | ||
} | ||
|
||
override fun from(value: Expressionable<String>): Expressionable<String> { | ||
builder.from(value.toExpression()) | ||
|
||
return this | ||
} | ||
|
||
override fun toExpression(): Expression<String> { | ||
return builder.build() | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
internal data class TrimBuilder( | ||
private val character: Expression<Char>? = null, | ||
) { | ||
private lateinit var value: Expression<String> | ||
|
||
fun from(value: Expression<String>): TrimBuilder { | ||
this.value = value | ||
|
||
return this | ||
} | ||
|
||
fun build(): Expression<String> { | ||
return Expressions.trim( | ||
character = character, | ||
value = value, | ||
) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimDsl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.dsl.jpql.expression.TrimFromStep | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressionable | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
@PublishedApi | ||
internal data class TrimDsl( | ||
private val builder: TrimBuilder, | ||
) : TrimFromStep, Expressionable<String> { | ||
constructor( | ||
character: Expression<Char>? = null, | ||
) : this(TrimBuilder(character)) | ||
|
||
override fun from(value: String): Expressionable<String> { | ||
builder.from(Expressions.value(value)) | ||
|
||
return this | ||
} | ||
|
||
override fun from(value: Expressionable<String>): Expressionable<String> { | ||
builder.from(value.toExpression()) | ||
|
||
return this | ||
} | ||
|
||
override fun toExpression(): Expression<String> { | ||
return builder.build() | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimLeadingBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
internal data class TrimLeadingBuilder( | ||
private val character: Expression<Char>? = null, | ||
) { | ||
private lateinit var value: Expression<String> | ||
|
||
fun from(value: Expression<String>): TrimLeadingBuilder { | ||
this.value = value | ||
|
||
return this | ||
} | ||
|
||
fun build(): Expression<String> { | ||
return Expressions.trimLeading( | ||
character = character, | ||
value = value, | ||
) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimLeadingDsl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.dsl.jpql.expression.TrimFromStep | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressionable | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
@PublishedApi | ||
internal data class TrimLeadingDsl( | ||
private val builder: TrimLeadingBuilder, | ||
) : TrimFromStep, Expressionable<String> { | ||
constructor( | ||
character: Expression<Char>? = null, | ||
) : this(TrimLeadingBuilder(character)) | ||
|
||
override fun from(value: String): Expressionable<String> { | ||
builder.from(Expressions.value(value)) | ||
|
||
return this | ||
} | ||
|
||
override fun from(value: Expressionable<String>): Expressionable<String> { | ||
builder.from(value.toExpression()) | ||
|
||
return this | ||
} | ||
|
||
override fun toExpression(): Expression<String> { | ||
return builder.build() | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...l/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimTrailingBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
internal data class TrimTrailingBuilder( | ||
private val character: Expression<Char>? = null, | ||
) { | ||
private lateinit var value: Expression<String> | ||
|
||
fun from(value: Expression<String>): TrimTrailingBuilder { | ||
this.value = value | ||
|
||
return this | ||
} | ||
|
||
fun build(): Expression<String> { | ||
return Expressions.trimTrailing( | ||
character = character, | ||
value = value, | ||
) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/impl/TrimTrailingDsl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.linecorp.kotlinjdsl.dsl.jpql.expression.impl | ||
|
||
import com.linecorp.kotlinjdsl.dsl.jpql.expression.TrimFromStep | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressionable | ||
import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions | ||
|
||
@PublishedApi | ||
internal data class TrimTrailingDsl( | ||
private val builder: TrimTrailingBuilder, | ||
) : TrimFromStep, Expressionable<String> { | ||
constructor( | ||
character: Expression<Char>? = null, | ||
) : this(TrimTrailingBuilder(character)) | ||
|
||
override fun from(value: String): Expressionable<String> { | ||
builder.from(Expressions.value(value)) | ||
|
||
return this | ||
} | ||
|
||
override fun from(value: Expressionable<String>): Expressionable<String> { | ||
builder.from(value.toExpression()) | ||
|
||
return this | ||
} | ||
|
||
override fun toExpression(): Expression<String> { | ||
return builder.build() | ||
} | ||
} |
Oops, something went wrong.