repository

package
v0.0.0-...-ff2bd9c Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package repository is a generated GoMock package.

Index

Constants

View Source
const (
	ASC  OrderBy = "ASC"
	DESC OrderBy = "DESC"

	EQUAL_WITH         ConditionalOperation = "="
	LIKE               ConditionalOperation = "LIKE"
	ILIKE              ConditionalOperation = "ILIKE"
	GREATER_THAN       ConditionalOperation = ">"
	GREATER_THAN_EQUAL ConditionalOperation = ">="
	LESS_THAN          ConditionalOperation = "<"
	LESS_THAN_EQUAL    ConditionalOperation = "<="
	IS                 ConditionalOperation = "IS"
	NOT                ConditionalOperation = "NOT"
	IS_NOT             ConditionalOperation = "IS NOT"
	IN                 ConditionalOperation = "IN"

	AND RelationalOperation = "AND"
	OR  RelationalOperation = "OR"
)

Variables

This section is empty.

Functions

func AreAllNumbers

func AreAllNumbers(arr []interface{}) bool

func AreAllUUIDs

func AreAllUUIDs(arr []interface{}) bool

func CopyObject

func CopyObject(src interface{}) (interface{}, error)

CopyObject creates a new object with the same field values as the source object.

func CopySliceOfPointers

func CopySliceOfPointers(slice interface{}) (interface{}, error)

func CopySliceOfPointersWithIdentitySeparated

func CopySliceOfPointersWithIdentitySeparated(sourceSlice interface{}, slice []interface{}) (interface{}, error)

func GetStructPropertyAsString

func GetStructPropertyAsString(inputStruct interface{}, propertyName string) (string, error)

GetStructPropertyAsString retrieves the value of a specific property from a struct and converts it to a string. If the property is of type uuid.UUID, it's converted to a string.

func GetTableName

func GetTableName(model interface{}) string

func IsMapStringInterface

func IsMapStringInterface(obj interface{}) bool

func IsValidOperations

func IsValidOperations(conditionalOperations []ConditionalOperation, relationalOperations []RelationalOperation, params map[string]interface{}) bool

func StringJoin

func StringJoin(arr []interface{}, encapsulation string) string

func ToSnakeCase

func ToSnakeCase(s string) string
func ToSnakeCase(s string) string {
	var result []string
	for i, r := range s {
		if i > 0 && unicode.IsUpper(r) {
			result = append(result, "_")
		}
		result = append(result, strings.ToLower(string(r)))
	}
	return strings.Join(result, "")
}

func UpdatePropertyValue

func UpdatePropertyValue(obj interface{}, propertyName string, newValue interface{}) error

Types

type ConditionalOperation

type ConditionalOperation string

type GenericRepositoryInterface

type GenericRepositoryInterface interface {
	FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []ConditionalOperation, relationalOperations []RelationalOperation, page int, limit int, result interface{}) (interface{}, error)
	FindOne(ctx context.Context, key string, value interface{}, result interface{}) (interface{}, error)
	FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)
	Insert(ctx context.Context, data interface{}) (interface{}, error)
	Update(ctx context.Context, data interface{}) (interface{}, error)
	Delete(ctx context.Context, data interface{}) (interface{}, error)
	Upsert(ctx context.Context, data interface{}) (interface{}, error)
	BulkInsert(ctx context.Context, data interface{}) (interface{}, error)
	BulkUpsert(ctx context.Context, data interface{}) (interface{}, error)
	Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)
}

type ImmutableGenericRepositoryInterface

type ImmutableGenericRepositoryInterface interface {
	FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []ConditionalOperation, relationalOperations []RelationalOperation, page int, limit int, result interface{}) (interface{}, error)
	FindOne(ctx context.Context, key string, value interface{}, result interface{}) (interface{}, error)
	FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)
	Insert(ctx context.Context, data interface{}) (interface{}, error)
	BulkInsert(ctx context.Context, data interface{}) (interface{}, error)
	Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)
}

type MockGenericRepositoryInterface

type MockGenericRepositoryInterface struct {
	// contains filtered or unexported fields
}

MockGenericRepositoryInterface is a mock of GenericRepositoryInterface interface.

func NewMockGenericRepositoryInterface

func NewMockGenericRepositoryInterface(ctrl *gomock.Controller) *MockGenericRepositoryInterface

NewMockGenericRepositoryInterface creates a new mock instance.

func (*MockGenericRepositoryInterface) BulkInsert

func (m *MockGenericRepositoryInterface) BulkInsert(ctx context.Context, data interface{}) (interface{}, error)

BulkInsert mocks base method.

func (*MockGenericRepositoryInterface) BulkUpsert

