Documentation ¶
Overview ¶
Package mongodb is a generated GoMock package.
Index ¶
- type JSON
- type Metadata
- type MetadataMongoDBModel
- type MetadataMongoDBRepository
- func (mmr *MetadataMongoDBRepository) Create(ctx context.Context, collection string, metadata *Metadata) error
- func (mmr *MetadataMongoDBRepository) Delete(ctx context.Context, collection, id string) error
- func (mmr *MetadataMongoDBRepository) FindByEntity(ctx context.Context, collection, id string) (*Metadata, error)
- func (mmr *MetadataMongoDBRepository) FindList(ctx context.Context, collection string, filter http.QueryHeader) ([]*Metadata, error)
- func (mmr *MetadataMongoDBRepository) Update(ctx context.Context, collection, id string, metadata map[string]any) error
- type MockRepository
- func (m *MockRepository) Create(ctx context.Context, collection string, metadata *Metadata) error
- func (m *MockRepository) Delete(ctx context.Context, collection, id string) error
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) FindByEntity(ctx context.Context, collection, id string) (*Metadata, error)
- func (m *MockRepository) FindList(ctx context.Context, collection string, filter http.QueryHeader) ([]*Metadata, error)
- func (m *MockRepository) Update(ctx context.Context, collection, id string, metadata map[string]any) error
- type MockRepositoryMockRecorder
- func (mr *MockRepositoryMockRecorder) Create(ctx, collection, metadata any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Delete(ctx, collection, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindByEntity(ctx, collection, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindList(ctx, collection, filter any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Update(ctx, collection, id, metadata any) *gomock.Call
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶
type Metadata struct { ID primitive.ObjectID EntityID string EntityName string Data JSON CreatedAt time.Time UpdatedAt time.Time }
Metadata is a struct designed to encapsulate payload data.
type MetadataMongoDBModel ¶
type MetadataMongoDBModel struct { ID primitive.ObjectID `bson:"_id,omitempty"` EntityID string `bson:"entity_id"` EntityName string `bson:"entity_name"` Data JSON `bson:"metadata"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` }
MetadataMongoDBModel represents the metadata into mongodb context
func (*MetadataMongoDBModel) FromEntity ¶
func (mmm *MetadataMongoDBModel) FromEntity(md *Metadata) error
FromEntity converts an entity.Metadata to MetadataMongoDBModel
func (*MetadataMongoDBModel) ToEntity ¶
func (mmm *MetadataMongoDBModel) ToEntity() *Metadata
ToEntity converts an MetadataMongoDBModel to entity.Metadata
type MetadataMongoDBRepository ¶
type MetadataMongoDBRepository struct { Database string // contains filtered or unexported fields }
MetadataMongoDBRepository is a MongoDD-specific implementation of the MetadataRepository.
func NewMetadataMongoDBRepository ¶
func NewMetadataMongoDBRepository(mc *mmongo.MongoConnection) *MetadataMongoDBRepository
NewMetadataMongoDBRepository returns a new instance of MetadataMongoDBLRepository using the given MongoDB connection.
func (*MetadataMongoDBRepository) Create ¶
func (mmr *MetadataMongoDBRepository) Create(ctx context.Context, collection string, metadata *Metadata) error
Create inserts a new metadata entity into mongodb.
func (*MetadataMongoDBRepository) Delete ¶
func (mmr *MetadataMongoDBRepository) Delete(ctx context.Context, collection, id string) error
Delete an metadata entity into mongodb.
func (*MetadataMongoDBRepository) FindByEntity ¶
func (mmr *MetadataMongoDBRepository) FindByEntity(ctx context.Context, collection, id string) (*Metadata, error)
FindByEntity retrieves a metadata from the mongodb using the provided entity_id.
func (*MetadataMongoDBRepository) FindList ¶
func (mmr *MetadataMongoDBRepository) FindList(ctx context.Context, collection string, filter http.QueryHeader) ([]*Metadata, error)
FindList retrieves metadata from the mongodb all metadata or a list by specify metadata.
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository is a mock of Repository interface.
func NewMockRepository ¶
func NewMockRepository(ctrl *gomock.Controller) *MockRepository
NewMockRepository creates a new mock instance.
func (*MockRepository) Delete ¶
func (m *MockRepository) Delete(ctx context.Context, collection, id string) error
Delete mocks base method.
func (*MockRepository) EXPECT ¶
func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepository) FindByEntity ¶
func (m *MockRepository) FindByEntity(ctx context.Context, collection, id string) (*Metadata, error)
FindByEntity mocks base method.
func (*MockRepository) FindList ¶
func (m *MockRepository) FindList(ctx context.Context, collection string, filter http.QueryHeader) ([]*Metadata, error)
FindList mocks base method.
type MockRepositoryMockRecorder ¶
type MockRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryMockRecorder is the mock recorder for MockRepository.
func (*MockRepositoryMockRecorder) Create ¶
func (mr *MockRepositoryMockRecorder) Create(ctx, collection, metadata any) *gomock.Call
Create indicates an expected call of Create.
func (*MockRepositoryMockRecorder) Delete ¶
func (mr *MockRepositoryMockRecorder) Delete(ctx, collection, id any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockRepositoryMockRecorder) FindByEntity ¶
func (mr *MockRepositoryMockRecorder) FindByEntity(ctx, collection, id any) *gomock.Call
FindByEntity indicates an expected call of FindByEntity.
type Repository ¶
type Repository interface { Create(ctx context.Context, collection string, metadata *Metadata) error FindList(ctx context.Context, collection string, filter http.QueryHeader) ([]*Metadata, error) FindByEntity(ctx context.Context, collection, id string) (*Metadata, error) Update(ctx context.Context, collection, id string, metadata map[string]any) error Delete(ctx context.Context, collection, id string) error }
Repository provides an interface for operations related on mongodb a metadata entities.