Documentation ¶
Overview ¶
Package audit is a generated GoMock package.
Index ¶
- Constants
- type Audit
- type AuditID
- type AuditMongoDBModel
- type AuditMongoDBRepository
- func (mar *AuditMongoDBRepository) Create(ctx context.Context, collection string, audit *Audit) error
- func (mar *AuditMongoDBRepository) FindByID(ctx context.Context, collection string, auditID AuditID) (*Audit, error)
- func (mar *AuditMongoDBRepository) FindOne(ctx context.Context, collection string, auditID AuditID) (*Audit, error)
- type MockRepository
- func (m *MockRepository) Create(arg0 context.Context, arg1 string, arg2 *Audit) error
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) FindByID(arg0 context.Context, arg1 string, arg2 AuditID) (*Audit, error)
- func (m *MockRepository) FindOne(arg0 context.Context, arg1 string, arg2 AuditID) (*Audit, error)
- type MockRepositoryMockRecorder
- type Repository
Constants ¶
const TreeCollection = "trees"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Audit ¶
type Audit struct { ID AuditID `json:"-"` TreeID int64 Leaves map[string]string CreatedAt time.Time `json:"createdAt"` }
Audit is a struct designed to encapsulate payload data.
type AuditID ¶
type AuditID struct { OrganizationID string `json:"organizationId" bson:"organization_id"` LedgerID string `json:"ledgerId" bson:"ledger_id"` ID string `json:"auditId" bson:"audit_id"` }
AuditID is a struct that represents a composite audit key
type AuditMongoDBModel ¶
type AuditMongoDBModel struct { ID AuditID `bson:"_id"` TreeID int64 `bson:"tree_id"` CreatedAt time.Time `bson:"created_at"` Leaves map[string]string `bson:"leaves"` }
AuditMongoDBModel represents the Audit into mongodb context
func (*AuditMongoDBModel) FromEntity ¶
func (mar *AuditMongoDBModel) FromEntity(md *Audit)
FromEntity converts an entity.Audit to AuditMongoDBModel
func (*AuditMongoDBModel) ToEntity ¶
func (mar *AuditMongoDBModel) ToEntity() *Audit
ToEntity converts an AuditMongoDBModel to entity.Audit
type AuditMongoDBRepository ¶
type AuditMongoDBRepository struct { Database string // contains filtered or unexported fields }
AuditMongoDBRepository is a MongoDD-specific implementation of the AuditRepository.
func NewAuditMongoDBRepository ¶
func NewAuditMongoDBRepository(mc *mmongo.MongoConnection) *AuditMongoDBRepository
NewAuditMongoDBRepository returns a new instance of AuditMongoDBLRepository using the given MongoDB connection.
func (*AuditMongoDBRepository) Create ¶
func (mar *AuditMongoDBRepository) Create(ctx context.Context, collection string, audit *Audit) error
Create inserts a new audit entity into mongodb
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) EXPECT ¶
func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockRepositoryMockRecorder ¶
type MockRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryMockRecorder is the mock recorder for MockRepository.
func (*MockRepositoryMockRecorder) Create ¶
func (mr *MockRepositoryMockRecorder) Create(arg0, arg1, arg2 any) *gomock.Call
Create indicates an expected call of Create.
type Repository ¶
type Repository interface { Create(ctx context.Context, collection string, audit *Audit) error FindOne(ctx context.Context, collection string, auditID AuditID) (*Audit, error) FindByID(ctx context.Context, collection string, auditID AuditID) (*Audit, error) }
Repository provides an interface for operations related on mongodb an audit entities.