func (m *MockGenericRepositoryInterface) BulkUpsert(ctx context.Context, data interface{}) (interface{}, error)

BulkUpsert mocks base method.

func (*MockGenericRepositoryInterface) Delete

func (m *MockGenericRepositoryInterface) Delete(ctx context.Context, data interface{}) (interface{}, error)

Delete mocks base method.

func (*MockGenericRepositoryInterface) EXPECT

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

func (*MockGenericRepositoryInterface) FindAll

func (m *MockGenericRepositoryInterface) FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []ConditionalOperation, relationalOperations []RelationalOperation, page, limit int, result interface{}) (interface{}, error)

FindAll mocks base method.

func (*MockGenericRepositoryInterface) FindByID

func (m *MockGenericRepositoryInterface) FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)

FindByID mocks base method.

func (*MockGenericRepositoryInterface) FindOne

func (m *MockGenericRepositoryInterface) FindOne(ctx context.Context, key string, value, result interface{}) (interface{}, error)

FindOne mocks base method.

func (*MockGenericRepositoryInterface) Insert

func (m *MockGenericRepositoryInterface) Insert(ctx context.Context, data interface{}) (interface{}, error)

Insert mocks base method.

func (*MockGenericRepositoryInterface) Query

func (m *MockGenericRepositoryInterface) Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)

Query mocks base method.

func (*MockGenericRepositoryInterface) Update

func (m *MockGenericRepositoryInterface) Update(ctx context.Context, data interface{}) (interface{}, error)

Update mocks base method.

func (*MockGenericRepositoryInterface) Upsert

func (m *MockGenericRepositoryInterface) Upsert(ctx context.Context, data interface{}) (interface{}, error)

Upsert mocks base method.

type MockGenericRepositoryInterfaceMockRecorder

type MockGenericRepositoryInterfaceMockRecorder struct {
	// contains filtered or unexported fields
}

MockGenericRepositoryInterfaceMockRecorder is the mock recorder for MockGenericRepositoryInterface.

func (*MockGenericRepositoryInterfaceMockRecorder) BulkInsert

func (mr *MockGenericRepositoryInterfaceMockRecorder) BulkInsert(ctx, data interface{}) *gomock.Call

BulkInsert indicates an expected call of BulkInsert.

func (*MockGenericRepositoryInterfaceMockRecorder) BulkUpsert

func (mr *MockGenericRepositoryInterfaceMockRecorder) BulkUpsert(ctx, data interface{}) *gomock.Call

BulkUpsert indicates an expected call of BulkUpsert.

func (*MockGenericRepositoryInterfaceMockRecorder) Delete

func (mr *MockGenericRepositoryInterfaceMockRecorder) Delete(ctx, data interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockGenericRepositoryInterfaceMockRecorder) FindAll

func (mr *MockGenericRepositoryInterfaceMockRecorder) FindAll(ctx, params, conditionalOperations, relationalOperations, page, limit, result interface{}) *gomock.Call

FindAll indicates an expected call of FindAll.

func (*MockGenericRepositoryInterfaceMockRecorder) FindByID

func (mr *MockGenericRepositoryInterfaceMockRecorder) FindByID(ctx, id, result interface{}) *gomock.Call

FindByID indicates an expected call of FindByID.

func (*MockGenericRepositoryInterfaceMockRecorder) FindOne

func (mr *MockGenericRepositoryInterfaceMockRecorder) FindOne(ctx, key, value, result interface{}) *gomock.Call

FindOne indicates an expected call of FindOne.

func (*MockGenericRepositoryInterfaceMockRecorder) Insert

func (mr *MockGenericRepositoryInterfaceMockRecorder) Insert(ctx, data interface{}) *gomock.Call

Insert indicates an expected call of Insert.

func (*MockGenericRepositoryInterfaceMockRecorder) Query

func (mr *MockGenericRepositoryInterfaceMockRecorder) Query(ctx, query, params, result interface{}) *gomock.Call

Query indicates an expected call of Query.

func (*MockGenericRepositoryInterfaceMockRecorder) Update

func (mr *MockGenericRepositoryInterfaceMockRecorder) Update(ctx, data interface{}) *gomock.Call

Update indicates an expected call of Update.

func (*MockGenericRepositoryInterfaceMockRecorder) Upsert

func (mr *MockGenericRepositoryInterfaceMockRecorder) Upsert(ctx, data interface{}) *gomock.Call

Upsert indicates an expected call of Upsert.

type MockImmutableGenericRepositoryInterface

type MockImmutableGenericRepositoryInterface struct {
	// contains filtered or unexported fields
}

MockImmutableGenericRepositoryInterface is a mock of ImmutableGenericRepositoryInterface interface.

func NewMockImmutableGenericRepositoryInterface

