Dever v0.0.2
This commit is contained in:
commit
e6e175ebcf
816 files changed
+120349
No files matched your search
@@ -0,0 +1,45 @@
|
||||
parseUuid(value: Text) (out: Uuid?) {
|
||||
out = uuid.parse(value)
|
||||
}
|
||||
|
||||
writeUuid(value: Uuid) (out: Text) {
|
||||
out = uuid.toText(value)
|
||||
}
|
||||
|
||||
rule requiredUuid(value: Uuid?) (out: Uuid)
|
||||
| value | out |
|
||||
| null | fail(Invalid) |
|
||||
| other | value |
|
||||
|
||||
readUuid(value: Text) (out: Uuid) {
|
||||
out = requiredUuid(uuid.parse(value))
|
||||
}
|
||||
|
||||
sameUuid(left: Uuid, right: Uuid) (out: Bool) {
|
||||
out = left == right
|
||||
}
|
||||
|
||||
lookupUuid(values: Map<Uuid, Int>, key: Uuid) (out: Int?) {
|
||||
out = get(values, key)
|
||||
}
|
||||
|
||||
mapUuid(first: Uuid, second: Uuid) (out: Map<Uuid, Int>) {
|
||||
values: Map<Uuid, Int> = {}
|
||||
out = put(put(values, first, 1), second, 2)
|
||||
}
|
||||
|
||||
type Identifier {
|
||||
value: Uuid
|
||||
previous: Uuid?
|
||||
}
|
||||
|
||||
uuidEcho(value: Identifier) (out: Identifier) {
|
||||
out = value
|
||||
}
|
||||
|
||||
uuidJson(value: Identifier) (out: Identifier) {
|
||||
out = dever.json.decode(dever.json.encode(value))
|
||||
}
|
||||
|
||||
cmd echo = app.uuidEcho
|
||||
cmd json = app.uuidJson
|
||||
Reference in new issue
Block a user