audit

package
v1.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package audit is a generated GoMock package.

Index

Constants

View Source
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

func (*AuditMongoDBRepository) FindByID

func (mar *AuditMongoDBRepository) FindByID(ctx context.Context, collection string, auditID AuditID) (*Audit, error)

FindByID retrieves audit information from mongodb searching by organization and ledger id

func (*AuditMongoDBRepository) FindOne

func (mar *AuditMongoDBRepository) FindOne(ctx context.Context, collection string, auditID AuditID) (*Audit, error)

FindOne retrieves audit information from mongodb searching by organization and ledger id

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) Create

func (m *MockRepository) Create(arg0 context.Context, arg1 string, arg2 *Audit) error

Create mocks base method.

func (*MockRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepository) FindByID

func (m *MockRepository) FindByID(arg0 context.Context, arg1 string, arg2 AuditID) (*Audit, error)

FindByID mocks base method.

func (*MockRepository) FindOne

func (m *MockRepository) FindOne(arg0 context.Context, arg1 string, arg2 AuditID) (*Audit, error)

FindOne 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(arg0, arg1, arg2 any) *gomock.Call

Create indicates an expected call of Create.

func (*MockRepositoryMockRecorder) FindByID

func (mr *MockRepositoryMockRecorder) FindByID(arg0, arg1, arg2 any) *gomock.Call

FindByID indicates an expected call of FindByID.

func (*MockRepositoryMockRecorder) FindOne

func (mr *MockRepositoryMockRecorder) FindOne(arg0, arg1, arg2 any) *gomock.Call

FindOne indicates an expected call of FindOne.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL