mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
35 lines
1.0 KiB
Bash
Executable File
35 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Generate definition_gen.go from definition.go.
|
|
|
|
set -e
|
|
|
|
cat <<EOF
|
|
// Code generated by definition_gen.sh. DO NOT EDIT.
|
|
|
|
package schema
|
|
|
|
import "akvorado/common/helpers/bimap"
|
|
|
|
var columnNameMap = bimap.New(map[ColumnKey]string{
|
|
$(sed -En '/.*ColumnKey = iota/,/^[[:space:]]+ColumnLast/p' common/schema/definition.go \
|
|
| sed \$d \
|
|
| sed -En 's/^[[:space:]]+Column//p' \
|
|
| awk '{ print "Column"$1": \""$1"\","}')
|
|
})
|
|
|
|
|
|
var columnReverseTable = [...]ColumnKey{
|
|
$(sed -En '/.*ColumnKey = iota/,/^[[:space:]]ColumnLast/p' common/schema/definition.go \
|
|
| sed \$d \
|
|
| sed -En 's/^[[:space:]]+(Column[^ ]+).*/\1/p' \
|
|
| sed -E \
|
|
-e 's/(ColumnDst(ASPath|Communities|LargeCommunities|[123]..AS))/\1: 0,/;t' \
|
|
-e 's/(ColumnIn)([A-Z0-9].*)/ColumnOut\2: \1\2,/;t' \
|
|
-e 's/(ColumnOut)([A-Z0-9].*)/ColumnIn\2: \1\2,/;t' \
|
|
-e 's/(ColumnSrc)([A-Z0-9].*)/ColumnDst\2: \1\2,/;t' \
|
|
-e 's/(ColumnDst)([A-Z0-9].*)/ColumnSrc\2: \1\2,/;t' \
|
|
-e 's/(.*)/\1: \1,/')
|
|
}
|
|
EOF
|