Documentation ¶
Index ¶
- Constants
- Variables
- func BoolToUint(v bool) uint8
- func ByteLen(length uint32) uint32
- func GetInsertModeName(mode InsertMode) string
- func GetOpCodeName(op OpCode) string
- func PackBool(w []byte, v bool, mode iproto.PackMode) ([]byte, error)
- func PackDelete(ns uint32, primaryKey [][]byte) []byte
- func PackDeleteFlagsVal(w []byte, ret bool) []byte
- func PackField(w []byte, field []byte) []byte
- func PackFieldNums(w []byte, cnt uint32) []byte
- func PackIndexNum(w []byte, indexnum uint32) []byte
- func PackInsertReplace(ns uint32, insertMode InsertMode, tuple [][]byte) []byte
- func PackKey(w []byte, key [][]byte) []byte
- func PackLimit(w []byte, limit uint32) []byte
- func PackLua(name string, args ...string) []byte
- func PackMockResponse(ome []MockEntities) ([]byte, error)
- func PackOffset(w []byte, offset uint32) []byte
- func PackRequestFlagsVal(w []byte, ret bool, mode InsertMode) []byte
- func PackResopnseStatus(statusCode RetCode, data [][][]byte) ([]byte, error)
- func PackSelect(ns, indexnum, offset, limit uint32, keys [][][]byte) []byte
- func PackSpace(w []byte, space uint32) []byte
- func PackString(w []byte, field string, mode iproto.PackMode) []byte
- func PackTuple(w []byte, keys [][]byte) []byte
- func PackTuples(w []byte, keys [][][]byte) []byte
- func PackUpdate(ns uint32, primaryKey [][]byte, updateOps []Ops) []byte
- func PackedFieldLen(field []byte) uint32
- func PackedKeyLen(keys [][]byte) (length uint32)
- func PackedKeysLen(keys [][]byte) (length uint32)
- func PackedTupleLen(keys [][]byte) (length uint32)
- func PackedTuplesLen(keys [][][]byte) (length uint32)
- func PackedUpdateOpsLen(updateOps []Ops) (length uint32)
- func UintToBool(v uint8) bool
- func UnpackDelete(data []byte) (ns uint32, primaryKey [][]byte, err error)
- func UnpackField(r *bytes.Reader) ([]byte, error)
- func UnpackFieldNums(r *bytes.Reader) (uint32, error)
- func UnpackIndexNum(r *bytes.Reader) (uint32, error)
- func UnpackKey(r *bytes.Reader) ([][]byte, error)
- func UnpackLimit(r *bytes.Reader) (uint32, error)
- func UnpackLua(data []byte) (name string, args [][]byte, err error)
- func UnpackOffset(r *bytes.Reader) (uint32, error)
- func UnpackResopnseStatus(data []byte) (uint32, []byte, error)
- func UnpackSelect(data []byte) (ns, indexnum, offset, limit uint32, keys [][][]byte, err error)
- func UnpackSpace(r *bytes.Reader) (uint32, error)
- func UnpackString(r *bytes.Reader, res *string, mode iproto.PackMode) error
- func UnpackTuple(r *bytes.Reader) ([][]byte, error)
- func UnpackTuples(r *bytes.Reader) ([][][]byte, error)
- func WrapTriggerWithOnUsePromise(trigger func(types []FixtureType) []FixtureType) (wrappedTrigger func(types []FixtureType) []FixtureType, isUsed func() bool)
- type BaseField
- type BoxMode
- type CallMockFixture
- type CheckUsesFixtureType
- type Connection
- type ConnectionOption
- type ConnectionOptions
- type CountFlags
- type DefaultLogger
- func (l *DefaultLogger) Debug(fmt string, args ...any)
- func (l *DefaultLogger) DebugCallRequest(procName string, args [][]byte, fixtures ...CallMockFixture)
- func (l *DefaultLogger) DebugDeleteRequest(ns uint32, primaryKey [][]byte, fixture ...DeleteMockFixture)
- func (l *DefaultLogger) DebugInsertRequest(ns uint32, needRetVal bool, insertMode InsertMode, tuple TupleData, ...)
- func (l *DefaultLogger) DebugSelectRequest(ns uint32, indexnum uint32, offset uint32, limit uint32, keys [][][]byte, ...)
- func (l *DefaultLogger) DebugUpdateRequest(ns uint32, primaryKey [][]byte, updateOps []Ops, fixture ...UpdateMockFixture)
- type DeleteMockFixture
- type FixtureType
- func CreateCallFixture(reqData func(mocks []MockEntities) []byte, respEnt []MockEntities) (FixtureType, error)
- func CreateDeleteFixture(reqData []byte, trigger func([]FixtureType) []FixtureType) FixtureType
- func CreateFixture(id uint32, msg uint8, reqData []byte, respData []byte, ...) FixtureType
- func CreateInsertOrReplaceFixture(entity MockEntities, reqData []byte, trigger func([]FixtureType) []FixtureType) FixtureType
- func CreateSelectFixture(reqData func(mocks []MockEntities) []byte, respEnt []MockEntities) (FixtureType, error)
- func CreateUpdateFixture(reqData []byte, trigger func([]FixtureType) []FixtureType) FixtureType
- type Format
- type InsertMockFixture
- type InsertMode
- type MockEntities
- type MockMockServerLogger
- func (_m *MockMockServerLogger) Debug(fmt string, args ...interface{})
- func (_m *MockMockServerLogger) DebugCallRequest(procName string, args [][]byte, fixtures ...CallMockFixture)
- func (_m *MockMockServerLogger) DebugDeleteRequest(ns uint32, primaryKey [][]byte, fixtures ...DeleteMockFixture)
- func (_m *MockMockServerLogger) DebugInsertRequest(ns uint32, needRetVal bool, insertMode InsertMode, tuple TupleData, ...)
- func (_m *MockMockServerLogger) DebugSelectRequest(ns uint32, indexnum uint32, offset uint32, limit uint32, keys [][][]byte, ...)
- func (_m *MockMockServerLogger) DebugUpdateRequest(ns uint32, primaryKey [][]byte, updateOps []Ops, fixtures ...UpdateMockFixture)
- func (_m *MockMockServerLogger) EXPECT() *MockMockServerLogger_Expecter
- type MockMockServerLogger_DebugCallRequest_Call
- func (_c *MockMockServerLogger_DebugCallRequest_Call) Return() *MockMockServerLogger_DebugCallRequest_Call
- func (_c *MockMockServerLogger_DebugCallRequest_Call) Run(run func(procName string, args [][]byte, fixtures ...CallMockFixture)) *MockMockServerLogger_DebugCallRequest_Call
- func (_c *MockMockServerLogger_DebugCallRequest_Call) RunAndReturn(run func(string, [][]byte, ...CallMockFixture)) *MockMockServerLogger_DebugCallRequest_Call
- type MockMockServerLogger_DebugDeleteRequest_Call
- func (_c *MockMockServerLogger_DebugDeleteRequest_Call) Return() *MockMockServerLogger_DebugDeleteRequest_Call
- func (_c *MockMockServerLogger_DebugDeleteRequest_Call) Run(run func(ns uint32, primaryKey [][]byte, fixtures ...DeleteMockFixture)) *MockMockServerLogger_DebugDeleteRequest_Call
- func (_c *MockMockServerLogger_DebugDeleteRequest_Call) RunAndReturn(run func(uint32, [][]byte, ...DeleteMockFixture)) *MockMockServerLogger_DebugDeleteRequest_Call
- type MockMockServerLogger_DebugInsertRequest_Call
- func (_c *MockMockServerLogger_DebugInsertRequest_Call) Return() *MockMockServerLogger_DebugInsertRequest_Call
- func (_c *MockMockServerLogger_DebugInsertRequest_Call) Run(...) *MockMockServerLogger_DebugInsertRequest_Call
- func (_c *MockMockServerLogger_DebugInsertRequest_Call) RunAndReturn(run func(uint32, bool, InsertMode, TupleData, ...InsertMockFixture)) *MockMockServerLogger_DebugInsertRequest_Call
- type MockMockServerLogger_DebugSelectRequest_Call
- func (_c *MockMockServerLogger_DebugSelectRequest_Call) Return() *MockMockServerLogger_DebugSelectRequest_Call
- func (_c *MockMockServerLogger_DebugSelectRequest_Call) Run(...) *MockMockServerLogger_DebugSelectRequest_Call
- func (_c *MockMockServerLogger_DebugSelectRequest_Call) RunAndReturn(run func(uint32, uint32, uint32, uint32, [][][]byte, ...SelectMockFixture)) *MockMockServerLogger_DebugSelectRequest_Call
- type MockMockServerLogger_DebugUpdateRequest_Call
- func (_c *MockMockServerLogger_DebugUpdateRequest_Call) Return() *MockMockServerLogger_DebugUpdateRequest_Call
- func (_c *MockMockServerLogger_DebugUpdateRequest_Call) Run(...) *MockMockServerLogger_DebugUpdateRequest_Call
- func (_c *MockMockServerLogger_DebugUpdateRequest_Call) RunAndReturn(run func(uint32, [][]byte, []Ops, ...UpdateMockFixture)) *MockMockServerLogger_DebugUpdateRequest_Call
- type MockMockServerLogger_Debug_Call
- func (_c *MockMockServerLogger_Debug_Call) Return() *MockMockServerLogger_Debug_Call
- func (_c *MockMockServerLogger_Debug_Call) Run(run func(fmt string, args ...interface{})) *MockMockServerLogger_Debug_Call
- func (_c *MockMockServerLogger_Debug_Call) RunAndReturn(run func(string, ...interface{})) *MockMockServerLogger_Debug_Call
- type MockMockServerLogger_Expecter
- func (_e *MockMockServerLogger_Expecter) Debug(fmt interface{}, args ...interface{}) *MockMockServerLogger_Debug_Call
- func (_e *MockMockServerLogger_Expecter) DebugCallRequest(procName interface{}, args interface{}, fixtures ...interface{}) *MockMockServerLogger_DebugCallRequest_Call
- func (_e *MockMockServerLogger_Expecter) DebugDeleteRequest(ns interface{}, primaryKey interface{}, fixtures ...interface{}) *MockMockServerLogger_DebugDeleteRequest_Call
- func (_e *MockMockServerLogger_Expecter) DebugInsertRequest(ns interface{}, needRetVal interface{}, insertMode interface{}, ...) *MockMockServerLogger_DebugInsertRequest_Call
- func (_e *MockMockServerLogger_Expecter) DebugSelectRequest(ns interface{}, indexnum interface{}, offset interface{}, limit interface{}, ...) *MockMockServerLogger_DebugSelectRequest_Call
- func (_e *MockMockServerLogger_Expecter) DebugUpdateRequest(ns interface{}, primaryKey interface{}, updateOps interface{}, ...) *MockMockServerLogger_DebugUpdateRequest_Call
- type MockServer
- func (oms *MockServer) DebugFixtureNotFound(msg uint8, req []byte)
- func (oms *MockServer) GetServerHostPort() string
- func (oms *MockServer) Handler(ctx context.Context, c iproto.Conn, p iproto.Packet)
- func (oms *MockServer) ProcessRequest(msg uint8, req []byte) ([]byte, bool)
- func (oms *MockServer) SetFixtures(oft []FixtureType)
- func (oms *MockServer) Start() error
- func (oms *MockServer) Stop() error
- type MockServerLogger
- type MockServerOption
- type ModelStruct
- type NopIprotoLogger
- type OpCode
- type Ops
- type RepositoryDebugMeta
- type RequetsTypeType
- type RetCode
- type SelectMockFixture
- type ServerModeType
- type TupleData
- type UpdateMockFixture
Constants ¶
const ( DefaultTimeout = 20 * time.Millisecond DefaultConnectionTimeout = 20 * time.Millisecond DefaultRedialInterval = 50 * time.Millisecond DefaultPingInterval = 1 * time.Second DefaultPoolSize = 1 )
Константы определяющие дефолтное поведение конектора к octopus-у
const ( SpaceLen uint32 = 4 IndexLen LimitLen OffsetLen FlagsLen FieldNumLen OpsLen OpFieldNumLen OpOpLen = 1 )
const ( RcOK = RetCode(0x0) RcReadOnly = RetCode(0x0401) RcLocked = RetCode(0x0601) RcMemoryIssue = RetCode(0x0701) RcNonMaster = RetCode(0x0102) RcIllegalParams = RetCode(0x0202) RcSecondaryPort = RetCode(0x0301) RcBadIntegrity = RetCode(0x0801) RcUnsupportedCommand = RetCode(0x0a02) RcDuplicate = RetCode(0x2002) RcWrongField = RetCode(0x1e02) RcWrongNumber = RetCode(0x1f02) RcWrongVersion = RetCode(0x2602) RcWalIO = RetCode(0x2702) RcDoesntExists = RetCode(0x3102) RcStoredProcNotDefined = RetCode(0x3202) RcLuaError = RetCode(0x3302) RcTupleExists = RetCode(0x3702) RcDuplicateKey = RetCode(0x3802) )
Variables ¶
var AllFormat = append(append(append( NumericFormat, FloatFormat...), DataFormat...), Bool, )
var AllProcFormat = append(append(append( NumericFormat, FloatFormat...), DataFormat...), Bool, StringArray, ByteArray, )
var DataFormat = []Format{String}
var (
ErrConnection = fmt.Errorf("error dial to box")
)
var FloatFormat = []Format{Float32, Float64}
var NumericFormat = append(UnsignedFormat, Int8, Int16, Int32, Int64, Int)
Functions ¶
func BoolToUint ¶
func GetInsertModeName ¶
func GetInsertModeName(mode InsertMode) string
func GetOpCodeName ¶
func PackDelete ¶
func PackDeleteFlagsVal ¶
func PackFieldNums ¶
func PackIndexNum ¶
func PackInsertReplace ¶
func PackInsertReplace(ns uint32, insertMode InsertMode, tuple [][]byte) []byte
func PackMockResponse ¶
func PackMockResponse(ome []MockEntities) ([]byte, error)
func PackOffset ¶
func PackRequestFlagsVal ¶
func PackRequestFlagsVal(w []byte, ret bool, mode InsertMode) []byte
func PackResopnseStatus ¶
func PackSelect ¶
func PackTuples ¶
func PackedFieldLen ¶
func PackedKeyLen ¶
func PackedKeysLen ¶
func PackedTupleLen ¶
func PackedTuplesLen ¶
func PackedUpdateOpsLen ¶
func UintToBool ¶
func UnpackSelect ¶
func WrapTriggerWithOnUsePromise ¶
func WrapTriggerWithOnUsePromise(trigger func(types []FixtureType) []FixtureType) (wrappedTrigger func(types []FixtureType) []FixtureType, isUsed func() bool)
Types ¶
type BoxMode ¶
type BoxMode uint8
const ( ReplicaMaster BoxMode = iota MasterReplica ReplicaOnly MasterOnly SelectModeDefault = ReplicaMaster )
type CallMockFixture ¶ added in v1.7.0
type CheckUsesFixtureType ¶
type CheckUsesFixtureType uint8
const ( AnyUsesFixtures CheckUsesFixtureType = iota AllFixtureUses AllFixtureUsesOnlyOnce )
Константы для проверки использования фикстур
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func Box ¶ added in v1.6.0
func Box(ctx context.Context, shard int, instType activerecord.ShardInstanceType, configPath string, optionCreator func(activerecord.ShardInstanceConfig) (activerecord.OptionInterface, error)) (*Connection, error)
Box - возвращает коннектор для БД TODO - сделать статистику по используемым инстансам - прикрутить локальный пингер и исключать недоступные инстансы
func GetConnection ¶
func GetConnection(ctx context.Context, octopusOpts *ConnectionOptions) (*Connection, error)
func (*Connection) Call ¶
func (c *Connection) Call(ctx context.Context, rt RequetsTypeType, data []byte) ([]byte, error)
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) Done ¶
func (c *Connection) Done() <-chan struct{}
func (*Connection) Info ¶
func (c *Connection) Info() string
func (*Connection) InstanceMode ¶
func (c *Connection) InstanceMode() any
type ConnectionOption ¶
type ConnectionOption interface {
// contains filtered or unexported methods
}
ConnectionOption - интерфейс которому должны соответствовать опции передаваемые в конструктор
func WithIntervals ¶
func WithIntervals(redial, maxRedial, ping time.Duration) ConnectionOption
WithIntervals - опция для изменения интервалов
func WithPoolLogger ¶ added in v1.7.0
func WithPoolLogger(logger iproto.Logger) ConnectionOption
WithPoolLogger - опция для логера конекшен пула
func WithPoolSize ¶
func WithPoolSize(size int) ConnectionOption
WithPoolSize - опция для изменения размера пулла подключений
func WithTimeout ¶
func WithTimeout(request, connection time.Duration) ConnectionOption
WithTimeout - опция для изменений таймаутов
type ConnectionOptions ¶
type ConnectionOptions struct { Mode ServerModeType // contains filtered or unexported fields }
ConnectionOptions - опции используемые для подключения
func NewOptions ¶
func NewOptions(server string, mode ServerModeType, opts ...ConnectionOption) (*ConnectionOptions, error)
NewOptions - cоздание структуры с опциями и дефолтными значениями. Для мидификации значений по умолчанию, надо передавать опции в конструктор
func (*ConnectionOptions) GetConnectionID ¶
func (o *ConnectionOptions) GetConnectionID() string
GetConnectionID - получение ConnecitionID. После первого получения, больше нельзя его модифицировать. Можно только новый Options создать
func (*ConnectionOptions) InstanceMode ¶
func (o *ConnectionOptions) InstanceMode() any
InstanceMode - метод для получения режима аботы инстанса RO или RW
func (*ConnectionOptions) UpdateHash ¶
func (o *ConnectionOptions) UpdateHash(data ...interface{}) error
UpdateHash - функция расчета ConnectionID, необходима для шаринга конектов между моделями.
type DefaultLogger ¶
type DefaultLogger struct {
DebugMeta RepositoryDebugMeta
}
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(fmt string, args ...any)
func (*DefaultLogger) DebugCallRequest ¶ added in v1.7.0
func (l *DefaultLogger) DebugCallRequest(procName string, args [][]byte, fixtures ...CallMockFixture)
func (*DefaultLogger) DebugDeleteRequest ¶
func (l *DefaultLogger) DebugDeleteRequest(ns uint32, primaryKey [][]byte, fixture ...DeleteMockFixture)
func (*DefaultLogger) DebugInsertRequest ¶
func (l *DefaultLogger) DebugInsertRequest(ns uint32, needRetVal bool, insertMode InsertMode, tuple TupleData, fixture ...InsertMockFixture)
func (*DefaultLogger) DebugSelectRequest ¶
func (l *DefaultLogger) DebugSelectRequest(ns uint32, indexnum uint32, offset uint32, limit uint32, keys [][][]byte, fixture ...SelectMockFixture)
func (*DefaultLogger) DebugUpdateRequest ¶
func (l *DefaultLogger) DebugUpdateRequest(ns uint32, primaryKey [][]byte, updateOps []Ops, fixture ...UpdateMockFixture)
type DeleteMockFixture ¶ added in v1.7.0
type DeleteMockFixture struct {
PrimaryKey [][]byte
}
type FixtureType ¶
type FixtureType struct { // Уникальный идентификатор фикстуры ID uint32 // Msg - задаёт тип запроса (select, insert, delete, update) Msg RequetsTypeType // Байтовое представление запроса Request []byte // Байтовое представление ответа Response []byte // Возвращаемые объекты. Используется в режиме mock RespObjs []MockEntities // Trigger - функция, которая будет выполнена при обработке запроса // в случае если надо проверить insert или delete внутри этой функции // можно модифицировать список фикстур сервера Trigger func([]FixtureType) []FixtureType }
FixtureType - структура определяющая ответ Response для конкретного запроса Request
func CreateCallFixture ¶ added in v1.6.0
func CreateCallFixture(reqData func(mocks []MockEntities) []byte, respEnt []MockEntities) (FixtureType, error)
CreateCallFixture - конструктор фикстур для вызова процедуры
func CreateDeleteFixture ¶ added in v1.8.1
func CreateDeleteFixture(reqData []byte, trigger func([]FixtureType) []FixtureType) FixtureType
func CreateFixture ¶
func CreateFixture(id uint32, msg uint8, reqData []byte, respData []byte, trigger func([]FixtureType) []FixtureType) FixtureType
CreateFixture - конструктор фикстур
func CreateInsertOrReplaceFixture ¶
func CreateInsertOrReplaceFixture(entity MockEntities, reqData []byte, trigger func([]FixtureType) []FixtureType) FixtureType
func CreateSelectFixture ¶
func CreateSelectFixture(reqData func(mocks []MockEntities) []byte, respEnt []MockEntities) (FixtureType, error)
CreateSelectFixture - конструктор фикстур для select-а
func CreateUpdateFixture ¶
func CreateUpdateFixture(reqData []byte, trigger func([]FixtureType) []FixtureType) FixtureType
type Format ¶
type Format string
const ( Uint8 Format = "uint8" Uint16 Format = "uint16" Uint32 Format = "uint32" Uint64 Format = "uint64" Uint Format = "uint" Int8 Format = "int8" Int16 Format = "int16" Int32 Format = "int32" Int64 Format = "int64" Int Format = "int" String Format = "string" Bool Format = "bool" Float32 Format = "float32" Float64 Format = "float64" StringArray Format = "[]string" ByteArray Format = "[]byte" )
type InsertMockFixture ¶ added in v1.7.0
type InsertMockFixture struct { NeedRetVal bool InsertMode InsertMode Tuple TupleData }
type InsertMode ¶
type InsertMode uint8
const ( InsertModeInserOrReplace InsertMode = iota InsertModeInsert InsertModeReplace )
func UnpackInsertReplace ¶
func UnpackRequestFlagsVal ¶
func UnpackRequestFlagsVal(r *bytes.Reader) (bool, InsertMode, error)
type MockEntities ¶
type MockMockServerLogger ¶ added in v1.7.0
MockMockServerLogger is an autogenerated mock type for the MockServerLogger type
func NewMockMockServerLogger ¶ added in v1.7.0
func NewMockMockServerLogger(t mockConstructorTestingTNewMockMockServerLogger) *MockMockServerLogger
NewMockMockServerLogger creates a new instance of MockMockServerLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockMockServerLogger) Debug ¶ added in v1.7.0
func (_m *MockMockServerLogger) Debug(fmt string, args ...interface{})
Debug provides a mock function with given fields: fmt, args
func (*MockMockServerLogger) DebugCallRequest ¶ added in v1.7.0
func (_m *MockMockServerLogger) DebugCallRequest(procName string, args [][]byte, fixtures ...CallMockFixture)
DebugCallRequest provides a mock function with given fields: procName, args, fixtures
func (*MockMockServerLogger) DebugDeleteRequest ¶ added in v1.7.0
func (_m *MockMockServerLogger) DebugDeleteRequest(ns uint32, primaryKey [][]byte, fixtures ...DeleteMockFixture)
DebugDeleteRequest provides a mock function with given fields: ns, primaryKey, fixtures
func (*MockMockServerLogger) DebugInsertRequest ¶ added in v1.7.0
func (_m *MockMockServerLogger) DebugInsertRequest(ns uint32, needRetVal bool, insertMode InsertMode, tuple TupleData, fixtures ...InsertMockFixture)
DebugInsertRequest provides a mock function with given fields: ns, needRetVal, insertMode, tuple, fixtures
func (*MockMockServerLogger) DebugSelectRequest ¶ added in v1.7.0
func (_m *MockMockServerLogger) DebugSelectRequest(ns uint32, indexnum uint32, offset uint32, limit uint32, keys [][][]byte, fixtures ...SelectMockFixture)
DebugSelectRequest provides a mock function with given fields: ns, indexnum, offset, limit, keys, fixtures
func (*MockMockServerLogger) DebugUpdateRequest ¶ added in v1.7.0
func (_m *MockMockServerLogger) DebugUpdateRequest(ns uint32, primaryKey [][]byte, updateOps []Ops, fixtures ...UpdateMockFixture)
DebugUpdateRequest provides a mock function with given fields: ns, primaryKey, updateOps, fixtures
func (*MockMockServerLogger) EXPECT ¶ added in v1.7.0
func (_m *MockMockServerLogger) EXPECT() *MockMockServerLogger_Expecter
type MockMockServerLogger_DebugCallRequest_Call ¶ added in v1.7.0
MockMockServerLogger_DebugCallRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DebugCallRequest'
func (*MockMockServerLogger_DebugCallRequest_Call) Return ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugCallRequest_Call) Return() *MockMockServerLogger_DebugCallRequest_Call
func (*MockMockServerLogger_DebugCallRequest_Call) Run ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugCallRequest_Call) Run(run func(procName string, args [][]byte, fixtures ...CallMockFixture)) *MockMockServerLogger_DebugCallRequest_Call
func (*MockMockServerLogger_DebugCallRequest_Call) RunAndReturn ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugCallRequest_Call) RunAndReturn(run func(string, [][]byte, ...CallMockFixture)) *MockMockServerLogger_DebugCallRequest_Call
type MockMockServerLogger_DebugDeleteRequest_Call ¶ added in v1.7.0
MockMockServerLogger_DebugDeleteRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DebugDeleteRequest'
func (*MockMockServerLogger_DebugDeleteRequest_Call) Return ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugDeleteRequest_Call) Return() *MockMockServerLogger_DebugDeleteRequest_Call
func (*MockMockServerLogger_DebugDeleteRequest_Call) Run ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugDeleteRequest_Call) Run(run func(ns uint32, primaryKey [][]byte, fixtures ...DeleteMockFixture)) *MockMockServerLogger_DebugDeleteRequest_Call
func (*MockMockServerLogger_DebugDeleteRequest_Call) RunAndReturn ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugDeleteRequest_Call) RunAndReturn(run func(uint32, [][]byte, ...DeleteMockFixture)) *MockMockServerLogger_DebugDeleteRequest_Call
type MockMockServerLogger_DebugInsertRequest_Call ¶ added in v1.7.0
MockMockServerLogger_DebugInsertRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DebugInsertRequest'
func (*MockMockServerLogger_DebugInsertRequest_Call) Return ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugInsertRequest_Call) Return() *MockMockServerLogger_DebugInsertRequest_Call
func (*MockMockServerLogger_DebugInsertRequest_Call) Run ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugInsertRequest_Call) Run(run func(ns uint32, needRetVal bool, insertMode InsertMode, tuple TupleData, fixtures ...InsertMockFixture)) *MockMockServerLogger_DebugInsertRequest_Call
func (*MockMockServerLogger_DebugInsertRequest_Call) RunAndReturn ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugInsertRequest_Call) RunAndReturn(run func(uint32, bool, InsertMode, TupleData, ...InsertMockFixture)) *MockMockServerLogger_DebugInsertRequest_Call
type MockMockServerLogger_DebugSelectRequest_Call ¶ added in v1.7.0
MockMockServerLogger_DebugSelectRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DebugSelectRequest'
func (*MockMockServerLogger_DebugSelectRequest_Call) Return ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugSelectRequest_Call) Return() *MockMockServerLogger_DebugSelectRequest_Call
func (*MockMockServerLogger_DebugSelectRequest_Call) Run ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugSelectRequest_Call) Run(run func(ns uint32, indexnum uint32, offset uint32, limit uint32, keys [][][]byte, fixtures ...SelectMockFixture)) *MockMockServerLogger_DebugSelectRequest_Call
func (*MockMockServerLogger_DebugSelectRequest_Call) RunAndReturn ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugSelectRequest_Call) RunAndReturn(run func(uint32, uint32, uint32, uint32, [][][]byte, ...SelectMockFixture)) *MockMockServerLogger_DebugSelectRequest_Call
type MockMockServerLogger_DebugUpdateRequest_Call ¶ added in v1.7.0
MockMockServerLogger_DebugUpdateRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DebugUpdateRequest'
func (*MockMockServerLogger_DebugUpdateRequest_Call) Return ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugUpdateRequest_Call) Return() *MockMockServerLogger_DebugUpdateRequest_Call
func (*MockMockServerLogger_DebugUpdateRequest_Call) Run ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugUpdateRequest_Call) Run(run func(ns uint32, primaryKey [][]byte, updateOps []Ops, fixtures ...UpdateMockFixture)) *MockMockServerLogger_DebugUpdateRequest_Call
func (*MockMockServerLogger_DebugUpdateRequest_Call) RunAndReturn ¶ added in v1.7.0
func (_c *MockMockServerLogger_DebugUpdateRequest_Call) RunAndReturn(run func(uint32, [][]byte, []Ops, ...UpdateMockFixture)) *MockMockServerLogger_DebugUpdateRequest_Call
type MockMockServerLogger_Debug_Call ¶ added in v1.7.0
MockMockServerLogger_Debug_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Debug'
func (*MockMockServerLogger_Debug_Call) Return ¶ added in v1.7.0
func (_c *MockMockServerLogger_Debug_Call) Return() *MockMockServerLogger_Debug_Call
func (*MockMockServerLogger_Debug_Call) Run ¶ added in v1.7.0
func (_c *MockMockServerLogger_Debug_Call) Run(run func(fmt string, args ...interface{})) *MockMockServerLogger_Debug_Call
func (*MockMockServerLogger_Debug_Call) RunAndReturn ¶ added in v1.7.0
func (_c *MockMockServerLogger_Debug_Call) RunAndReturn(run func(string, ...interface{})) *MockMockServerLogger_Debug_Call
type MockMockServerLogger_Expecter ¶ added in v1.7.0
type MockMockServerLogger_Expecter struct {
// contains filtered or unexported fields
}
func (*MockMockServerLogger_Expecter) Debug ¶ added in v1.7.0
func (_e *MockMockServerLogger_Expecter) Debug(fmt interface{}, args ...interface{}) *MockMockServerLogger_Debug_Call
Debug is a helper method to define mock.On call
- fmt string
- args ...interface{}
func (*MockMockServerLogger_Expecter) DebugCallRequest ¶ added in v1.7.0
func (_e *MockMockServerLogger_Expecter) DebugCallRequest(procName interface{}, args interface{}, fixtures ...interface{}) *MockMockServerLogger_DebugCallRequest_Call
DebugCallRequest is a helper method to define mock.On call
- procName string
- args [][]byte
- fixtures ...CallMockFixture
func (*MockMockServerLogger_Expecter) DebugDeleteRequest ¶ added in v1.7.0
func (_e *MockMockServerLogger_Expecter) DebugDeleteRequest(ns interface{}, primaryKey interface{}, fixtures ...interface{}) *MockMockServerLogger_DebugDeleteRequest_Call
DebugDeleteRequest is a helper method to define mock.On call
- ns uint32
- primaryKey [][]byte
- fixtures ...DeleteMockFixture
func (*MockMockServerLogger_Expecter) DebugInsertRequest ¶ added in v1.7.0
func (_e *MockMockServerLogger_Expecter) DebugInsertRequest(ns interface{}, needRetVal interface{}, insertMode interface{}, tuple interface{}, fixtures ...interface{}) *MockMockServerLogger_DebugInsertRequest_Call
DebugInsertRequest is a helper method to define mock.On call
- ns uint32
- needRetVal bool
- insertMode InsertMode
- tuple TupleData
- fixtures ...InsertMockFixture
func (*MockMockServerLogger_Expecter) DebugSelectRequest ¶ added in v1.7.0
func (_e *MockMockServerLogger_Expecter) DebugSelectRequest(ns interface{}, indexnum interface{}, offset interface{}, limit interface{}, keys interface{}, fixtures ...interface{}) *MockMockServerLogger_DebugSelectRequest_Call
DebugSelectRequest is a helper method to define mock.On call
- ns uint32
- indexnum uint32
- offset uint32
- limit uint32
- keys [][][]byte
- fixtures ...SelectMockFixture
func (*MockMockServerLogger_Expecter) DebugUpdateRequest ¶ added in v1.7.0
func (_e *MockMockServerLogger_Expecter) DebugUpdateRequest(ns interface{}, primaryKey interface{}, updateOps interface{}, fixtures ...interface{}) *MockMockServerLogger_DebugUpdateRequest_Call
DebugUpdateRequest is a helper method to define mock.On call
- ns uint32
- primaryKey [][]byte
- updateOps []Ops
- fixtures ...UpdateMockFixture
type MockServer ¶
type MockServer struct { // Мьютекс для работы с триггерами sync.Mutex // contains filtered or unexported fields }
func InitMockServer ¶
func InitMockServer(opts ...MockServerOption) (*MockServer, error)
func (*MockServer) DebugFixtureNotFound ¶
func (oms *MockServer) DebugFixtureNotFound(msg uint8, req []byte)
DebugFixtureNotFound Prepares data for detailed content logging in human readable format and call the MockServerLogger function on a specific RequestType
func (*MockServer) GetServerHostPort ¶
func (oms *MockServer) GetServerHostPort() string
func (*MockServer) ProcessRequest ¶
func (oms *MockServer) ProcessRequest(msg uint8, req []byte) ([]byte, bool)
func (*MockServer) SetFixtures ¶
func (oms *MockServer) SetFixtures(oft []FixtureType)
func (*MockServer) Start ¶
func (oms *MockServer) Start() error
func (*MockServer) Stop ¶
func (oms *MockServer) Stop() error
type MockServerLogger ¶
type MockServerLogger interface { Debug(fmt string, args ...any) DebugSelectRequest(ns uint32, indexnum uint32, offset uint32, limit uint32, keys [][][]byte, fixtures ...SelectMockFixture) DebugUpdateRequest(ns uint32, primaryKey [][]byte, updateOps []Ops, fixtures ...UpdateMockFixture) DebugInsertRequest(ns uint32, needRetVal bool, insertMode InsertMode, tuple TupleData, fixtures ...InsertMockFixture) DebugDeleteRequest(ns uint32, primaryKey [][]byte, fixtures ...DeleteMockFixture) DebugCallRequest(procName string, args [][]byte, fixtures ...CallMockFixture) }
type MockServerOption ¶
type MockServerOption interface {
// contains filtered or unexported methods
}
func WithHost ¶
func WithHost(host, port string) MockServerOption
WithHost - опция для изменения сервера в конфиге
func WithIprotoLogger ¶ added in v1.7.0
func WithIprotoLogger(logger iproto.Logger) MockServerOption
func WithLogger ¶
func WithLogger(logger MockServerLogger) MockServerOption
type ModelStruct ¶
type NopIprotoLogger ¶ added in v1.7.0
type NopIprotoLogger struct{}
type RepositoryDebugMeta ¶
type RepositoryDebugMeta interface { GetSelectDebugInfo(ns uint32, indexnum uint32, offset uint32, limit uint32, keys [][][]byte, fixture ...SelectMockFixture) string GetUpdateDebugInfo(ns uint32, primaryKey [][]byte, updateOps []Ops, fixture ...UpdateMockFixture) string GetInsertDebugInfo(ns uint32, needRetVal bool, insertMode InsertMode, tuple TupleData, fixture ...InsertMockFixture) string GetDeleteDebugInfo(ns uint32, primaryKey [][]byte, fixture ...DeleteMockFixture) string GetCallDebugInfo(procName string, args [][]byte, fixture ...CallMockFixture) string }
type RequetsTypeType ¶
type RequetsTypeType uint8
const ( RequestTypeInsert RequetsTypeType = 13 RequestTypeSelect RequetsTypeType = 17 RequestTypeUpdate RequetsTypeType = 19 RequestTypeDelete RequetsTypeType = 21 RequestTypeCall RequetsTypeType = 22 )
func (RequetsTypeType) String ¶ added in v1.7.0
func (r RequetsTypeType) String() string
type SelectMockFixture ¶ added in v1.7.0
type ServerModeType ¶
type ServerModeType uint8
ServerModeType - тип используемый для описания режима работы инстанса. см. ниже
const ( ModeMaster ServerModeType = iota ModeReplica )
Режим работы конкретного инстанса. Мастер или реплика. При селекте из реплики быдет выставляться флаг readonly. Более подробно можно прочитать в доке.
type TupleData ¶
func CallLua ¶
func CallLua(ctx context.Context, connection *Connection, name string, args ...string) ([]TupleData, error)
CallLua - функция для вызова lua процедур. В будущем надо будет сделать возможность декларативно описывать процедуры в модели и в сгенерированном коде вызывать эту функцию. Так же надо будет сделать возможность описывать формат для результата в произвольной форме, а не в форме тупла для мочёдели.
func ProcessResp ¶
func ProcessResp(respBytes []byte, cntFlag CountFlags) ([]TupleData, error)