func NewMockImmutableGenericRepositoryInterface(ctrl *gomock.Controller) *MockImmutableGenericRepositoryInterface

NewMockImmutableGenericRepositoryInterface creates a new mock instance.

func (*MockImmutableGenericRepositoryInterface) BulkInsert

func (m *MockImmutableGenericRepositoryInterface) BulkInsert(ctx context.Context, data interface{}) (interface{}, error)

BulkInsert mocks base method.

func (*MockImmutableGenericRepositoryInterface) EXPECT

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

func (*MockImmutableGenericRepositoryInterface) FindAll

func (m *MockImmutableGenericRepositoryInterface) FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []ConditionalOperation, relationalOperations []RelationalOperation, page, limit int, result interface{}) (interface{}, error)

FindAll mocks base method.

func (*MockImmutableGenericRepositoryInterface) FindByID

func (m *MockImmutableGenericRepositoryInterface) FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)

FindByID mocks base method.

func (*MockImmutableGenericRepositoryInterface) FindOne

func (m *MockImmutableGenericRepositoryInterface) FindOne(ctx context.Context, key string, value, result interface{}) (interface{}, error)

FindOne mocks base method.

func (*MockImmutableGenericRepositoryInterface) Insert

func (m *MockImmutableGenericRepositoryInterface) Insert(ctx context.Context, data interface{}) (interface{}, error)

Insert mocks base method.

func (*MockImmutableGenericRepositoryInterface) Query

func (m *MockImmutableGenericRepositoryInterface) Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)

Query mocks base method.

type MockImmutableGenericRepositoryInterfaceMockRecorder

type MockImmutableGenericRepositoryInterfaceMockRecorder struct {
	// contains filtered or unexported fields
}

MockImmutableGenericRepositoryInterfaceMockRecorder is the mock recorder for MockImmutableGenericRepositoryInterface.

func (*MockImmutableGenericRepositoryInterfaceMockRecorder) BulkInsert

func (mr *MockImmutableGenericRepositoryInterfaceMockRecorder) BulkInsert(ctx, data interface{}) *gomock.Call

BulkInsert indicates an expected call of BulkInsert.

func (*MockImmutableGenericRepositoryInterfaceMockRecorder) FindAll

func (mr *MockImmutableGenericRepositoryInterfaceMockRecorder) FindAll(ctx, params, conditionalOperations, relationalOperations, page, limit, result interface{}) *gomock.Call

FindAll indicates an expected call of FindAll.

func (*MockImmutableGenericRepositoryInterfaceMockRecorder) FindByID

func (mr *MockImmutableGenericRepositoryInterfaceMockRecorder) FindByID(ctx, id, result interface{}) *gomock.Call

FindByID indicates an expected call of FindByID.

func (*MockImmutableGenericRepositoryInterfaceMockRecorder) FindOne

func (mr *MockImmutableGenericRepositoryInterfaceMockRecorder) FindOne(ctx, key, value, result interface{}) *gomock.Call

FindOne indicates an expected call of FindOne.

func (*MockImmutableGenericRepositoryInterfaceMockRecorder) Insert

func (mr *MockImmutableGenericRepositoryInterfaceMockRecorder) Insert(ctx, data interface{}) *gomock.Call

Insert indicates an expected call of Insert.

func (*MockImmutableGenericRepositoryInterfaceMockRecorder) Query

func (mr *MockImmutableGenericRepositoryInterfaceMockRecorder) Query(ctx, query, params, result interface{}) *gomock.Call

Query indicates an expected call of Query.

type MockMutableGenericRepositoryInterface

type MockMutableGenericRepositoryInterface struct {
	// contains filtered or unexported fields
}

MockMutableGenericRepositoryInterface is a mock of MutableGenericRepositoryInterface interface.

func NewMockMutableGenericRepositoryInterface

func NewMockMutableGenericRepositoryInterface(ctrl *gomock.Controller) *MockMutableGenericRepositoryInterface

NewMockMutableGenericRepositoryInterface creates a new mock instance.

func (*MockMutableGenericRepositoryInterface) BulkUpsert

func (m *MockMutableGenericRepositoryInterface) BulkUpsert(ctx context.Context, data interface{}) (interface{}, error)

BulkUpsert mocks base method.

func (*MockMutableGenericRepositoryInterface) Delete

func (m *MockMutableGenericRepositoryInterface) Delete(ctx context.Context, data interface{}) (interface{}, error)

Delete mocks base method.

func (*MockMutableGenericRepositoryInterface) EXPECT

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

func (*MockMutableGenericRepositoryInterface) FindAll

func (m *MockMutableGenericRepositoryInterface) FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []ConditionalOperation, relationalOperations []RelationalOperation, page, limit int, result interface{}) (interface{}, error)

