From aa609561d56f6602f6b54fbfdbddaa031305d980 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 6 Nov 2018 18:01:36 +0100 Subject: [PATCH] create common configuration format interface --- cnf/common.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 cnf/common.go diff --git a/cnf/common.go b/cnf/common.go new file mode 100644 index 0000000..bf1b6b2 --- /dev/null +++ b/cnf/common.go @@ -0,0 +1,20 @@ +package cnf + +// Field generic representation (root, branch or leaf) +type Field struct { + // Label of the current field + Label string + // Value of the current field + Value string + // Children of the current field or NIL if none + Children []Field +} + +// ConfigurationFormat is the common interface for all configuration parser +type ConfigurationFormat interface { + // Get the value of a field if it exists + Get(string) (string, bool) + + // Set the value of a field if exists + Set(string, string) bool +}