Documentation ¶
Overview ¶
Package flattener is a generated GoMock package.
Package flattener is a generated GoMock package.
Index ¶
Constants ¶
const ( FlatCollection = "flats" DbName = "flattenerdb" DbNameTest = "flattenerdbtest" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EdgeSecuence ¶
EdgeSecuence represents the connections between the nodes
type FlatInfo ¶
type FlatInfo struct { ID string `json:"id" bson:"_id,omitempty"` Graph *Graph `bson:"-"` VertexSecuence []VertexSecuence `bson:"vertex_secuence"` MaxDepth int `bson:"max_depth"` ProcessedAt time.Time `bson:"processed_at"` }
FlatInfo represents the structure to be saved in the db
type FlatInfoResponse ¶
type FlatInfoResponse struct { ID string `json:"id"` ProcessedAt time.Time `json:"processed_at"` Unflatted []interface{} `json:"unflatted"` Flatted []interface{} `json:"flatted"` }
FlatResponse represents the client response for GET /flats
type FlatResponse ¶
type FlatResponse struct { MaxDepth int `json:"max_depth"` Data []interface{} `json:"flatted_data"` }
FlatResponse represents the client response for POST /flats
type Gateway ¶
type Gateway interface { // FlatResponse will try to flat an array of mixed simple values an will save a FlatInfo // returns a FlatResponse with the flatted array and the max depth FlatResponse([]interface{}) (FlatResponse, apierrors.RestErr) // GetFlats will return a FlatInfoResponse that contains -> // id: auto-generated by the db; // processed_at: is the date when the process was made; // flatted: the original array flatted; // unflatted: the original request array; GetFlats() ([]FlatInfoResponse, apierrors.RestErr) }
func NewGateway ¶
type Graph ¶
Graph contains all the information about the array knows how to flat and unflat an array
func BuildGraphFromVertexSecuence ¶
func BuildGraphFromVertexSecuence(vertexSecuence []VertexSecuence) (*Graph, apierrors.RestErr)
func NewDirectedGraph ¶
func NewDirectedGraph() *Graph
func (*Graph) GetVertexSecuence ¶
func (g *Graph) GetVertexSecuence() []VertexSecuence
GetVertexSecuence build the secuence necesary to be saved in db to be use to rebuild the Graph and the array
type Handler ¶
func NewHandler ¶
type MockGateway ¶
type MockGateway struct {
// contains filtered or unexported fields
}
MockGateway is a mock of Gateway interface.
func NewMockGateway ¶
func NewMockGateway(ctrl *gomock.Controller) *MockGateway
NewMockGateway creates a new mock instance.
func (*MockGateway) EXPECT ¶
func (m *MockGateway) EXPECT() *MockGatewayMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockGateway) FlatResponse ¶
func (m *MockGateway) FlatResponse(arg0 []interface{}) (FlatResponse, apierrors.RestErr)
FlatResponse mocks base method.
func (*MockGateway) GetFlats ¶
func (m *MockGateway) GetFlats() ([]FlatInfoResponse, apierrors.RestErr)
GetFlats mocks base method.
type MockGatewayMockRecorder ¶
type MockGatewayMockRecorder struct {
// contains filtered or unexported fields
}
MockGatewayMockRecorder is the mock recorder for MockGateway.
func (*MockGatewayMockRecorder) FlatResponse ¶
func (mr *MockGatewayMockRecorder) FlatResponse(arg0 interface{}) *gomock.Call
FlatResponse indicates an expected call of FlatResponse.
func (*MockGatewayMockRecorder) GetFlats ¶
func (mr *MockGatewayMockRecorder) GetFlats() *gomock.Call
GetFlats indicates an expected call of GetFlats.
type MockStorage ¶
type MockStorage struct {
// contains filtered or unexported fields
}
MockStorage is a mock of Storage interface.
func NewMockStorage ¶
func NewMockStorage(ctrl *gomock.Controller) *MockStorage
NewMockStorage creates a new mock instance.
func (*MockStorage) EXPECT ¶
func (m *MockStorage) EXPECT() *MockStorageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockStorageMockRecorder ¶
type MockStorageMockRecorder struct {
// contains filtered or unexported fields
}
MockStorageMockRecorder is the mock recorder for MockStorage.
type Storage ¶
type Storage interface {
// contains filtered or unexported methods
}
Storage will execute all de CRUD operations flat_info related
func NewStorage ¶
func NewTestStorage ¶
type Vertex ¶
Vertex represents the nodes in the Graph and the connection between each other
func (*Vertex) GetVertexSecuence ¶
func (v *Vertex) GetVertexSecuence() VertexSecuence
GetVertexSecuence is called by Graph
type VertexSecuence ¶
type VertexSecuence struct { Key int `bson:"key"` DataInfo DataInfo `bson:"data"` Edges []int `json:"edges"` }
VertexSecuence contains all the nodes information to restore the flatted array with the EdgeSecuence