Passed
Pull Request — master (#1470)
by Tolga
02:39
created

database.NoopContinuousToken.Encode   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
package database
2
3
// EncodedContinuousToken -
4
type EncodedContinuousToken interface {
5
	// String returns the string representation of the continuous token.
6
	String() string
7
	// Decode decodes the continuous token from a string
8
	Decode() (ContinuousToken, error)
9
}
10
11
// ContinuousToken -
12
type ContinuousToken interface {
13
	// Encode encodes the continuous token to a string.
14
	Encode() EncodedContinuousToken
15
}
16
17
type (
18
	NoopContinuousToken struct {
19
		Value string
20
	}
21
	NoopEncodedContinuousToken struct {
22
		Value string
23
	}
24
)
25
26
// NewNoopContinuousToken - Creates a new continuous token
27
func NewNoopContinuousToken() ContinuousToken {
28
	return &NoopContinuousToken{
29
		Value: "",
30
	}
31
}
32
33
// Encode - Encodes the token to a string
34
func (t NoopContinuousToken) Encode() EncodedContinuousToken {
35
	return NoopEncodedContinuousToken{
36
		Value: "",
37
	}
38
}
39
40
// Decode decodes the token from a string
41
func (t NoopEncodedContinuousToken) Decode() (ContinuousToken, error) {
42
	return NoopContinuousToken{
43
		Value: "",
44
	}, nil
45
}
46
47
// Decode decodes the token from a string
48
func (t NoopEncodedContinuousToken) String() string {
49
	return ""
50
}
51