From 27dcb81e5f340fe7243c9e5abc6c139714a00352 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 22 Apr 2018 18:44:03 +0200 Subject: [PATCH] [client.keyset] added Getter and Setter 'MigrationCode() uint8' for migration code --- .../schastsp/client/keyset/keyset.go | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/git.xdrm.io/schastsp/client/keyset/keyset.go b/src/git.xdrm.io/schastsp/client/keyset/keyset.go index 5c47d9a..dcc1b53 100644 --- a/src/git.xdrm.io/schastsp/client/keyset/keyset.go +++ b/src/git.xdrm.io/schastsp/client/keyset/keyset.go @@ -183,3 +183,26 @@ func (s *T) Fetch(reader io.Reader) error { return nil } + + +/* (6) Getter/Setter for migration code 'mcode' +* +* @mcode [OPT] New value +* +* @return mcode Migration code +* +---------------------------------------------------------*/ +func (s T) MigrationCode(optional... uint8) uint8 { + + /* (1) If no valid code given -> return current one */ + if len(optional) < 1 || optional[0] > 3 { + return s.mcode + } + + /* (2) Set new code */ + s.mcode = optional[0] + + /* (3) Return new code */ + return s.mcode + +}