context

package
v0.0.0-...-c2e6958 Latest Latest
Warning

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

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

Documentation

Overview

Package context is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	MockContext *MockContext
	GofrContext *gofr.Context
}

Adapter is a test helper that implements customctx.Context

func (*Adapter) Bind

func (a *Adapter) Bind(v interface{}) error

func (*Adapter) Context

func (a *Adapter) Context() *gofr.Context

func (*Adapter) GetAPIKey

func (a *Adapter) GetAPIKey() (string, bool)

func (*Adapter) GetClaim

func (a *Adapter) GetClaim(key string) (interface{}, bool)

func (*Adapter) GetStringClaim

func (a *Adapter) GetStringClaim(key string) (string, bool)

func (*Adapter) GetUUIDClaim

func (a *Adapter) GetUUIDClaim(key string) (uuid.UUID, bool)

func (*Adapter) SetClaim

func (a *Adapter) SetClaim(key string, value interface{})

type Context

type Context interface {
	SetClaim(key string, value interface{})
	GetClaim(key string) (interface{}, bool)
	GetStringClaim(key string) (string, bool)
	GetUUIDClaim(key string) (uuid.UUID, bool)
	GetAPIKey() (string, bool)
	Bind(v interface{}) error
	Context() *gofr.Context
}

type CustomContext

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

func NewCustomContext

func NewCustomContext(c *gofr.Context) *CustomContext

NewCustomContext creates a new Context.

func (*CustomContext) Bind

func (c *CustomContext) Bind(v interface{}) error

Bind binds the input to the given value.

func (*CustomContext) Context

func (c *CustomContext) Context() *gofr.Context

Context returns the underlying gofr.Context.

func (*CustomContext) GetAPIKey

func (c *CustomContext) GetAPIKey() (string, bool)

GetAPIKey returns the API key from the context.

func (*CustomContext) GetClaim

func (c *CustomContext) GetClaim(key string) (interface{}, bool)

GetClaim returns the claim value.

func (*CustomContext) GetHeader

func (c *CustomContext) GetHeader(key string) string

GetHeader retrieves an HTTP header value.

func (*CustomContext) GetStringClaim

func (c *CustomContext) GetStringClaim(key string) (string, bool)

GetStringClaim returns the claim value as a string.

func (*CustomContext) GetUUIDClaim

func (c *CustomContext) GetUUIDClaim(key string) (uuid.UUID, bool)

GetUUIDClaim returns the claim value as a UUID.

func (*CustomContext) Headers

func (c *CustomContext) Headers() http.Header

Headers returns all HTTP headers.

func (*CustomContext) SetClaim

func (c *CustomContext) SetClaim(key string, value interface{})

SetClaim sets the claim value.

func (*CustomContext) SetHeader

func (c *CustomContext) SetHeader(key, value string)

SetHeader sets an HTTP header.

type MockContext

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

MockContext is a mock of Context interface.

func NewMockContext

func NewMockContext(ctrl *gomock.Controller) *MockContext

NewMockContext creates a new mock instance.

func (*MockContext) Bind

func (m *MockContext) Bind(arg0 any) error

Bind mocks base method.

func (*MockContext) Context

func (m *MockContext) Context() *gofr.Context

Context mocks base method.

func (*MockContext) EXPECT

func (m *MockContext) EXPECT() *MockContextMockRecorder

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

func (*MockContext) GetAPIKey

func (m *MockContext) GetAPIKey() (string, bool)

GetAPIKey mocks base method.

func (*MockContext) GetClaim

func (m *MockContext) GetClaim(arg0 string) (any, bool)

GetClaim mocks base method.

func (*MockContext) GetStringClaim

func (m *MockContext) GetStringClaim(arg0 string) (string, bool)

GetStringClaim mocks base method.

func (*MockContext) GetUUIDClaim

func (m *MockContext) GetUUIDClaim(arg0 string) (uuid.UUID, bool)

GetUUIDClaim mocks base method.

func (*MockContext) SetClaim

func (m *MockContext) SetClaim(arg0 string, arg1 any)

SetClaim mocks base method.

type MockContextMockRecorder

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

MockContextMockRecorder is the mock recorder for MockContext.

func (*MockContextMockRecorder) Bind

func (mr *MockContextMockRecorder) Bind(arg0 any) *gomock.Call

Bind indicates an expected call of Bind.

func (*MockContextMockRecorder) Context

func (mr *MockContextMockRecorder) Context() *gomock.Call

Context indicates an expected call of Context.

func (*MockContextMockRecorder) GetAPIKey

func (mr *MockContextMockRecorder) GetAPIKey() *gomock.Call

GetAPIKey indicates an expected call of GetAPIKey.

func (*MockContextMockRecorder) GetClaim

func (mr *MockContextMockRecorder) GetClaim(arg0 any) *gomock.Call

GetClaim indicates an expected call of GetClaim.

func (*MockContextMockRecorder) GetStringClaim

func (mr *MockContextMockRecorder) GetStringClaim(arg0 any) *gomock.Call

GetStringClaim indicates an expected call of GetStringClaim.

func (*MockContextMockRecorder) GetUUIDClaim

func (mr *MockContextMockRecorder) GetUUIDClaim(arg0 any) *gomock.Call

GetUUIDClaim indicates an expected call of GetUUIDClaim.

func (*MockContextMockRecorder) SetClaim

func (mr *MockContextMockRecorder) SetClaim(arg0, arg1 any) *gomock.Call

SetClaim indicates an expected call of SetClaim.

Jump to

Keyboard shortcuts

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