FindAll mocks base method.

func (*MockMutableGenericRepositoryInterface) FindByID

func (m *MockMutableGenericRepositoryInterface) FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)

FindByID mocks base method.

func (*MockMutableGenericRepositoryInterface) FindOne

func (m *MockMutableGenericRepositoryInterface) FindOne(ctx context.Context, key string, value, result interface{}) (interface{}, error)

FindOne mocks base method.

func (*MockMutableGenericRepositoryInterface) Insert

func (m *MockMutableGenericRepositoryInterface) Insert(ctx context.Context, data interface{}) (interface{}, error)

Insert mocks base method.

func (*MockMutableGenericRepositoryInterface) Query

func (m *MockMutableGenericRepositoryInterface) Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)

Query mocks base method.

func (*MockMutableGenericRepositoryInterface) Update

func (m *MockMutableGenericRepositoryInterface) Update(ctx context.Context, data interface{}) (interface{}, error)

Update mocks base method.

func (*MockMutableGenericRepositoryInterface) Upsert

func (m *MockMutableGenericRepositoryInterface) Upsert(ctx context.Context, data interface{}) (interface{}, error)

Upsert mocks base method.

type MockMutableGenericRepositoryInterfaceMockRecorder

type MockMutableGenericRepositoryInterfaceMockRecorder struct {
	// contains filtered or unexported fields
}

MockMutableGenericRepositoryInterfaceMockRecorder is the mock recorder for MockMutableGenericRepositoryInterface.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) BulkUpsert

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) BulkUpsert(ctx, data interface{}) *gomock.Call

BulkUpsert indicates an expected call of BulkUpsert.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) Delete

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) Delete(ctx, data interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) FindAll

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) FindAll(ctx, params, conditionalOperations, relationalOperations, page, limit, result interface{}) *gomock.Call

FindAll indicates an expected call of FindAll.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) FindByID

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) FindByID(ctx, id, result interface{}) *gomock.Call

FindByID indicates an expected call of FindByID.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) FindOne

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) FindOne(ctx, key, value, result interface{}) *gomock.Call

FindOne indicates an expected call of FindOne.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) Insert

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) Insert(ctx, data interface{}) *gomock.Call

Insert indicates an expected call of Insert.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) Query

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) Query(ctx, query, params, result interface{}) *gomock.Call

Query indicates an expected call of Query.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) Update

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) Update(ctx, data interface{}) *gomock.Call

Update indicates an expected call of Update.

func (*MockMutableGenericRepositoryInterfaceMockRecorder) Upsert

func (mr *MockMutableGenericRepositoryInterfaceMockRecorder) Upsert(ctx, data interface{}) *gomock.Call

Upsert indicates an expected call of Upsert.

type MutableGenericRepositoryInterface

type MutableGenericRepositoryInterface interface {
	FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []ConditionalOperation, relationalOperations []RelationalOperation, page int, limit int, result interface{}) (interface{}, error)
	FindOne(ctx context.Context, key string, value interface{}, result interface{}) (interface{}, error)
	FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)
	Insert(ctx context.Context, data interface{}) (interface{}, error)
	Update(ctx context.Context, data interface{}) (interface{}, error)
	Delete(ctx context.Context, data interface{}) (interface{}, error)
	Upsert(ctx context.Context, data interface{}) (interface{}, error)
	BulkUpsert(ctx context.Context, data interface{}) (interface{}, error)
	Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)
}

type OrderBy

type OrderBy string

type RelationalOperation

type RelationalOperation string

type RepositoryError

type RepositoryError error
var (
	ErrBadParameters         RepositoryError = errors.New("parameters or conditional operation or relational operation number is not valid")
	ErrNotImplement          RepositoryError = errors.New("the operation or the function is not implemented")
	ErrNotFound              RepositoryError = errors.New("not found")
	ErrOperationIsNotAllowed RepositoryError = errors.New("the parameters for memcached operation must be all keyIndetifiers or all filtered parameters")
	ErrConflict              RepositoryError = errors.New("conflict")
	ErrPropertyNotFound      RepositoryError = errors.New("property not found")
	ErrPropertyTypeNotMatch  RepositoryError = errors.New("property type not match")
)

Directories

Path Synopsis
repositorytest
We create this empty file as the workaround for this bug: https://github.com/golang/go/issues/27333
We create this empty file as the workaround for this bug: https://github.com/golang/go/issues/27333
sql
repositorytest
We create this empty file as the workaround for this bug: https://github.com/golang/go/issues/27333
We create this empty file as the workaround for this bug: https://github.com/golang/go/issues/27333

Jump to

Keyboard shortcuts

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