I hereby claim:
- I am delabassee on github.
- I am delabassee (https://keybase.io/delabassee) on keybase.
- I have a public key ASD_7dggiH5zvn5UOvyo4sz1wrO67x4GqgkDSYYo9861XQo
To claim this, I am signing this object:
def name = System.in.newReader().getText() | |
if (name?.trim()) | |
println "Hello ${name}" | |
else | |
println "Hello World" |
FROM groovy:alpine | |
WORKDIR /function | |
COPY src/function.groovy . | |
CMD ["groovy", "function.groovy"] |
I hereby claim:
To claim this, I am signing this object:
import com.fnproject.fn.testing.* | |
import org.junit.* | |
import kotlin.test.assertEquals | |
class HelloFunctionTest { | |
@Rule @JvmField | |
val fn = FnTestingRule.createDefault() | |
@Test |
import com.delabassee.Country | |
fun country(input: String): List<Country> = when { | |
input.isEmpty() -> Country.getAll() | |
else -> Country.getAll().filteredOrAll { | |
it.name.contains(input.trim(), true) | |
} | |
} | |
private fun <T> List<T>.filteredOrAll(predicate: (T) -> Boolean): List<T> { |
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | |
import com.delabassee.Country | |
fun country(input: String): String { | |
return jacksonObjectMapper().writeValueAsString( listCountries(input) ) | |
} | |
fun listCountries(input: String): List<Country> = when { | |
input.isEmpty() -> Country.getAll() | |
else -> Country.getAll().filteredOrAll { |
myfunc/ | |
├── func.yaml | |
├── pom.xml | |
└── src | |
├── main | |
│ └── kotlin | |
│ └── HelloFunction.kt | |
└── test | |
└── kotlin | |
└── HelloFunctionTest.kt |
package com.fn.example | |
import com.fnproject.fn.testing.* | |
import org.junit.* | |
import kotlin.test.assertEquals | |
class HelloFunctionTest { | |
@Rule @JvmField | |
val fn = FnTestingRule.createDefault() |
package com.fn.example | |
fun hello(input: String) = when { | |
input.isEmpty() -> ("Hello, world!") | |
else -> ("Hello, ${input}") | |
} |
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.example.fn</groupId> | |
<artifactId>hello</artifactId> | |
<version>1.0.0</version> | |
<properties> |