File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ // Package namer represent interface to templates creation.
2+ package namer
3+
4+ import (
5+ "github.com/tarantool/go-storage/kv"
6+ )
7+
8+ // KeyType represents key types.
9+ type KeyType int
10+
11+ const (
12+ // KeyTypeValue represents data type.
13+ KeyTypeValue KeyType = iota + 1
14+ // KeyTypeHash represents hash of the data type.
15+ KeyTypeHash
16+ // KeyTypeSignature represents signature of the data type.
17+ KeyTypeSignature
18+ )
19+
20+ // Key implements internal realization.
21+ type Key struct {
22+ Name string // Object identificator.
23+ Type KeyType // Type of the object.
24+ Property string // Additional information (version/algorithm).
25+ }
26+
27+ // Namer represents keys naming strategy.
28+ type Namer interface {
29+ GenerateNames (name string ) []string // Object's keys generation.
30+ ParseNames (names []string ) []Key // Convert names into keys.
31+ }
32+
33+ // Generator generates signer K/V pairs.
34+ // Implementation should use `generic` and will used for strong typing of the solution.
35+ type Generator [T any ] interface {
36+ Generate (name string , value T ) ([]kv.KeyValue , error )
37+ }
38+
39+ // Validator validates and build the object from K/V.
40+ type Validator [T any ] interface {
41+ Validate (pairs []kv.KeyValue ) (T , error )
42+ }
You can’t perform that action at this time.
0 commit comments