repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1 value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ory/fosite | internal/oauth2_storage.go | NewMockCoreStorage | func NewMockCoreStorage(ctrl *gomock.Controller) *MockCoreStorage {
mock := &MockCoreStorage{ctrl: ctrl}
mock.recorder = &MockCoreStorageMockRecorder{mock}
return mock
} | go | func NewMockCoreStorage(ctrl *gomock.Controller) *MockCoreStorage {
mock := &MockCoreStorage{ctrl: ctrl}
mock.recorder = &MockCoreStorageMockRecorder{mock}
return mock
} | [
"func",
"NewMockCoreStorage",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockCoreStorage",
"{",
"mock",
":=",
"&",
"MockCoreStorage",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockCoreStorageMockRecorder",
"{",
"... | // NewMockCoreStorage creates a new mock instance | [
"NewMockCoreStorage",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/oauth2_storage.go#L28-L32 | train |
ory/fosite | internal/oauth2_storage.go | CreateRefreshTokenSession | func (mr *MockCoreStorageMockRecorder) CreateRefreshTokenSession(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRefreshTokenSession", reflect.TypeOf((*MockCoreStorage)(nil).CreateRefreshTokenSession), arg0, arg1, arg2)
} | go | func (mr *MockCoreStorageMockRecorder) CreateRefreshTokenSession(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRefreshTokenSession", reflect.TypeOf((*MockCoreStorage)(nil).CreateRefreshTokenSession), arg0, arg1, arg2)
} | [
"func",
"(",
"mr",
"*",
"MockCoreStorageMockRecorder",
")",
"CreateRefreshTokenSession",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodT... | // CreateRefreshTokenSession indicates an expected call of CreateRefreshTokenSession | [
"CreateRefreshTokenSession",
"indicates",
"an",
"expected",
"call",
"of",
"CreateRefreshTokenSession"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/oauth2_storage.go#L71-L73 | train |
ory/fosite | internal/oauth2_storage.go | DeleteAccessTokenSession | func (m *MockCoreStorage) DeleteAccessTokenSession(arg0 context.Context, arg1 string) error {
ret := m.ctrl.Call(m, "DeleteAccessTokenSession", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockCoreStorage) DeleteAccessTokenSession(arg0 context.Context, arg1 string) error {
ret := m.ctrl.Call(m, "DeleteAccessTokenSession", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockCoreStorage",
")",
"DeleteAccessTokenSession",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg... | // DeleteAccessTokenSession mocks base method | [
"DeleteAccessTokenSession",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/oauth2_storage.go#L76-L80 | train |
ory/fosite | internal/storage.go | NewMockStorage | func NewMockStorage(ctrl *gomock.Controller) *MockStorage {
mock := &MockStorage{ctrl: ctrl}
mock.recorder = &MockStorageMockRecorder{mock}
return mock
} | go | func NewMockStorage(ctrl *gomock.Controller) *MockStorage {
mock := &MockStorage{ctrl: ctrl}
mock.recorder = &MockStorageMockRecorder{mock}
return mock
} | [
"func",
"NewMockStorage",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockStorage",
"{",
"mock",
":=",
"&",
"MockStorage",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockStorageMockRecorder",
"{",
"mock",
"}",
... | // NewMockStorage creates a new mock instance | [
"NewMockStorage",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/storage.go#L28-L32 | train |
ory/fosite | internal/refresh_token_strategy.go | NewMockRefreshTokenStrategy | func NewMockRefreshTokenStrategy(ctrl *gomock.Controller) *MockRefreshTokenStrategy {
mock := &MockRefreshTokenStrategy{ctrl: ctrl}
mock.recorder = &MockRefreshTokenStrategyMockRecorder{mock}
return mock
} | go | func NewMockRefreshTokenStrategy(ctrl *gomock.Controller) *MockRefreshTokenStrategy {
mock := &MockRefreshTokenStrategy{ctrl: ctrl}
mock.recorder = &MockRefreshTokenStrategyMockRecorder{mock}
return mock
} | [
"func",
"NewMockRefreshTokenStrategy",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockRefreshTokenStrategy",
"{",
"mock",
":=",
"&",
"MockRefreshTokenStrategy",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockRefreshTo... | // NewMockRefreshTokenStrategy creates a new mock instance | [
"NewMockRefreshTokenStrategy",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/refresh_token_strategy.go#L28-L32 | train |
ory/fosite | internal/refresh_token_strategy.go | GenerateRefreshToken | func (mr *MockRefreshTokenStrategyMockRecorder) GenerateRefreshToken(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateRefreshToken", reflect.TypeOf((*MockRefreshTokenStrategy)(nil).GenerateRefreshToken), arg0, arg1)
} | go | func (mr *MockRefreshTokenStrategyMockRecorder) GenerateRefreshToken(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateRefreshToken", reflect.TypeOf((*MockRefreshTokenStrategy)(nil).GenerateRefreshToken), arg0, arg1)
} | [
"func",
"(",
"mr",
"*",
"MockRefreshTokenStrategyMockRecorder",
")",
"GenerateRefreshToken",
"(",
"arg0",
",",
"arg1",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
... | // GenerateRefreshToken indicates an expected call of GenerateRefreshToken | [
"GenerateRefreshToken",
"indicates",
"an",
"expected",
"call",
"of",
"GenerateRefreshToken"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/refresh_token_strategy.go#L49-L51 | train |
ory/fosite | internal/oauth2_owner_storage.go | NewMockResourceOwnerPasswordCredentialsGrantStorage | func NewMockResourceOwnerPasswordCredentialsGrantStorage(ctrl *gomock.Controller) *MockResourceOwnerPasswordCredentialsGrantStorage {
mock := &MockResourceOwnerPasswordCredentialsGrantStorage{ctrl: ctrl}
mock.recorder = &MockResourceOwnerPasswordCredentialsGrantStorageMockRecorder{mock}
return mock
} | go | func NewMockResourceOwnerPasswordCredentialsGrantStorage(ctrl *gomock.Controller) *MockResourceOwnerPasswordCredentialsGrantStorage {
mock := &MockResourceOwnerPasswordCredentialsGrantStorage{ctrl: ctrl}
mock.recorder = &MockResourceOwnerPasswordCredentialsGrantStorageMockRecorder{mock}
return mock
} | [
"func",
"NewMockResourceOwnerPasswordCredentialsGrantStorage",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockResourceOwnerPasswordCredentialsGrantStorage",
"{",
"mock",
":=",
"&",
"MockResourceOwnerPasswordCredentialsGrantStorage",
"{",
"ctrl",
":",
"ctrl",
"}... | // NewMockResourceOwnerPasswordCredentialsGrantStorage creates a new mock instance | [
"NewMockResourceOwnerPasswordCredentialsGrantStorage",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/oauth2_owner_storage.go#L28-L32 | train |
ory/fosite | internal/oauth2_owner_storage.go | Authenticate | func (mr *MockResourceOwnerPasswordCredentialsGrantStorageMockRecorder) Authenticate(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Authenticate", reflect.TypeOf((*MockResourceOwnerPasswordCredentialsGrantStorage)(nil).Authenticate), arg0, arg1, arg2)
} | go | func (mr *MockResourceOwnerPasswordCredentialsGrantStorageMockRecorder) Authenticate(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Authenticate", reflect.TypeOf((*MockResourceOwnerPasswordCredentialsGrantStorage)(nil).Authenticate), arg0, arg1, arg2)
} | [
"func",
"(",
"mr",
"*",
"MockResourceOwnerPasswordCredentialsGrantStorageMockRecorder",
")",
"Authenticate",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"R... | // Authenticate indicates an expected call of Authenticate | [
"Authenticate",
"indicates",
"an",
"expected",
"call",
"of",
"Authenticate"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/oauth2_owner_storage.go#L47-L49 | train |
ory/fosite | internal/authorize_handler.go | NewMockAuthorizeEndpointHandler | func NewMockAuthorizeEndpointHandler(ctrl *gomock.Controller) *MockAuthorizeEndpointHandler {
mock := &MockAuthorizeEndpointHandler{ctrl: ctrl}
mock.recorder = &MockAuthorizeEndpointHandlerMockRecorder{mock}
return mock
} | go | func NewMockAuthorizeEndpointHandler(ctrl *gomock.Controller) *MockAuthorizeEndpointHandler {
mock := &MockAuthorizeEndpointHandler{ctrl: ctrl}
mock.recorder = &MockAuthorizeEndpointHandlerMockRecorder{mock}
return mock
} | [
"func",
"NewMockAuthorizeEndpointHandler",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockAuthorizeEndpointHandler",
"{",
"mock",
":=",
"&",
"MockAuthorizeEndpointHandler",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"M... | // NewMockAuthorizeEndpointHandler creates a new mock instance | [
"NewMockAuthorizeEndpointHandler",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_handler.go#L28-L32 | train |
ory/fosite | internal/authorize_handler.go | HandleAuthorizeEndpointRequest | func (m *MockAuthorizeEndpointHandler) HandleAuthorizeEndpointRequest(arg0 context.Context, arg1 fosite.AuthorizeRequester, arg2 fosite.AuthorizeResponder) error {
ret := m.ctrl.Call(m, "HandleAuthorizeEndpointRequest", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockAuthorizeEndpointHandler) HandleAuthorizeEndpointRequest(arg0 context.Context, arg1 fosite.AuthorizeRequester, arg2 fosite.AuthorizeResponder) error {
ret := m.ctrl.Call(m, "HandleAuthorizeEndpointRequest", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizeEndpointHandler",
")",
"HandleAuthorizeEndpointRequest",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"fosite",
".",
"AuthorizeRequester",
",",
"arg2",
"fosite",
".",
"AuthorizeResponder",
")",
"error",
"{",
"ret",
":="... | // HandleAuthorizeEndpointRequest mocks base method | [
"HandleAuthorizeEndpointRequest",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_handler.go#L40-L44 | train |
ory/fosite | internal/authorize_handler.go | HandleAuthorizeEndpointRequest | func (mr *MockAuthorizeEndpointHandlerMockRecorder) HandleAuthorizeEndpointRequest(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAuthorizeEndpointRequest", reflect.TypeOf((*MockAuthorizeEndpointHandler)(nil).HandleAuthorizeEndpointRequest), arg0, arg1, arg2)
} | go | func (mr *MockAuthorizeEndpointHandlerMockRecorder) HandleAuthorizeEndpointRequest(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleAuthorizeEndpointRequest", reflect.TypeOf((*MockAuthorizeEndpointHandler)(nil).HandleAuthorizeEndpointRequest), arg0, arg1, arg2)
} | [
"func",
"(",
"mr",
"*",
"MockAuthorizeEndpointHandlerMockRecorder",
")",
"HandleAuthorizeEndpointRequest",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"Rec... | // HandleAuthorizeEndpointRequest indicates an expected call of HandleAuthorizeEndpointRequest | [
"HandleAuthorizeEndpointRequest",
"indicates",
"an",
"expected",
"call",
"of",
"HandleAuthorizeEndpointRequest"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_handler.go#L47-L49 | train |
ory/fosite | internal/authorize_response.go | NewMockAuthorizeResponder | func NewMockAuthorizeResponder(ctrl *gomock.Controller) *MockAuthorizeResponder {
mock := &MockAuthorizeResponder{ctrl: ctrl}
mock.recorder = &MockAuthorizeResponderMockRecorder{mock}
return mock
} | go | func NewMockAuthorizeResponder(ctrl *gomock.Controller) *MockAuthorizeResponder {
mock := &MockAuthorizeResponder{ctrl: ctrl}
mock.recorder = &MockAuthorizeResponderMockRecorder{mock}
return mock
} | [
"func",
"NewMockAuthorizeResponder",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockAuthorizeResponder",
"{",
"mock",
":=",
"&",
"MockAuthorizeResponder",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockAuthorizeRespon... | // NewMockAuthorizeResponder creates a new mock instance | [
"NewMockAuthorizeResponder",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L27-L31 | train |
ory/fosite | internal/authorize_response.go | AddFragment | func (m *MockAuthorizeResponder) AddFragment(arg0, arg1 string) {
m.ctrl.Call(m, "AddFragment", arg0, arg1)
} | go | func (m *MockAuthorizeResponder) AddFragment(arg0, arg1 string) {
m.ctrl.Call(m, "AddFragment", arg0, arg1)
} | [
"func",
"(",
"m",
"*",
"MockAuthorizeResponder",
")",
"AddFragment",
"(",
"arg0",
",",
"arg1",
"string",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"}"
] | // AddFragment mocks base method | [
"AddFragment",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L39-L41 | train |
ory/fosite | internal/authorize_response.go | AddHeader | func (m *MockAuthorizeResponder) AddHeader(arg0, arg1 string) {
m.ctrl.Call(m, "AddHeader", arg0, arg1)
} | go | func (m *MockAuthorizeResponder) AddHeader(arg0, arg1 string) {
m.ctrl.Call(m, "AddHeader", arg0, arg1)
} | [
"func",
"(",
"m",
"*",
"MockAuthorizeResponder",
")",
"AddHeader",
"(",
"arg0",
",",
"arg1",
"string",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"}"
] | // AddHeader mocks base method | [
"AddHeader",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L49-L51 | train |
ory/fosite | internal/authorize_response.go | AddQuery | func (m *MockAuthorizeResponder) AddQuery(arg0, arg1 string) {
m.ctrl.Call(m, "AddQuery", arg0, arg1)
} | go | func (m *MockAuthorizeResponder) AddQuery(arg0, arg1 string) {
m.ctrl.Call(m, "AddQuery", arg0, arg1)
} | [
"func",
"(",
"m",
"*",
"MockAuthorizeResponder",
")",
"AddQuery",
"(",
"arg0",
",",
"arg1",
"string",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"}"
] | // AddQuery mocks base method | [
"AddQuery",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L59-L61 | train |
ory/fosite | internal/authorize_response.go | AddQuery | func (mr *MockAuthorizeResponderMockRecorder) AddQuery(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddQuery", reflect.TypeOf((*MockAuthorizeResponder)(nil).AddQuery), arg0, arg1)
} | go | func (mr *MockAuthorizeResponderMockRecorder) AddQuery(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddQuery", reflect.TypeOf((*MockAuthorizeResponder)(nil).AddQuery), arg0, arg1)
} | [
"func",
"(",
"mr",
"*",
"MockAuthorizeResponderMockRecorder",
")",
"AddQuery",
"(",
"arg0",
",",
"arg1",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",... | // AddQuery indicates an expected call of AddQuery | [
"AddQuery",
"indicates",
"an",
"expected",
"call",
"of",
"AddQuery"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L64-L66 | train |
ory/fosite | internal/authorize_response.go | GetCode | func (m *MockAuthorizeResponder) GetCode() string {
ret := m.ctrl.Call(m, "GetCode")
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockAuthorizeResponder) GetCode() string {
ret := m.ctrl.Call(m, "GetCode")
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizeResponder",
")",
"GetCode",
"(",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
")",
... | // GetCode mocks base method | [
"GetCode",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L69-L73 | train |
ory/fosite | internal/authorize_response.go | GetFragment | func (m *MockAuthorizeResponder) GetFragment() url.Values {
ret := m.ctrl.Call(m, "GetFragment")
ret0, _ := ret[0].(url.Values)
return ret0
} | go | func (m *MockAuthorizeResponder) GetFragment() url.Values {
ret := m.ctrl.Call(m, "GetFragment")
ret0, _ := ret[0].(url.Values)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizeResponder",
")",
"GetFragment",
"(",
")",
"url",
".",
"Values",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
... | // GetFragment mocks base method | [
"GetFragment",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L81-L85 | train |
ory/fosite | internal/authorize_response.go | GetHeader | func (m *MockAuthorizeResponder) GetHeader() http.Header {
ret := m.ctrl.Call(m, "GetHeader")
ret0, _ := ret[0].(http.Header)
return ret0
} | go | func (m *MockAuthorizeResponder) GetHeader() http.Header {
ret := m.ctrl.Call(m, "GetHeader")
ret0, _ := ret[0].(http.Header)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizeResponder",
")",
"GetHeader",
"(",
")",
"http",
".",
"Header",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
... | // GetHeader mocks base method | [
"GetHeader",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L93-L97 | train |
ory/fosite | internal/authorize_response.go | GetQuery | func (mr *MockAuthorizeResponderMockRecorder) GetQuery() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQuery", reflect.TypeOf((*MockAuthorizeResponder)(nil).GetQuery))
} | go | func (mr *MockAuthorizeResponderMockRecorder) GetQuery() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQuery", reflect.TypeOf((*MockAuthorizeResponder)(nil).GetQuery))
} | [
"func",
"(",
"mr",
"*",
"MockAuthorizeResponderMockRecorder",
")",
"GetQuery",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
... | // GetQuery indicates an expected call of GetQuery | [
"GetQuery",
"indicates",
"an",
"expected",
"call",
"of",
"GetQuery"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/authorize_response.go#L112-L114 | train |
ory/fosite | token/jwt/claims.go | ToString | func ToString(i interface{}) string {
if i == nil {
return ""
}
if s, ok := i.(string); ok {
return s
}
if sl, ok := i.([]string); ok {
if len(sl) == 1 {
return sl[0]
}
}
return ""
} | go | func ToString(i interface{}) string {
if i == nil {
return ""
}
if s, ok := i.(string); ok {
return s
}
if sl, ok := i.([]string); ok {
if len(sl) == 1 {
return sl[0]
}
}
return ""
} | [
"func",
"ToString",
"(",
"i",
"interface",
"{",
"}",
")",
"string",
"{",
"if",
"i",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"s",
",",
"ok",
":=",
"i",
".",
"(",
"string",
")",
";",
"ok",
"{",
"return",
"s",
"\n",
"}",... | // ToString will return a string representation of a map | [
"ToString",
"will",
"return",
"a",
"string",
"representation",
"of",
"a",
"map"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/token/jwt/claims.go#L34-L50 | train |
ory/fosite | token/jwt/claims.go | ToTime | func ToTime(i interface{}) time.Time {
if i == nil {
return time.Time{}
}
if t, ok := i.(int64); ok {
return time.Unix(t, 0).UTC()
} else if t, ok := i.(float64); ok {
return time.Unix(int64(t), 0).UTC()
} else if t, ok := i.(time.Time); ok {
return t
}
return time.Time{}
} | go | func ToTime(i interface{}) time.Time {
if i == nil {
return time.Time{}
}
if t, ok := i.(int64); ok {
return time.Unix(t, 0).UTC()
} else if t, ok := i.(float64); ok {
return time.Unix(int64(t), 0).UTC()
} else if t, ok := i.(time.Time); ok {
return t
}
return time.Time{}
} | [
"func",
"ToTime",
"(",
"i",
"interface",
"{",
"}",
")",
"time",
".",
"Time",
"{",
"if",
"i",
"==",
"nil",
"{",
"return",
"time",
".",
"Time",
"{",
"}",
"\n",
"}",
"\n\n",
"if",
"t",
",",
"ok",
":=",
"i",
".",
"(",
"int64",
")",
";",
"ok",
"... | // ToTime will try to convert a given input to a time.Time structure | [
"ToTime",
"will",
"try",
"to",
"convert",
"a",
"given",
"input",
"to",
"a",
"time",
".",
"Time",
"structure"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/token/jwt/claims.go#L53-L67 | train |
ory/fosite | token/jwt/claims.go | Filter | func Filter(elements map[string]interface{}, keys ...string) map[string]interface{} {
var keyIdx = make(map[string]bool)
var result = make(map[string]interface{})
for _, key := range keys {
keyIdx[key] = true
}
for k, e := range elements {
if _, ok := keyIdx[k]; !ok {
result[k] = e
}
}
return result
} | go | func Filter(elements map[string]interface{}, keys ...string) map[string]interface{} {
var keyIdx = make(map[string]bool)
var result = make(map[string]interface{})
for _, key := range keys {
keyIdx[key] = true
}
for k, e := range elements {
if _, ok := keyIdx[k]; !ok {
result[k] = e
}
}
return result
} | [
"func",
"Filter",
"(",
"elements",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"keys",
"...",
"string",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"var",
"keyIdx",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")"... | // Filter will filter out elemets based on keys in a given input map na key-slice | [
"Filter",
"will",
"filter",
"out",
"elemets",
"based",
"on",
"keys",
"in",
"a",
"given",
"input",
"map",
"na",
"key",
"-",
"slice"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/token/jwt/claims.go#L70-L85 | train |
ory/fosite | token/jwt/claims.go | Copy | func Copy(elements map[string]interface{}) (result map[string]interface{}) {
result = make(map[string]interface{}, len(elements))
for k, v := range elements {
result[k] = v
}
return result
} | go | func Copy(elements map[string]interface{}) (result map[string]interface{}) {
result = make(map[string]interface{}, len(elements))
for k, v := range elements {
result[k] = v
}
return result
} | [
"func",
"Copy",
"(",
"elements",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"result",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"result",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
... | // Copy will copy all elements in a map and return a new representational map | [
"Copy",
"will",
"copy",
"all",
"elements",
"in",
"a",
"map",
"and",
"return",
"a",
"new",
"representational",
"map"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/token/jwt/claims.go#L88-L95 | train |
ory/fosite | internal/request.go | NewMockRequester | func NewMockRequester(ctrl *gomock.Controller) *MockRequester {
mock := &MockRequester{ctrl: ctrl}
mock.recorder = &MockRequesterMockRecorder{mock}
return mock
} | go | func NewMockRequester(ctrl *gomock.Controller) *MockRequester {
mock := &MockRequester{ctrl: ctrl}
mock.recorder = &MockRequesterMockRecorder{mock}
return mock
} | [
"func",
"NewMockRequester",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockRequester",
"{",
"mock",
":=",
"&",
"MockRequester",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockRequesterMockRecorder",
"{",
"mock",
... | // NewMockRequester creates a new mock instance | [
"NewMockRequester",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/request.go#L29-L33 | train |
ory/fosite | internal/request.go | GetSession | func (m *MockRequester) GetSession() fosite.Session {
ret := m.ctrl.Call(m, "GetSession")
ret0, _ := ret[0].(fosite.Session)
return ret0
} | go | func (m *MockRequester) GetSession() fosite.Session {
ret := m.ctrl.Call(m, "GetSession")
ret0, _ := ret[0].(fosite.Session)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockRequester",
")",
"GetSession",
"(",
")",
"fosite",
".",
"Session",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"fos... | // GetSession mocks base method | [
"GetSession",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/request.go#L147-L151 | train |
ory/fosite | internal/request.go | Sanitize | func (m *MockRequester) Sanitize(arg0 []string) fosite.Requester {
ret := m.ctrl.Call(m, "Sanitize", arg0)
ret0, _ := ret[0].(fosite.Requester)
return ret0
} | go | func (m *MockRequester) Sanitize(arg0 []string) fosite.Requester {
ret := m.ctrl.Call(m, "Sanitize", arg0)
ret0, _ := ret[0].(fosite.Requester)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockRequester",
")",
"Sanitize",
"(",
"arg0",
"[",
"]",
"string",
")",
"fosite",
".",
"Requester",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=... | // Sanitize mocks base method | [
"Sanitize",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/request.go#L189-L193 | train |
ory/fosite | internal/access_request.go | NewMockAccessRequester | func NewMockAccessRequester(ctrl *gomock.Controller) *MockAccessRequester {
mock := &MockAccessRequester{ctrl: ctrl}
mock.recorder = &MockAccessRequesterMockRecorder{mock}
return mock
} | go | func NewMockAccessRequester(ctrl *gomock.Controller) *MockAccessRequester {
mock := &MockAccessRequester{ctrl: ctrl}
mock.recorder = &MockAccessRequesterMockRecorder{mock}
return mock
} | [
"func",
"NewMockAccessRequester",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockAccessRequester",
"{",
"mock",
":=",
"&",
"MockAccessRequester",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockAccessRequesterMockRecor... | // NewMockAccessRequester creates a new mock instance | [
"NewMockAccessRequester",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_request.go#L29-L33 | train |
ory/fosite | internal/access_request.go | GetGrantTypes | func (mr *MockAccessRequesterMockRecorder) GetGrantTypes() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGrantTypes", reflect.TypeOf((*MockAccessRequester)(nil).GetGrantTypes))
} | go | func (mr *MockAccessRequesterMockRecorder) GetGrantTypes() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGrantTypes", reflect.TypeOf((*MockAccessRequester)(nil).GetGrantTypes))
} | [
"func",
"(",
"mr",
"*",
"MockAccessRequesterMockRecorder",
")",
"GetGrantTypes",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
... | // GetGrantTypes indicates an expected call of GetGrantTypes | [
"GetGrantTypes",
"indicates",
"an",
"expected",
"call",
"of",
"GetGrantTypes"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_request.go#L70-L72 | train |
ory/fosite | internal/access_request.go | GetGrantedAudience | func (m *MockAccessRequester) GetGrantedAudience() fosite.Arguments {
ret := m.ctrl.Call(m, "GetGrantedAudience")
ret0, _ := ret[0].(fosite.Arguments)
return ret0
} | go | func (m *MockAccessRequester) GetGrantedAudience() fosite.Arguments {
ret := m.ctrl.Call(m, "GetGrantedAudience")
ret0, _ := ret[0].(fosite.Arguments)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAccessRequester",
")",
"GetGrantedAudience",
"(",
")",
"fosite",
".",
"Arguments",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".... | // GetGrantedAudience mocks base method | [
"GetGrantedAudience",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_request.go#L75-L79 | train |
ory/fosite | internal/access_request.go | GetRequestedAt | func (m *MockAccessRequester) GetRequestedAt() time.Time {
ret := m.ctrl.Call(m, "GetRequestedAt")
ret0, _ := ret[0].(time.Time)
return ret0
} | go | func (m *MockAccessRequester) GetRequestedAt() time.Time {
ret := m.ctrl.Call(m, "GetRequestedAt")
ret0, _ := ret[0].(time.Time)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAccessRequester",
")",
"GetRequestedAt",
"(",
")",
"time",
".",
"Time",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
... | // GetRequestedAt mocks base method | [
"GetRequestedAt",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_request.go#L123-L127 | train |
ory/fosite | internal/access_request.go | SetSession | func (mr *MockAccessRequesterMockRecorder) SetSession(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSession", reflect.TypeOf((*MockAccessRequester)(nil).SetSession), arg0)
} | go | func (mr *MockAccessRequesterMockRecorder) SetSession(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSession", reflect.TypeOf((*MockAccessRequester)(nil).SetSession), arg0)
} | [
"func",
"(",
"mr",
"*",
"MockAccessRequesterMockRecorder",
")",
"SetSession",
"(",
"arg0",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
... | // SetSession indicates an expected call of SetSession | [
"SetSession",
"indicates",
"an",
"expected",
"call",
"of",
"SetSession"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_request.go#L248-L250 | train |
ory/fosite | helper.go | StringInSlice | func StringInSlice(needle string, haystack []string) bool {
for _, b := range haystack {
if strings.ToLower(b) == strings.ToLower(needle) {
return true
}
}
return false
} | go | func StringInSlice(needle string, haystack []string) bool {
for _, b := range haystack {
if strings.ToLower(b) == strings.ToLower(needle) {
return true
}
}
return false
} | [
"func",
"StringInSlice",
"(",
"needle",
"string",
",",
"haystack",
"[",
"]",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"b",
":=",
"range",
"haystack",
"{",
"if",
"strings",
".",
"ToLower",
"(",
"b",
")",
"==",
"strings",
".",
"ToLower",
"(",
"need... | // StringInSlice returns true if needle exists in haystack | [
"StringInSlice",
"returns",
"true",
"if",
"needle",
"exists",
"in",
"haystack"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/helper.go#L29-L36 | train |
ory/fosite | internal/openid_id_token_storage.go | NewMockOpenIDConnectRequestStorage | func NewMockOpenIDConnectRequestStorage(ctrl *gomock.Controller) *MockOpenIDConnectRequestStorage {
mock := &MockOpenIDConnectRequestStorage{ctrl: ctrl}
mock.recorder = &MockOpenIDConnectRequestStorageMockRecorder{mock}
return mock
} | go | func NewMockOpenIDConnectRequestStorage(ctrl *gomock.Controller) *MockOpenIDConnectRequestStorage {
mock := &MockOpenIDConnectRequestStorage{ctrl: ctrl}
mock.recorder = &MockOpenIDConnectRequestStorageMockRecorder{mock}
return mock
} | [
"func",
"NewMockOpenIDConnectRequestStorage",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockOpenIDConnectRequestStorage",
"{",
"mock",
":=",
"&",
"MockOpenIDConnectRequestStorage",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
... | // NewMockOpenIDConnectRequestStorage creates a new mock instance | [
"NewMockOpenIDConnectRequestStorage",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/openid_id_token_storage.go#L28-L32 | train |
ory/fosite | internal/openid_id_token_storage.go | CreateOpenIDConnectSession | func (mr *MockOpenIDConnectRequestStorageMockRecorder) CreateOpenIDConnectSession(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOpenIDConnectSession", reflect.TypeOf((*MockOpenIDConnectRequestStorage)(nil).CreateOpenIDConnectSession), arg0, arg1, arg2)
} | go | func (mr *MockOpenIDConnectRequestStorageMockRecorder) CreateOpenIDConnectSession(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOpenIDConnectSession", reflect.TypeOf((*MockOpenIDConnectRequestStorage)(nil).CreateOpenIDConnectSession), arg0, arg1, arg2)
} | [
"func",
"(",
"mr",
"*",
"MockOpenIDConnectRequestStorageMockRecorder",
")",
"CreateOpenIDConnectSession",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"Reco... | // CreateOpenIDConnectSession indicates an expected call of CreateOpenIDConnectSession | [
"CreateOpenIDConnectSession",
"indicates",
"an",
"expected",
"call",
"of",
"CreateOpenIDConnectSession"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/openid_id_token_storage.go#L47-L49 | train |
ory/fosite | internal/openid_id_token_storage.go | DeleteOpenIDConnectSession | func (m *MockOpenIDConnectRequestStorage) DeleteOpenIDConnectSession(arg0 context.Context, arg1 string) error {
ret := m.ctrl.Call(m, "DeleteOpenIDConnectSession", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockOpenIDConnectRequestStorage) DeleteOpenIDConnectSession(arg0 context.Context, arg1 string) error {
ret := m.ctrl.Call(m, "DeleteOpenIDConnectSession", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockOpenIDConnectRequestStorage",
")",
"DeleteOpenIDConnectSession",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"ar... | // DeleteOpenIDConnectSession mocks base method | [
"DeleteOpenIDConnectSession",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/openid_id_token_storage.go#L52-L56 | train |
ory/fosite | internal/openid_id_token_storage.go | GetOpenIDConnectSession | func (m *MockOpenIDConnectRequestStorage) GetOpenIDConnectSession(arg0 context.Context, arg1 string, arg2 fosite.Requester) (fosite.Requester, error) {
ret := m.ctrl.Call(m, "GetOpenIDConnectSession", arg0, arg1, arg2)
ret0, _ := ret[0].(fosite.Requester)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockOpenIDConnectRequestStorage) GetOpenIDConnectSession(arg0 context.Context, arg1 string, arg2 fosite.Requester) (fosite.Requester, error) {
ret := m.ctrl.Call(m, "GetOpenIDConnectSession", arg0, arg1, arg2)
ret0, _ := ret[0].(fosite.Requester)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockOpenIDConnectRequestStorage",
")",
"GetOpenIDConnectSession",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
",",
"arg2",
"fosite",
".",
"Requester",
")",
"(",
"fosite",
".",
"Requester",
",",
"error",
")",
"{",
"r... | // GetOpenIDConnectSession mocks base method | [
"GetOpenIDConnectSession",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/openid_id_token_storage.go#L64-L69 | train |
ory/fosite | internal/access_response.go | NewMockAccessResponder | func NewMockAccessResponder(ctrl *gomock.Controller) *MockAccessResponder {
mock := &MockAccessResponder{ctrl: ctrl}
mock.recorder = &MockAccessResponderMockRecorder{mock}
return mock
} | go | func NewMockAccessResponder(ctrl *gomock.Controller) *MockAccessResponder {
mock := &MockAccessResponder{ctrl: ctrl}
mock.recorder = &MockAccessResponderMockRecorder{mock}
return mock
} | [
"func",
"NewMockAccessResponder",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockAccessResponder",
"{",
"mock",
":=",
"&",
"MockAccessResponder",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockAccessResponderMockRecor... | // NewMockAccessResponder creates a new mock instance | [
"NewMockAccessResponder",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L28-L32 | train |
ory/fosite | internal/access_response.go | GetAccessToken | func (m *MockAccessResponder) GetAccessToken() string {
ret := m.ctrl.Call(m, "GetAccessToken")
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockAccessResponder) GetAccessToken() string {
ret := m.ctrl.Call(m, "GetAccessToken")
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAccessResponder",
")",
"GetAccessToken",
"(",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
")... | // GetAccessToken mocks base method | [
"GetAccessToken",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L40-L44 | train |
ory/fosite | internal/access_response.go | GetExtra | func (m *MockAccessResponder) GetExtra(arg0 string) interface{} {
ret := m.ctrl.Call(m, "GetExtra", arg0)
ret0, _ := ret[0].(interface{})
return ret0
} | go | func (m *MockAccessResponder) GetExtra(arg0 string) interface{} {
ret := m.ctrl.Call(m, "GetExtra", arg0)
ret0, _ := ret[0].(interface{})
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAccessResponder",
")",
"GetExtra",
"(",
"arg0",
"string",
")",
"interface",
"{",
"}",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
... | // GetExtra mocks base method | [
"GetExtra",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L52-L56 | train |
ory/fosite | internal/access_response.go | GetExtra | func (mr *MockAccessResponderMockRecorder) GetExtra(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExtra", reflect.TypeOf((*MockAccessResponder)(nil).GetExtra), arg0)
} | go | func (mr *MockAccessResponderMockRecorder) GetExtra(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExtra", reflect.TypeOf((*MockAccessResponder)(nil).GetExtra), arg0)
} | [
"func",
"(",
"mr",
"*",
"MockAccessResponderMockRecorder",
")",
"GetExtra",
"(",
"arg0",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
... | // GetExtra indicates an expected call of GetExtra | [
"GetExtra",
"indicates",
"an",
"expected",
"call",
"of",
"GetExtra"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L59-L61 | train |
ory/fosite | internal/access_response.go | SetAccessToken | func (m *MockAccessResponder) SetAccessToken(arg0 string) {
m.ctrl.Call(m, "SetAccessToken", arg0)
} | go | func (m *MockAccessResponder) SetAccessToken(arg0 string) {
m.ctrl.Call(m, "SetAccessToken", arg0)
} | [
"func",
"(",
"m",
"*",
"MockAccessResponder",
")",
"SetAccessToken",
"(",
"arg0",
"string",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] | // SetAccessToken mocks base method | [
"SetAccessToken",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L76-L78 | train |
ory/fosite | internal/access_response.go | SetExpiresIn | func (m *MockAccessResponder) SetExpiresIn(arg0 time.Duration) {
m.ctrl.Call(m, "SetExpiresIn", arg0)
} | go | func (m *MockAccessResponder) SetExpiresIn(arg0 time.Duration) {
m.ctrl.Call(m, "SetExpiresIn", arg0)
} | [
"func",
"(",
"m",
"*",
"MockAccessResponder",
")",
"SetExpiresIn",
"(",
"arg0",
"time",
".",
"Duration",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] | // SetExpiresIn mocks base method | [
"SetExpiresIn",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L86-L88 | train |
ory/fosite | internal/access_response.go | SetExtra | func (m *MockAccessResponder) SetExtra(arg0 string, arg1 interface{}) {
m.ctrl.Call(m, "SetExtra", arg0, arg1)
} | go | func (m *MockAccessResponder) SetExtra(arg0 string, arg1 interface{}) {
m.ctrl.Call(m, "SetExtra", arg0, arg1)
} | [
"func",
"(",
"m",
"*",
"MockAccessResponder",
")",
"SetExtra",
"(",
"arg0",
"string",
",",
"arg1",
"interface",
"{",
"}",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"}"
] | // SetExtra mocks base method | [
"SetExtra",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L96-L98 | train |
ory/fosite | internal/access_response.go | SetScopes | func (m *MockAccessResponder) SetScopes(arg0 fosite.Arguments) {
m.ctrl.Call(m, "SetScopes", arg0)
} | go | func (m *MockAccessResponder) SetScopes(arg0 fosite.Arguments) {
m.ctrl.Call(m, "SetScopes", arg0)
} | [
"func",
"(",
"m",
"*",
"MockAccessResponder",
")",
"SetScopes",
"(",
"arg0",
"fosite",
".",
"Arguments",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] | // SetScopes mocks base method | [
"SetScopes",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L106-L108 | train |
ory/fosite | internal/access_response.go | SetTokenType | func (m *MockAccessResponder) SetTokenType(arg0 string) {
m.ctrl.Call(m, "SetTokenType", arg0)
} | go | func (m *MockAccessResponder) SetTokenType(arg0 string) {
m.ctrl.Call(m, "SetTokenType", arg0)
} | [
"func",
"(",
"m",
"*",
"MockAccessResponder",
")",
"SetTokenType",
"(",
"arg0",
"string",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] | // SetTokenType mocks base method | [
"SetTokenType",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L116-L118 | train |
ory/fosite | internal/access_response.go | ToMap | func (mr *MockAccessResponderMockRecorder) ToMap() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToMap", reflect.TypeOf((*MockAccessResponder)(nil).ToMap))
} | go | func (mr *MockAccessResponderMockRecorder) ToMap() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToMap", reflect.TypeOf((*MockAccessResponder)(nil).ToMap))
} | [
"func",
"(",
"mr",
"*",
"MockAccessResponderMockRecorder",
")",
"ToMap",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
... | // ToMap indicates an expected call of ToMap | [
"ToMap",
"indicates",
"an",
"expected",
"call",
"of",
"ToMap"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L133-L135 | train |
ory/fosite | internal/revoke_handler.go | NewMockRevocationHandler | func NewMockRevocationHandler(ctrl *gomock.Controller) *MockRevocationHandler {
mock := &MockRevocationHandler{ctrl: ctrl}
mock.recorder = &MockRevocationHandlerMockRecorder{mock}
return mock
} | go | func NewMockRevocationHandler(ctrl *gomock.Controller) *MockRevocationHandler {
mock := &MockRevocationHandler{ctrl: ctrl}
mock.recorder = &MockRevocationHandlerMockRecorder{mock}
return mock
} | [
"func",
"NewMockRevocationHandler",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockRevocationHandler",
"{",
"mock",
":=",
"&",
"MockRevocationHandler",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockRevocationHandlerM... | // NewMockRevocationHandler creates a new mock instance | [
"NewMockRevocationHandler",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/revoke_handler.go#L28-L32 | train |
ory/fosite | internal/revoke_handler.go | RevokeToken | func (m *MockRevocationHandler) RevokeToken(arg0 context.Context, arg1 string, arg2 fosite.TokenType, arg3 fosite.Client) error {
ret := m.ctrl.Call(m, "RevokeToken", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockRevocationHandler) RevokeToken(arg0 context.Context, arg1 string, arg2 fosite.TokenType, arg3 fosite.Client) error {
ret := m.ctrl.Call(m, "RevokeToken", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockRevocationHandler",
")",
"RevokeToken",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
",",
"arg2",
"fosite",
".",
"TokenType",
",",
"arg3",
"fosite",
".",
"Client",
")",
"error",
"{",
"ret",
":=",
"m",
".",
... | // RevokeToken mocks base method | [
"RevokeToken",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/revoke_handler.go#L40-L44 | train |
ory/fosite | internal/revoke_handler.go | RevokeToken | func (mr *MockRevocationHandlerMockRecorder) RevokeToken(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeToken", reflect.TypeOf((*MockRevocationHandler)(nil).RevokeToken), arg0, arg1, arg2, arg3)
} | go | func (mr *MockRevocationHandlerMockRecorder) RevokeToken(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeToken", reflect.TypeOf((*MockRevocationHandler)(nil).RevokeToken), arg0, arg1, arg2, arg3)
} | [
"func",
"(",
"mr",
"*",
"MockRevocationHandlerMockRecorder",
")",
"RevokeToken",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
",",
"arg3",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWi... | // RevokeToken indicates an expected call of RevokeToken | [
"RevokeToken",
"indicates",
"an",
"expected",
"call",
"of",
"RevokeToken"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/revoke_handler.go#L47-L49 | train |
ory/fosite | fosite.go | Append | func (a *AuthorizeEndpointHandlers) Append(h AuthorizeEndpointHandler) {
for _, this := range *a {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*a = append(*a, h)
} | go | func (a *AuthorizeEndpointHandlers) Append(h AuthorizeEndpointHandler) {
for _, this := range *a {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*a = append(*a, h)
} | [
"func",
"(",
"a",
"*",
"AuthorizeEndpointHandlers",
")",
"Append",
"(",
"h",
"AuthorizeEndpointHandler",
")",
"{",
"for",
"_",
",",
"this",
":=",
"range",
"*",
"a",
"{",
"if",
"reflect",
".",
"TypeOf",
"(",
"this",
")",
"==",
"reflect",
".",
"TypeOf",
... | // Append adds an AuthorizeEndpointHandler to this list. Ignores duplicates based on reflect.TypeOf. | [
"Append",
"adds",
"an",
"AuthorizeEndpointHandler",
"to",
"this",
"list",
".",
"Ignores",
"duplicates",
"based",
"on",
"reflect",
".",
"TypeOf",
"."
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L33-L41 | train |
ory/fosite | fosite.go | Append | func (t *TokenEndpointHandlers) Append(h TokenEndpointHandler) {
for _, this := range *t {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*t = append(*t, h)
} | go | func (t *TokenEndpointHandlers) Append(h TokenEndpointHandler) {
for _, this := range *t {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*t = append(*t, h)
} | [
"func",
"(",
"t",
"*",
"TokenEndpointHandlers",
")",
"Append",
"(",
"h",
"TokenEndpointHandler",
")",
"{",
"for",
"_",
",",
"this",
":=",
"range",
"*",
"t",
"{",
"if",
"reflect",
".",
"TypeOf",
"(",
"this",
")",
"==",
"reflect",
".",
"TypeOf",
"(",
"... | // Append adds an TokenEndpointHandler to this list. Ignores duplicates based on reflect.TypeOf. | [
"Append",
"adds",
"an",
"TokenEndpointHandler",
"to",
"this",
"list",
".",
"Ignores",
"duplicates",
"based",
"on",
"reflect",
".",
"TypeOf",
"."
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L47-L55 | train |
ory/fosite | fosite.go | Append | func (t *TokenIntrospectionHandlers) Append(h TokenIntrospector) {
for _, this := range *t {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*t = append(*t, h)
} | go | func (t *TokenIntrospectionHandlers) Append(h TokenIntrospector) {
for _, this := range *t {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*t = append(*t, h)
} | [
"func",
"(",
"t",
"*",
"TokenIntrospectionHandlers",
")",
"Append",
"(",
"h",
"TokenIntrospector",
")",
"{",
"for",
"_",
",",
"this",
":=",
"range",
"*",
"t",
"{",
"if",
"reflect",
".",
"TypeOf",
"(",
"this",
")",
"==",
"reflect",
".",
"TypeOf",
"(",
... | // Add adds an AccessTokenValidator to this list. Ignores duplicates based on reflect.TypeOf. | [
"Add",
"adds",
"an",
"AccessTokenValidator",
"to",
"this",
"list",
".",
"Ignores",
"duplicates",
"based",
"on",
"reflect",
".",
"TypeOf",
"."
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L61-L69 | train |
ory/fosite | fosite.go | Append | func (t *RevocationHandlers) Append(h RevocationHandler) {
for _, this := range *t {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*t = append(*t, h)
} | go | func (t *RevocationHandlers) Append(h RevocationHandler) {
for _, this := range *t {
if reflect.TypeOf(this) == reflect.TypeOf(h) {
return
}
}
*t = append(*t, h)
} | [
"func",
"(",
"t",
"*",
"RevocationHandlers",
")",
"Append",
"(",
"h",
"RevocationHandler",
")",
"{",
"for",
"_",
",",
"this",
":=",
"range",
"*",
"t",
"{",
"if",
"reflect",
".",
"TypeOf",
"(",
"this",
")",
"==",
"reflect",
".",
"TypeOf",
"(",
"h",
... | // Append adds an RevocationHandler to this list. Ignores duplicates based on reflect.TypeOf. | [
"Append",
"adds",
"an",
"RevocationHandler",
"to",
"this",
"list",
".",
"Ignores",
"duplicates",
"based",
"on",
"reflect",
".",
"TypeOf",
"."
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L75-L83 | train |
ory/fosite | internal/id_token_strategy.go | NewMockOpenIDConnectTokenStrategy | func NewMockOpenIDConnectTokenStrategy(ctrl *gomock.Controller) *MockOpenIDConnectTokenStrategy {
mock := &MockOpenIDConnectTokenStrategy{ctrl: ctrl}
mock.recorder = &MockOpenIDConnectTokenStrategyMockRecorder{mock}
return mock
} | go | func NewMockOpenIDConnectTokenStrategy(ctrl *gomock.Controller) *MockOpenIDConnectTokenStrategy {
mock := &MockOpenIDConnectTokenStrategy{ctrl: ctrl}
mock.recorder = &MockOpenIDConnectTokenStrategyMockRecorder{mock}
return mock
} | [
"func",
"NewMockOpenIDConnectTokenStrategy",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockOpenIDConnectTokenStrategy",
"{",
"mock",
":=",
"&",
"MockOpenIDConnectTokenStrategy",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&"... | // NewMockOpenIDConnectTokenStrategy creates a new mock instance | [
"NewMockOpenIDConnectTokenStrategy",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/id_token_strategy.go#L28-L32 | train |
ory/fosite | internal/id_token_strategy.go | GenerateIDToken | func (m *MockOpenIDConnectTokenStrategy) GenerateIDToken(arg0 context.Context, arg1 fosite.Requester) (string, error) {
ret := m.ctrl.Call(m, "GenerateIDToken", arg0, arg1)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockOpenIDConnectTokenStrategy) GenerateIDToken(arg0 context.Context, arg1 fosite.Requester) (string, error) {
ret := m.ctrl.Call(m, "GenerateIDToken", arg0, arg1)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockOpenIDConnectTokenStrategy",
")",
"GenerateIDToken",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"fosite",
".",
"Requester",
")",
"(",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",... | // GenerateIDToken mocks base method | [
"GenerateIDToken",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/id_token_strategy.go#L40-L45 | train |
ory/fosite | internal/id_token_strategy.go | GenerateIDToken | func (mr *MockOpenIDConnectTokenStrategyMockRecorder) GenerateIDToken(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateIDToken", reflect.TypeOf((*MockOpenIDConnectTokenStrategy)(nil).GenerateIDToken), arg0, arg1)
} | go | func (mr *MockOpenIDConnectTokenStrategyMockRecorder) GenerateIDToken(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateIDToken", reflect.TypeOf((*MockOpenIDConnectTokenStrategy)(nil).GenerateIDToken), arg0, arg1)
} | [
"func",
"(",
"mr",
"*",
"MockOpenIDConnectTokenStrategyMockRecorder",
")",
"GenerateIDToken",
"(",
"arg0",
",",
"arg1",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",... | // GenerateIDToken indicates an expected call of GenerateIDToken | [
"GenerateIDToken",
"indicates",
"an",
"expected",
"call",
"of",
"GenerateIDToken"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/id_token_strategy.go#L48-L50 | train |
ory/fosite | internal/transactional.go | NewMockTransactional | func NewMockTransactional(ctrl *gomock.Controller) *MockTransactional {
mock := &MockTransactional{ctrl: ctrl}
mock.recorder = &MockTransactionalMockRecorder{mock}
return mock
} | go | func NewMockTransactional(ctrl *gomock.Controller) *MockTransactional {
mock := &MockTransactional{ctrl: ctrl}
mock.recorder = &MockTransactionalMockRecorder{mock}
return mock
} | [
"func",
"NewMockTransactional",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockTransactional",
"{",
"mock",
":=",
"&",
"MockTransactional",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockTransactionalMockRecorder",
... | // NewMockTransactional creates a new mock instance | [
"NewMockTransactional",
"creates",
"a",
"new",
"mock",
"instance"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L26-L30 | train |
ory/fosite | internal/transactional.go | BeginTX | func (m *MockTransactional) BeginTX(arg0 context.Context) (context.Context, error) {
ret := m.ctrl.Call(m, "BeginTX", arg0)
ret0, _ := ret[0].(context.Context)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockTransactional) BeginTX(arg0 context.Context) (context.Context, error) {
ret := m.ctrl.Call(m, "BeginTX", arg0)
ret0, _ := ret[0].(context.Context)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockTransactional",
")",
"BeginTX",
"(",
"arg0",
"context",
".",
"Context",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
"... | // BeginTX mocks base method | [
"BeginTX",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L38-L43 | train |
ory/fosite | internal/transactional.go | Rollback | func (m *MockTransactional) Rollback(arg0 context.Context) error {
ret := m.ctrl.Call(m, "Rollback", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockTransactional) Rollback(arg0 context.Context) error {
ret := m.ctrl.Call(m, "Rollback", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockTransactional",
")",
"Rollback",
"(",
"arg0",
"context",
".",
"Context",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
... | // Rollback mocks base method | [
"Rollback",
"mocks",
"base",
"method"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L63-L67 | train |
ory/fosite | internal/transactional.go | Rollback | func (mr *MockTransactionalMockRecorder) Rollback(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rollback", reflect.TypeOf((*MockTransactional)(nil).Rollback), arg0)
} | go | func (mr *MockTransactionalMockRecorder) Rollback(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rollback", reflect.TypeOf((*MockTransactional)(nil).Rollback), arg0)
} | [
"func",
"(",
"mr",
"*",
"MockTransactionalMockRecorder",
")",
"Rollback",
"(",
"arg0",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\... | // Rollback indicates an expected call of Rollback | [
"Rollback",
"indicates",
"an",
"expected",
"call",
"of",
"Rollback"
] | 27bbe0033273157ea449310c064675127e2550e6 | https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L70-L72 | train |
cskr/pubsub | pubsub.go | New | func New(capacity int) *PubSub {
ps := &PubSub{make(chan cmd), capacity}
go ps.start()
return ps
} | go | func New(capacity int) *PubSub {
ps := &PubSub{make(chan cmd), capacity}
go ps.start()
return ps
} | [
"func",
"New",
"(",
"capacity",
"int",
")",
"*",
"PubSub",
"{",
"ps",
":=",
"&",
"PubSub",
"{",
"make",
"(",
"chan",
"cmd",
")",
",",
"capacity",
"}",
"\n",
"go",
"ps",
".",
"start",
"(",
")",
"\n",
"return",
"ps",
"\n",
"}"
] | // New creates a new PubSub and starts a goroutine for handling operations.
// The capacity of the channels created by Sub and SubOnce will be as specified. | [
"New",
"creates",
"a",
"new",
"PubSub",
"and",
"starts",
"a",
"goroutine",
"for",
"handling",
"operations",
".",
"The",
"capacity",
"of",
"the",
"channels",
"created",
"by",
"Sub",
"and",
"SubOnce",
"will",
"be",
"as",
"specified",
"."
] | 65166f5ae403cbf6dcdced31e1f8f8ad95485cb3 | https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L42-L46 | train |
cskr/pubsub | pubsub.go | AddSub | func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) {
ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch}
} | go | func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) {
ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch}
} | [
"func",
"(",
"ps",
"*",
"PubSub",
")",
"AddSub",
"(",
"ch",
"chan",
"interface",
"{",
"}",
",",
"topics",
"...",
"string",
")",
"{",
"ps",
".",
"cmdChan",
"<-",
"cmd",
"{",
"op",
":",
"sub",
",",
"topics",
":",
"topics",
",",
"ch",
":",
"ch",
"... | // AddSub adds subscriptions to an existing channel. | [
"AddSub",
"adds",
"subscriptions",
"to",
"an",
"existing",
"channel",
"."
] | 65166f5ae403cbf6dcdced31e1f8f8ad95485cb3 | https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L73-L75 | train |
cskr/pubsub | pubsub.go | AddSubOnceEach | func (ps *PubSub) AddSubOnceEach(ch chan interface{}, topics ...string) {
ps.cmdChan <- cmd{op: subOnceEach, topics: topics, ch: ch}
} | go | func (ps *PubSub) AddSubOnceEach(ch chan interface{}, topics ...string) {
ps.cmdChan <- cmd{op: subOnceEach, topics: topics, ch: ch}
} | [
"func",
"(",
"ps",
"*",
"PubSub",
")",
"AddSubOnceEach",
"(",
"ch",
"chan",
"interface",
"{",
"}",
",",
"topics",
"...",
"string",
")",
"{",
"ps",
".",
"cmdChan",
"<-",
"cmd",
"{",
"op",
":",
"subOnceEach",
",",
"topics",
":",
"topics",
",",
"ch",
... | // AddSubOnceEach adds subscriptions to an existing channel with SubOnceEach
// behavior. | [
"AddSubOnceEach",
"adds",
"subscriptions",
"to",
"an",
"existing",
"channel",
"with",
"SubOnceEach",
"behavior",
"."
] | 65166f5ae403cbf6dcdced31e1f8f8ad95485cb3 | https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L79-L81 | train |
cskr/pubsub | pubsub.go | Pub | func (ps *PubSub) Pub(msg interface{}, topics ...string) {
ps.cmdChan <- cmd{op: pub, topics: topics, msg: msg}
} | go | func (ps *PubSub) Pub(msg interface{}, topics ...string) {
ps.cmdChan <- cmd{op: pub, topics: topics, msg: msg}
} | [
"func",
"(",
"ps",
"*",
"PubSub",
")",
"Pub",
"(",
"msg",
"interface",
"{",
"}",
",",
"topics",
"...",
"string",
")",
"{",
"ps",
".",
"cmdChan",
"<-",
"cmd",
"{",
"op",
":",
"pub",
",",
"topics",
":",
"topics",
",",
"msg",
":",
"msg",
"}",
"\n"... | // Pub publishes the given message to all subscribers of
// the specified topics. | [
"Pub",
"publishes",
"the",
"given",
"message",
"to",
"all",
"subscribers",
"of",
"the",
"specified",
"topics",
"."
] | 65166f5ae403cbf6dcdced31e1f8f8ad95485cb3 | https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L85-L87 | train |
cskr/pubsub | pubsub.go | TryPub | func (ps *PubSub) TryPub(msg interface{}, topics ...string) {
ps.cmdChan <- cmd{op: tryPub, topics: topics, msg: msg}
} | go | func (ps *PubSub) TryPub(msg interface{}, topics ...string) {
ps.cmdChan <- cmd{op: tryPub, topics: topics, msg: msg}
} | [
"func",
"(",
"ps",
"*",
"PubSub",
")",
"TryPub",
"(",
"msg",
"interface",
"{",
"}",
",",
"topics",
"...",
"string",
")",
"{",
"ps",
".",
"cmdChan",
"<-",
"cmd",
"{",
"op",
":",
"tryPub",
",",
"topics",
":",
"topics",
",",
"msg",
":",
"msg",
"}",
... | // TryPub publishes the given message to all subscribers of
// the specified topics if the topic has buffer space. | [
"TryPub",
"publishes",
"the",
"given",
"message",
"to",
"all",
"subscribers",
"of",
"the",
"specified",
"topics",
"if",
"the",
"topic",
"has",
"buffer",
"space",
"."
] | 65166f5ae403cbf6dcdced31e1f8f8ad95485cb3 | https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L91-L93 | train |
cskr/pubsub | pubsub.go | Unsub | func (ps *PubSub) Unsub(ch chan interface{}, topics ...string) {
if len(topics) == 0 {
ps.cmdChan <- cmd{op: unsubAll, ch: ch}
return
}
ps.cmdChan <- cmd{op: unsub, topics: topics, ch: ch}
} | go | func (ps *PubSub) Unsub(ch chan interface{}, topics ...string) {
if len(topics) == 0 {
ps.cmdChan <- cmd{op: unsubAll, ch: ch}
return
}
ps.cmdChan <- cmd{op: unsub, topics: topics, ch: ch}
} | [
"func",
"(",
"ps",
"*",
"PubSub",
")",
"Unsub",
"(",
"ch",
"chan",
"interface",
"{",
"}",
",",
"topics",
"...",
"string",
")",
"{",
"if",
"len",
"(",
"topics",
")",
"==",
"0",
"{",
"ps",
".",
"cmdChan",
"<-",
"cmd",
"{",
"op",
":",
"unsubAll",
... | // Unsub unsubscribes the given channel from the specified
// topics. If no topic is specified, it is unsubscribed
// from all topics.
//
// Unsub must be called from a goroutine that is different from the subscriber.
// The subscriber must consume messages from the channel until it reaches the
// end. Not doing so can result in a deadlock. | [
"Unsub",
"unsubscribes",
"the",
"given",
"channel",
"from",
"the",
"specified",
"topics",
".",
"If",
"no",
"topic",
"is",
"specified",
"it",
"is",
"unsubscribed",
"from",
"all",
"topics",
".",
"Unsub",
"must",
"be",
"called",
"from",
"a",
"goroutine",
"that"... | 65166f5ae403cbf6dcdced31e1f8f8ad95485cb3 | https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L102-L109 | train |
cskr/pubsub | pubsub.go | Close | func (ps *PubSub) Close(topics ...string) {
ps.cmdChan <- cmd{op: closeTopic, topics: topics}
} | go | func (ps *PubSub) Close(topics ...string) {
ps.cmdChan <- cmd{op: closeTopic, topics: topics}
} | [
"func",
"(",
"ps",
"*",
"PubSub",
")",
"Close",
"(",
"topics",
"...",
"string",
")",
"{",
"ps",
".",
"cmdChan",
"<-",
"cmd",
"{",
"op",
":",
"closeTopic",
",",
"topics",
":",
"topics",
"}",
"\n",
"}"
] | // Close closes all channels currently subscribed to the specified topics.
// If a channel is subscribed to multiple topics, some of which is
// not specified, it is not closed. | [
"Close",
"closes",
"all",
"channels",
"currently",
"subscribed",
"to",
"the",
"specified",
"topics",
".",
"If",
"a",
"channel",
"is",
"subscribed",
"to",
"multiple",
"topics",
"some",
"of",
"which",
"is",
"not",
"specified",
"it",
"is",
"not",
"closed",
"."
... | 65166f5ae403cbf6dcdced31e1f8f8ad95485cb3 | https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L114-L116 | train |
gosuri/uiprogress | progress.go | New | func New() *Progress {
lw := uilive.New()
lw.Out = Out
return &Progress{
Width: Width,
Out: Out,
Bars: make([]*Bar, 0),
RefreshInterval: RefreshInterval,
tdone: make(chan bool),
lw: uilive.New(),
mtx: &sync.RWMutex{},
}
} | go | func New() *Progress {
lw := uilive.New()
lw.Out = Out
return &Progress{
Width: Width,
Out: Out,
Bars: make([]*Bar, 0),
RefreshInterval: RefreshInterval,
tdone: make(chan bool),
lw: uilive.New(),
mtx: &sync.RWMutex{},
}
} | [
"func",
"New",
"(",
")",
"*",
"Progress",
"{",
"lw",
":=",
"uilive",
".",
"New",
"(",
")",
"\n",
"lw",
".",
"Out",
"=",
"Out",
"\n\n",
"return",
"&",
"Progress",
"{",
"Width",
":",
"Width",
",",
"Out",
":",
"Out",
",",
"Bars",
":",
"make",
"(",... | // New returns a new progress bar with defaults | [
"New",
"returns",
"a",
"new",
"progress",
"bar",
"with",
"defaults"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/progress.go#L43-L57 | train |
gosuri/uiprogress | progress.go | AddBar | func (p *Progress) AddBar(total int) *Bar {
p.mtx.Lock()
defer p.mtx.Unlock()
bar := NewBar(total)
bar.Width = p.Width
p.Bars = append(p.Bars, bar)
return bar
} | go | func (p *Progress) AddBar(total int) *Bar {
p.mtx.Lock()
defer p.mtx.Unlock()
bar := NewBar(total)
bar.Width = p.Width
p.Bars = append(p.Bars, bar)
return bar
} | [
"func",
"(",
"p",
"*",
"Progress",
")",
"AddBar",
"(",
"total",
"int",
")",
"*",
"Bar",
"{",
"p",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"bar",
":=",
"NewBar",
"(",
"total",
")",
"\... | // AddBar creates a new progress bar and adds to the container | [
"AddBar",
"creates",
"a",
"new",
"progress",
"bar",
"and",
"adds",
"to",
"the",
"container"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/progress.go#L94-L102 | train |
gosuri/uiprogress | progress.go | Listen | func (p *Progress) Listen() {
for {
p.mtx.Lock()
interval := p.RefreshInterval
p.mtx.Unlock()
select {
case <-time.After(interval):
p.print()
case <-p.tdone:
p.print()
close(p.tdone)
return
}
}
} | go | func (p *Progress) Listen() {
for {
p.mtx.Lock()
interval := p.RefreshInterval
p.mtx.Unlock()
select {
case <-time.After(interval):
p.print()
case <-p.tdone:
p.print()
close(p.tdone)
return
}
}
} | [
"func",
"(",
"p",
"*",
"Progress",
")",
"Listen",
"(",
")",
"{",
"for",
"{",
"p",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"interval",
":=",
"p",
".",
"RefreshInterval",
"\n",
"p",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"select",
"{",
"ca... | // Listen listens for updates and renders the progress bars | [
"Listen",
"listens",
"for",
"updates",
"and",
"renders",
"the",
"progress",
"bars"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/progress.go#L105-L121 | train |
gosuri/uiprogress | bar.go | NewBar | func NewBar(total int) *Bar {
return &Bar{
Total: total,
Width: Width,
LeftEnd: LeftEnd,
RightEnd: RightEnd,
Head: Head,
Fill: Fill,
Empty: Empty,
mtx: &sync.RWMutex{},
}
} | go | func NewBar(total int) *Bar {
return &Bar{
Total: total,
Width: Width,
LeftEnd: LeftEnd,
RightEnd: RightEnd,
Head: Head,
Fill: Fill,
Empty: Empty,
mtx: &sync.RWMutex{},
}
} | [
"func",
"NewBar",
"(",
"total",
"int",
")",
"*",
"Bar",
"{",
"return",
"&",
"Bar",
"{",
"Total",
":",
"total",
",",
"Width",
":",
"Width",
",",
"LeftEnd",
":",
"LeftEnd",
",",
"RightEnd",
":",
"RightEnd",
",",
"Head",
":",
"Head",
",",
"Fill",
":",... | // NewBar returns a new progress bar | [
"NewBar",
"returns",
"a",
"new",
"progress",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L76-L88 | train |
gosuri/uiprogress | bar.go | Set | func (b *Bar) Set(n int) error {
b.mtx.Lock()
defer b.mtx.Unlock()
if n > b.Total {
return ErrMaxCurrentReached
}
b.current = n
return nil
} | go | func (b *Bar) Set(n int) error {
b.mtx.Lock()
defer b.mtx.Unlock()
if n > b.Total {
return ErrMaxCurrentReached
}
b.current = n
return nil
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"Set",
"(",
"n",
"int",
")",
"error",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"n",
">",
"b",
".",
"Total",
"{",
"return",
"ErrMax... | // Set the current count of the bar. It returns ErrMaxCurrentReached when trying n exceeds the total value. This is atomic operation and concurancy safe. | [
"Set",
"the",
"current",
"count",
"of",
"the",
"bar",
".",
"It",
"returns",
"ErrMaxCurrentReached",
"when",
"trying",
"n",
"exceeds",
"the",
"total",
"value",
".",
"This",
"is",
"atomic",
"operation",
"and",
"concurancy",
"safe",
"."
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L91-L100 | train |
gosuri/uiprogress | bar.go | Incr | func (b *Bar) Incr() bool {
b.mtx.Lock()
defer b.mtx.Unlock()
n := b.current + 1
if n > b.Total {
return false
}
var t time.Time
if b.TimeStarted == t {
b.TimeStarted = time.Now()
}
b.timeElapsed = time.Since(b.TimeStarted)
b.current = n
return true
} | go | func (b *Bar) Incr() bool {
b.mtx.Lock()
defer b.mtx.Unlock()
n := b.current + 1
if n > b.Total {
return false
}
var t time.Time
if b.TimeStarted == t {
b.TimeStarted = time.Now()
}
b.timeElapsed = time.Since(b.TimeStarted)
b.current = n
return true
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"Incr",
"(",
")",
"bool",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"n",
":=",
"b",
".",
"current",
"+",
"1",
"\n",
"if",
"n",
">",
"b"... | // Incr increments the current value by 1, time elapsed to current time and returns true. It returns false if the cursor has reached or exceeds total value. | [
"Incr",
"increments",
"the",
"current",
"value",
"by",
"1",
"time",
"elapsed",
"to",
"current",
"time",
"and",
"returns",
"true",
".",
"It",
"returns",
"false",
"if",
"the",
"cursor",
"has",
"reached",
"or",
"exceeds",
"total",
"value",
"."
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L103-L118 | train |
gosuri/uiprogress | bar.go | Current | func (b *Bar) Current() int {
b.mtx.RLock()
defer b.mtx.RUnlock()
return b.current
} | go | func (b *Bar) Current() int {
b.mtx.RLock()
defer b.mtx.RUnlock()
return b.current
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"Current",
"(",
")",
"int",
"{",
"b",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"b",
".",
"current",
"\n",
"}"
] | // Current returns the current progress of the bar | [
"Current",
"returns",
"the",
"current",
"progress",
"of",
"the",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L121-L125 | train |
gosuri/uiprogress | bar.go | AppendFunc | func (b *Bar) AppendFunc(f DecoratorFunc) *Bar {
b.mtx.Lock()
defer b.mtx.Unlock()
b.appendFuncs = append(b.appendFuncs, f)
return b
} | go | func (b *Bar) AppendFunc(f DecoratorFunc) *Bar {
b.mtx.Lock()
defer b.mtx.Unlock()
b.appendFuncs = append(b.appendFuncs, f)
return b
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"AppendFunc",
"(",
"f",
"DecoratorFunc",
")",
"*",
"Bar",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"b",
".",
"appendFuncs",
"=",
"append",
"("... | // AppendFunc runs the decorator function and renders the output on the right of the progress bar | [
"AppendFunc",
"runs",
"the",
"decorator",
"function",
"and",
"renders",
"the",
"output",
"on",
"the",
"right",
"of",
"the",
"progress",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L128-L133 | train |
gosuri/uiprogress | bar.go | AppendCompleted | func (b *Bar) AppendCompleted() *Bar {
b.AppendFunc(func(b *Bar) string {
return b.CompletedPercentString()
})
return b
} | go | func (b *Bar) AppendCompleted() *Bar {
b.AppendFunc(func(b *Bar) string {
return b.CompletedPercentString()
})
return b
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"AppendCompleted",
"(",
")",
"*",
"Bar",
"{",
"b",
".",
"AppendFunc",
"(",
"func",
"(",
"b",
"*",
"Bar",
")",
"string",
"{",
"return",
"b",
".",
"CompletedPercentString",
"(",
")",
"\n",
"}",
")",
"\n",
"return",
... | // AppendCompleted appends the completion percent to the progress bar | [
"AppendCompleted",
"appends",
"the",
"completion",
"percent",
"to",
"the",
"progress",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L136-L141 | train |
gosuri/uiprogress | bar.go | AppendElapsed | func (b *Bar) AppendElapsed() *Bar {
b.AppendFunc(func(b *Bar) string {
return strutil.PadLeft(b.TimeElapsedString(), 5, ' ')
})
return b
} | go | func (b *Bar) AppendElapsed() *Bar {
b.AppendFunc(func(b *Bar) string {
return strutil.PadLeft(b.TimeElapsedString(), 5, ' ')
})
return b
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"AppendElapsed",
"(",
")",
"*",
"Bar",
"{",
"b",
".",
"AppendFunc",
"(",
"func",
"(",
"b",
"*",
"Bar",
")",
"string",
"{",
"return",
"strutil",
".",
"PadLeft",
"(",
"b",
".",
"TimeElapsedString",
"(",
")",
",",
... | // AppendElapsed appends the time elapsed the be progress bar | [
"AppendElapsed",
"appends",
"the",
"time",
"elapsed",
"the",
"be",
"progress",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L144-L149 | train |
gosuri/uiprogress | bar.go | PrependFunc | func (b *Bar) PrependFunc(f DecoratorFunc) *Bar {
b.mtx.Lock()
defer b.mtx.Unlock()
b.prependFuncs = append(b.prependFuncs, f)
return b
} | go | func (b *Bar) PrependFunc(f DecoratorFunc) *Bar {
b.mtx.Lock()
defer b.mtx.Unlock()
b.prependFuncs = append(b.prependFuncs, f)
return b
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"PrependFunc",
"(",
"f",
"DecoratorFunc",
")",
"*",
"Bar",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"b",
".",
"prependFuncs",
"=",
"append",
"... | // PrependFunc runs decorator function and render the output left the progress bar | [
"PrependFunc",
"runs",
"decorator",
"function",
"and",
"render",
"the",
"output",
"left",
"the",
"progress",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L152-L157 | train |
gosuri/uiprogress | bar.go | PrependCompleted | func (b *Bar) PrependCompleted() *Bar {
b.PrependFunc(func(b *Bar) string {
return b.CompletedPercentString()
})
return b
} | go | func (b *Bar) PrependCompleted() *Bar {
b.PrependFunc(func(b *Bar) string {
return b.CompletedPercentString()
})
return b
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"PrependCompleted",
"(",
")",
"*",
"Bar",
"{",
"b",
".",
"PrependFunc",
"(",
"func",
"(",
"b",
"*",
"Bar",
")",
"string",
"{",
"return",
"b",
".",
"CompletedPercentString",
"(",
")",
"\n",
"}",
")",
"\n",
"return"... | // PrependCompleted prepends the precent completed to the progress bar | [
"PrependCompleted",
"prepends",
"the",
"precent",
"completed",
"to",
"the",
"progress",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L160-L165 | train |
gosuri/uiprogress | bar.go | PrependElapsed | func (b *Bar) PrependElapsed() *Bar {
b.PrependFunc(func(b *Bar) string {
return strutil.PadLeft(b.TimeElapsedString(), 5, ' ')
})
return b
} | go | func (b *Bar) PrependElapsed() *Bar {
b.PrependFunc(func(b *Bar) string {
return strutil.PadLeft(b.TimeElapsedString(), 5, ' ')
})
return b
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"PrependElapsed",
"(",
")",
"*",
"Bar",
"{",
"b",
".",
"PrependFunc",
"(",
"func",
"(",
"b",
"*",
"Bar",
")",
"string",
"{",
"return",
"strutil",
".",
"PadLeft",
"(",
"b",
".",
"TimeElapsedString",
"(",
")",
",",
... | // PrependElapsed prepends the time elapsed to the begining of the bar | [
"PrependElapsed",
"prepends",
"the",
"time",
"elapsed",
"to",
"the",
"begining",
"of",
"the",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L168-L173 | train |
gosuri/uiprogress | bar.go | Bytes | func (b *Bar) Bytes() []byte {
completedWidth := int(float64(b.Width) * (b.CompletedPercent() / 100.00))
// add fill and empty bits
var buf bytes.Buffer
for i := 0; i < completedWidth; i++ {
buf.WriteByte(b.Fill)
}
for i := 0; i < b.Width-completedWidth; i++ {
buf.WriteByte(b.Empty)
}
// set head bit
pb := buf.Bytes()
if completedWidth > 0 && completedWidth < b.Width {
pb[completedWidth-1] = b.Head
}
// set left and right ends bits
pb[0], pb[len(pb)-1] = b.LeftEnd, b.RightEnd
// render append functions to the right of the bar
for _, f := range b.appendFuncs {
pb = append(pb, ' ')
pb = append(pb, []byte(f(b))...)
}
// render prepend functions to the left of the bar
for _, f := range b.prependFuncs {
args := []byte(f(b))
args = append(args, ' ')
pb = append(args, pb...)
}
return pb
} | go | func (b *Bar) Bytes() []byte {
completedWidth := int(float64(b.Width) * (b.CompletedPercent() / 100.00))
// add fill and empty bits
var buf bytes.Buffer
for i := 0; i < completedWidth; i++ {
buf.WriteByte(b.Fill)
}
for i := 0; i < b.Width-completedWidth; i++ {
buf.WriteByte(b.Empty)
}
// set head bit
pb := buf.Bytes()
if completedWidth > 0 && completedWidth < b.Width {
pb[completedWidth-1] = b.Head
}
// set left and right ends bits
pb[0], pb[len(pb)-1] = b.LeftEnd, b.RightEnd
// render append functions to the right of the bar
for _, f := range b.appendFuncs {
pb = append(pb, ' ')
pb = append(pb, []byte(f(b))...)
}
// render prepend functions to the left of the bar
for _, f := range b.prependFuncs {
args := []byte(f(b))
args = append(args, ' ')
pb = append(args, pb...)
}
return pb
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"Bytes",
"(",
")",
"[",
"]",
"byte",
"{",
"completedWidth",
":=",
"int",
"(",
"float64",
"(",
"b",
".",
"Width",
")",
"*",
"(",
"b",
".",
"CompletedPercent",
"(",
")",
"/",
"100.00",
")",
")",
"\n\n",
"// add fi... | // Bytes returns the byte presentation of the progress bar | [
"Bytes",
"returns",
"the",
"byte",
"presentation",
"of",
"the",
"progress",
"bar"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L176-L210 | train |
gosuri/uiprogress | bar.go | CompletedPercent | func (b *Bar) CompletedPercent() float64 {
return (float64(b.Current()) / float64(b.Total)) * 100.00
} | go | func (b *Bar) CompletedPercent() float64 {
return (float64(b.Current()) / float64(b.Total)) * 100.00
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"CompletedPercent",
"(",
")",
"float64",
"{",
"return",
"(",
"float64",
"(",
"b",
".",
"Current",
"(",
")",
")",
"/",
"float64",
"(",
"b",
".",
"Total",
")",
")",
"*",
"100.00",
"\n",
"}"
] | // CompletedPercent return the percent completed | [
"CompletedPercent",
"return",
"the",
"percent",
"completed"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L218-L220 | train |
gosuri/uiprogress | bar.go | TimeElapsed | func (b *Bar) TimeElapsed() time.Duration {
b.mtx.RLock()
defer b.mtx.RUnlock()
return b.timeElapsed
} | go | func (b *Bar) TimeElapsed() time.Duration {
b.mtx.RLock()
defer b.mtx.RUnlock()
return b.timeElapsed
} | [
"func",
"(",
"b",
"*",
"Bar",
")",
"TimeElapsed",
"(",
")",
"time",
".",
"Duration",
"{",
"b",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"b",
".",
"timeElapsed",
"\n",
"}"
] | // TimeElapsed returns the time elapsed | [
"TimeElapsed",
"returns",
"the",
"time",
"elapsed"
] | d0567a9d84a1c40dd7568115ea66f4887bf57b33 | https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L228-L232 | train |
goreleaser/nfpm | glob/glob.go | longestCommonPrefix | func longestCommonPrefix(strs []string) string {
if len(strs) == 0 {
return ""
}
lcp := strs[0]
for _, str := range strs {
lcp = strlcp(lcp, str)
}
return lcp
} | go | func longestCommonPrefix(strs []string) string {
if len(strs) == 0 {
return ""
}
lcp := strs[0]
for _, str := range strs {
lcp = strlcp(lcp, str)
}
return lcp
} | [
"func",
"longestCommonPrefix",
"(",
"strs",
"[",
"]",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"strs",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"lcp",
":=",
"strs",
"[",
"0",
"]",
"\n",
"for",
"_",
",",
"str",
":=",
"r... | // longestCommonPrefix returns the longest prefix of all strings the argument
// slice. If the slice is empty the empty string is returned | [
"longestCommonPrefix",
"returns",
"the",
"longest",
"prefix",
"of",
"all",
"strings",
"the",
"argument",
"slice",
".",
"If",
"the",
"slice",
"is",
"empty",
"the",
"empty",
"string",
"is",
"returned"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/glob/glob.go#L15-L24 | train |
goreleaser/nfpm | deb/deb.go | Package | func (*Deb) Package(info nfpm.Info, deb io.Writer) (err error) {
arch, ok := archToDebian[info.Arch]
if ok {
info.Arch = arch
}
dataTarGz, md5sums, instSize, err := createDataTarGz(info)
if err != nil {
return err
}
controlTarGz, err := createControl(instSize, md5sums, info)
if err != nil {
return err
}
var w = ar.NewWriter(deb)
if err := w.WriteGlobalHeader(); err != nil {
return errors.Wrap(err, "cannot write ar header to deb file")
}
if err := addArFile(w, "debian-binary", []byte("2.0\n")); err != nil {
return errors.Wrap(err, "cannot pack debian-binary")
}
if err := addArFile(w, "control.tar.gz", controlTarGz); err != nil {
return errors.Wrap(err, "cannot add control.tar.gz to deb")
}
if err := addArFile(w, "data.tar.gz", dataTarGz); err != nil {
return errors.Wrap(err, "cannot add data.tar.gz to deb")
}
return nil
} | go | func (*Deb) Package(info nfpm.Info, deb io.Writer) (err error) {
arch, ok := archToDebian[info.Arch]
if ok {
info.Arch = arch
}
dataTarGz, md5sums, instSize, err := createDataTarGz(info)
if err != nil {
return err
}
controlTarGz, err := createControl(instSize, md5sums, info)
if err != nil {
return err
}
var w = ar.NewWriter(deb)
if err := w.WriteGlobalHeader(); err != nil {
return errors.Wrap(err, "cannot write ar header to deb file")
}
if err := addArFile(w, "debian-binary", []byte("2.0\n")); err != nil {
return errors.Wrap(err, "cannot pack debian-binary")
}
if err := addArFile(w, "control.tar.gz", controlTarGz); err != nil {
return errors.Wrap(err, "cannot add control.tar.gz to deb")
}
if err := addArFile(w, "data.tar.gz", dataTarGz); err != nil {
return errors.Wrap(err, "cannot add data.tar.gz to deb")
}
return nil
} | [
"func",
"(",
"*",
"Deb",
")",
"Package",
"(",
"info",
"nfpm",
".",
"Info",
",",
"deb",
"io",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"arch",
",",
"ok",
":=",
"archToDebian",
"[",
"info",
".",
"Arch",
"]",
"\n",
"if",
"ok",
"{",
"info... | // Package writes a new deb package to the given writer using the given info | [
"Package",
"writes",
"a",
"new",
"deb",
"package",
"to",
"the",
"given",
"writer",
"using",
"the",
"given",
"info"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/deb/deb.go#L47-L74 | train |
goreleaser/nfpm | deb/deb.go | createTree | func createTree(tarw *tar.Writer, dst string, created map[string]bool) error {
for _, path := range pathsToCreate(dst) {
if created[path] {
// skipping dir that was previously created inside the archive
// (eg: usr/)
continue
}
if err := tarw.WriteHeader(&tar.Header{
Name: filepath.ToSlash(path + "/"),
Mode: 0755,
Typeflag: tar.TypeDir,
Format: tar.FormatGNU,
ModTime: time.Now(),
}); err != nil {
return errors.Wrap(err, "failed to create folder")
}
created[path] = true
}
return nil
} | go | func createTree(tarw *tar.Writer, dst string, created map[string]bool) error {
for _, path := range pathsToCreate(dst) {
if created[path] {
// skipping dir that was previously created inside the archive
// (eg: usr/)
continue
}
if err := tarw.WriteHeader(&tar.Header{
Name: filepath.ToSlash(path + "/"),
Mode: 0755,
Typeflag: tar.TypeDir,
Format: tar.FormatGNU,
ModTime: time.Now(),
}); err != nil {
return errors.Wrap(err, "failed to create folder")
}
created[path] = true
}
return nil
} | [
"func",
"createTree",
"(",
"tarw",
"*",
"tar",
".",
"Writer",
",",
"dst",
"string",
",",
"created",
"map",
"[",
"string",
"]",
"bool",
")",
"error",
"{",
"for",
"_",
",",
"path",
":=",
"range",
"pathsToCreate",
"(",
"dst",
")",
"{",
"if",
"created",
... | // this is needed because the data.tar.gz file should have the empty folders
// as well, so we walk through the dst and create all subfolders. | [
"this",
"is",
"needed",
"because",
"the",
"data",
".",
"tar",
".",
"gz",
"file",
"should",
"have",
"the",
"empty",
"folders",
"as",
"well",
"so",
"we",
"walk",
"through",
"the",
"dst",
"and",
"create",
"all",
"subfolders",
"."
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/deb/deb.go#L285-L304 | train |
goreleaser/nfpm | rpm/rpm.go | Package | func (*RPM) Package(info nfpm.Info, w io.Writer) error {
arch, ok := archToRPM[info.Arch]
if ok {
info.Arch = arch
}
info.Version = strings.Replace(info.Version, "-", "_", -1)
_, err := exec.LookPath("rpmbuild")
if err != nil {
return fmt.Errorf("rpmbuild not present in $PATH")
}
temps, err := setupTempFiles(info)
if err != nil {
return err
}
if err = createTarGz(info, temps.Folder, temps.Source); err != nil {
return err
}
if err = createSpec(info, temps.Spec); err != nil {
return errors.Wrap(err, "failed to create rpm spec file")
}
var args = []string{
"--verbose",
"--define", fmt.Sprintf("_topdir %s", temps.Root),
"--define", fmt.Sprintf("_tmppath %s/tmp", temps.Root),
"--target", fmt.Sprintf("%s-unknown-%s", info.Arch, info.Platform),
"-ba",
"SPECS/" + info.Name + ".spec",
}
cmd := exec.Command("rpmbuild", args...) //nolint:gosec
cmd.Dir = temps.Root
out, err := cmd.CombinedOutput()
if err != nil {
var msg = "rpmbuild failed"
if string(out) != "" {
msg += ": " + string(out)
}
return errors.Wrap(err, msg)
}
rpm, err := os.Open(temps.RPM)
if err != nil {
return errors.Wrap(err, "failed open rpm file")
}
_, err = io.Copy(w, rpm)
return errors.Wrap(err, "failed to copy rpm file to writer")
} | go | func (*RPM) Package(info nfpm.Info, w io.Writer) error {
arch, ok := archToRPM[info.Arch]
if ok {
info.Arch = arch
}
info.Version = strings.Replace(info.Version, "-", "_", -1)
_, err := exec.LookPath("rpmbuild")
if err != nil {
return fmt.Errorf("rpmbuild not present in $PATH")
}
temps, err := setupTempFiles(info)
if err != nil {
return err
}
if err = createTarGz(info, temps.Folder, temps.Source); err != nil {
return err
}
if err = createSpec(info, temps.Spec); err != nil {
return errors.Wrap(err, "failed to create rpm spec file")
}
var args = []string{
"--verbose",
"--define", fmt.Sprintf("_topdir %s", temps.Root),
"--define", fmt.Sprintf("_tmppath %s/tmp", temps.Root),
"--target", fmt.Sprintf("%s-unknown-%s", info.Arch, info.Platform),
"-ba",
"SPECS/" + info.Name + ".spec",
}
cmd := exec.Command("rpmbuild", args...) //nolint:gosec
cmd.Dir = temps.Root
out, err := cmd.CombinedOutput()
if err != nil {
var msg = "rpmbuild failed"
if string(out) != "" {
msg += ": " + string(out)
}
return errors.Wrap(err, msg)
}
rpm, err := os.Open(temps.RPM)
if err != nil {
return errors.Wrap(err, "failed open rpm file")
}
_, err = io.Copy(w, rpm)
return errors.Wrap(err, "failed to copy rpm file to writer")
} | [
"func",
"(",
"*",
"RPM",
")",
"Package",
"(",
"info",
"nfpm",
".",
"Info",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"arch",
",",
"ok",
":=",
"archToRPM",
"[",
"info",
".",
"Arch",
"]",
"\n",
"if",
"ok",
"{",
"info",
".",
"Arch",
"=",
... | // Package writes a new RPM package to the given writer using the given info | [
"Package",
"writes",
"a",
"new",
"RPM",
"package",
"to",
"the",
"given",
"writer",
"using",
"the",
"given",
"info"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/rpm/rpm.go#L43-L89 | train |
goreleaser/nfpm | nfpm.go | Register | func Register(format string, p Packager) {
lock.Lock()
packagers[format] = p
lock.Unlock()
} | go | func Register(format string, p Packager) {
lock.Lock()
packagers[format] = p
lock.Unlock()
} | [
"func",
"Register",
"(",
"format",
"string",
",",
"p",
"Packager",
")",
"{",
"lock",
".",
"Lock",
"(",
")",
"\n",
"packagers",
"[",
"format",
"]",
"=",
"p",
"\n",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // Register a new packager for the given format | [
"Register",
"a",
"new",
"packager",
"for",
"the",
"given",
"format"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L24-L28 | train |
goreleaser/nfpm | nfpm.go | Get | func Get(format string) (Packager, error) {
p, ok := packagers[format]
if !ok {
return nil, fmt.Errorf("no packager registered for the format %s", format)
}
return p, nil
} | go | func Get(format string) (Packager, error) {
p, ok := packagers[format]
if !ok {
return nil, fmt.Errorf("no packager registered for the format %s", format)
}
return p, nil
} | [
"func",
"Get",
"(",
"format",
"string",
")",
"(",
"Packager",
",",
"error",
")",
"{",
"p",
",",
"ok",
":=",
"packagers",
"[",
"format",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"format",
... | // Get a packager for the given format | [
"Get",
"a",
"packager",
"for",
"the",
"given",
"format"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L31-L37 | train |
goreleaser/nfpm | nfpm.go | Parse | func Parse(in io.Reader) (config Config, err error) {
dec := yaml.NewDecoder(in)
dec.SetStrict(true)
if err = dec.Decode(&config); err != nil {
return
}
config.Info.Version = os.ExpandEnv(config.Info.Version)
err = config.Validate()
return
} | go | func Parse(in io.Reader) (config Config, err error) {
dec := yaml.NewDecoder(in)
dec.SetStrict(true)
if err = dec.Decode(&config); err != nil {
return
}
config.Info.Version = os.ExpandEnv(config.Info.Version)
err = config.Validate()
return
} | [
"func",
"Parse",
"(",
"in",
"io",
".",
"Reader",
")",
"(",
"config",
"Config",
",",
"err",
"error",
")",
"{",
"dec",
":=",
"yaml",
".",
"NewDecoder",
"(",
"in",
")",
"\n",
"dec",
".",
"SetStrict",
"(",
"true",
")",
"\n",
"if",
"err",
"=",
"dec",
... | // Parse decodes YAML data from an io.Reader into a configuration struct | [
"Parse",
"decodes",
"YAML",
"data",
"from",
"an",
"io",
".",
"Reader",
"into",
"a",
"configuration",
"struct"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L40-L50 | train |
goreleaser/nfpm | nfpm.go | ParseFile | func ParseFile(path string) (config Config, err error) {
var file *os.File
file, err = os.Open(path) //nolint:gosec
if err != nil {
return
}
defer file.Close() // nolint: errcheck
return Parse(file)
} | go | func ParseFile(path string) (config Config, err error) {
var file *os.File
file, err = os.Open(path) //nolint:gosec
if err != nil {
return
}
defer file.Close() // nolint: errcheck
return Parse(file)
} | [
"func",
"ParseFile",
"(",
"path",
"string",
")",
"(",
"config",
"Config",
",",
"err",
"error",
")",
"{",
"var",
"file",
"*",
"os",
".",
"File",
"\n",
"file",
",",
"err",
"=",
"os",
".",
"Open",
"(",
"path",
")",
"//nolint:gosec",
"\n",
"if",
"err",... | // ParseFile decodes YAML data from a file path into a configuration struct | [
"ParseFile",
"decodes",
"YAML",
"data",
"from",
"a",
"file",
"path",
"into",
"a",
"configuration",
"struct"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L53-L61 | train |
goreleaser/nfpm | nfpm.go | Get | func (c *Config) Get(format string) (info Info, err error) {
// make a deep copy of info
if err = mergo.Merge(&info, c.Info); err != nil {
return
}
override, ok := c.Overrides[format]
if !ok {
// no overrides
return
}
err = mergo.Merge(&info.Overridables, override, mergo.WithOverride)
if err != nil {
return
}
return
} | go | func (c *Config) Get(format string) (info Info, err error) {
// make a deep copy of info
if err = mergo.Merge(&info, c.Info); err != nil {
return
}
override, ok := c.Overrides[format]
if !ok {
// no overrides
return
}
err = mergo.Merge(&info.Overridables, override, mergo.WithOverride)
if err != nil {
return
}
return
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"Get",
"(",
"format",
"string",
")",
"(",
"info",
"Info",
",",
"err",
"error",
")",
"{",
"// make a deep copy of info",
"if",
"err",
"=",
"mergo",
".",
"Merge",
"(",
"&",
"info",
",",
"c",
".",
"Info",
")",
";"... | // Get returns the Info struct for the given packager format. Overrides
// for the given format are merged into the final struct | [
"Get",
"returns",
"the",
"Info",
"struct",
"for",
"the",
"given",
"packager",
"format",
".",
"Overrides",
"for",
"the",
"given",
"format",
"are",
"merged",
"into",
"the",
"final",
"struct"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L76-L91 | train |
goreleaser/nfpm | nfpm.go | Validate | func (c *Config) Validate() error {
for format := range c.Overrides {
if _, err := Get(format); err != nil {
return err
}
}
return nil
} | go | func (c *Config) Validate() error {
for format := range c.Overrides {
if _, err := Get(format); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"Validate",
"(",
")",
"error",
"{",
"for",
"format",
":=",
"range",
"c",
".",
"Overrides",
"{",
"if",
"_",
",",
"err",
":=",
"Get",
"(",
"format",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"... | // Validate ensures that the config is well typed | [
"Validate",
"ensures",
"that",
"the",
"config",
"is",
"well",
"typed"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L94-L101 | train |
goreleaser/nfpm | nfpm.go | Validate | func Validate(info Info) error {
if info.Name == "" {
return fmt.Errorf("package name cannot be empty")
}
if info.Arch == "" {
return fmt.Errorf("package arch must be provided")
}
if info.Version == "" {
return fmt.Errorf("package version must be provided")
}
if len(info.Files)+len(info.ConfigFiles) == 0 {
return fmt.Errorf("no files were provided")
}
return nil
} | go | func Validate(info Info) error {
if info.Name == "" {
return fmt.Errorf("package name cannot be empty")
}
if info.Arch == "" {
return fmt.Errorf("package arch must be provided")
}
if info.Version == "" {
return fmt.Errorf("package version must be provided")
}
if len(info.Files)+len(info.ConfigFiles) == 0 {
return fmt.Errorf("no files were provided")
}
return nil
} | [
"func",
"Validate",
"(",
"info",
"Info",
")",
"error",
"{",
"if",
"info",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"info",
".",
"Arch",
"==",
"\"",
"\"",
"{",
"return",
"fm... | // Validate the given Info and returns an error if it is invalid. | [
"Validate",
"the",
"given",
"Info",
"and",
"returns",
"an",
"error",
"if",
"it",
"is",
"invalid",
"."
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L143-L157 | train |
goreleaser/nfpm | nfpm.go | WithDefaults | func WithDefaults(info Info) Info {
if info.Bindir == "" {
info.Bindir = "/usr/local/bin"
}
if info.Platform == "" {
info.Platform = "linux"
}
if info.Description == "" {
info.Description = "no description given"
}
info.Version = strings.TrimPrefix(info.Version, "v")
return info
} | go | func WithDefaults(info Info) Info {
if info.Bindir == "" {
info.Bindir = "/usr/local/bin"
}
if info.Platform == "" {
info.Platform = "linux"
}
if info.Description == "" {
info.Description = "no description given"
}
info.Version = strings.TrimPrefix(info.Version, "v")
return info
} | [
"func",
"WithDefaults",
"(",
"info",
"Info",
")",
"Info",
"{",
"if",
"info",
".",
"Bindir",
"==",
"\"",
"\"",
"{",
"info",
".",
"Bindir",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"info",
".",
"Platform",
"==",
"\"",
"\"",
"{",
"info",
".",
"Platfo... | // WithDefaults set some sane defaults into the given Info | [
"WithDefaults",
"set",
"some",
"sane",
"defaults",
"into",
"the",
"given",
"Info"
] | 21aa86065385f2c769cb56f151344d46e8c6c5da | https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L160-L172 | train |
tsuna/gohbase | region/client.go | QueueRPC | func (c *client) QueueRPC(rpc hrpc.Call) {
if b, ok := rpc.(hrpc.Batchable); ok && c.rpcQueueSize > 1 && !b.SkipBatch() {
// queue up the rpc
select {
case <-rpc.Context().Done():
// rpc timed out before being processed
case <-c.done:
returnResult(rpc, nil, ErrClientClosed)
case c.rpcs <- rpc:
}
} else {
if err := c.trySend(rpc); err != nil {
returnResult(rpc, nil, err)
}
}
} | go | func (c *client) QueueRPC(rpc hrpc.Call) {
if b, ok := rpc.(hrpc.Batchable); ok && c.rpcQueueSize > 1 && !b.SkipBatch() {
// queue up the rpc
select {
case <-rpc.Context().Done():
// rpc timed out before being processed
case <-c.done:
returnResult(rpc, nil, ErrClientClosed)
case c.rpcs <- rpc:
}
} else {
if err := c.trySend(rpc); err != nil {
returnResult(rpc, nil, err)
}
}
} | [
"func",
"(",
"c",
"*",
"client",
")",
"QueueRPC",
"(",
"rpc",
"hrpc",
".",
"Call",
")",
"{",
"if",
"b",
",",
"ok",
":=",
"rpc",
".",
"(",
"hrpc",
".",
"Batchable",
")",
";",
"ok",
"&&",
"c",
".",
"rpcQueueSize",
">",
"1",
"&&",
"!",
"b",
".",... | // QueueRPC will add an rpc call to the queue for processing by the writer goroutine | [
"QueueRPC",
"will",
"add",
"an",
"rpc",
"call",
"to",
"the",
"queue",
"for",
"processing",
"by",
"the",
"writer",
"goroutine"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L180-L195 | train |
tsuna/gohbase | region/client.go | write | func (c *client) write(buf []byte) error {
_, err := c.conn.Write(buf)
return err
} | go | func (c *client) write(buf []byte) error {
_, err := c.conn.Write(buf)
return err
} | [
"func",
"(",
"c",
"*",
"client",
")",
"write",
"(",
"buf",
"[",
"]",
"byte",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"conn",
".",
"Write",
"(",
"buf",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // write sends the given buffer to the RegionServer. | [
"write",
"sends",
"the",
"given",
"buffer",
"to",
"the",
"RegionServer",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L519-L522 | train |
tsuna/gohbase | region/client.go | readFully | func (c *client) readFully(buf []byte) error {
_, err := io.ReadFull(c.conn, buf)
return err
} | go | func (c *client) readFully(buf []byte) error {
_, err := io.ReadFull(c.conn, buf)
return err
} | [
"func",
"(",
"c",
"*",
"client",
")",
"readFully",
"(",
"buf",
"[",
"]",
"byte",
")",
"error",
"{",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"c",
".",
"conn",
",",
"buf",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Tries to read enough data to fully fill up the given buffer. | [
"Tries",
"to",
"read",
"enough",
"data",
"to",
"fully",
"fill",
"up",
"the",
"given",
"buffer",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L525-L528 | train |
tsuna/gohbase | region/client.go | sendHello | func (c *client) sendHello(ctype ClientType) error {
connHeader := &pb.ConnectionHeader{
UserInfo: &pb.UserInformation{
EffectiveUser: proto.String(c.effectiveUser),
},
ServiceName: proto.String(string(ctype)),
CellBlockCodecClass: proto.String("org.apache.hadoop.hbase.codec.KeyValueCodec"),
}
data, err := proto.Marshal(connHeader)
if err != nil {
return fmt.Errorf("failed to marshal connection header: %s", err)
}
const header = "HBas\x00\x50" // \x50 = Simple Auth.
buf := make([]byte, 0, len(header)+4+len(data))
buf = append(buf, header...)
buf = buf[:len(header)+4]
binary.BigEndian.PutUint32(buf[6:], uint32(len(data)))
buf = append(buf, data...)
return c.write(buf)
} | go | func (c *client) sendHello(ctype ClientType) error {
connHeader := &pb.ConnectionHeader{
UserInfo: &pb.UserInformation{
EffectiveUser: proto.String(c.effectiveUser),
},
ServiceName: proto.String(string(ctype)),
CellBlockCodecClass: proto.String("org.apache.hadoop.hbase.codec.KeyValueCodec"),
}
data, err := proto.Marshal(connHeader)
if err != nil {
return fmt.Errorf("failed to marshal connection header: %s", err)
}
const header = "HBas\x00\x50" // \x50 = Simple Auth.
buf := make([]byte, 0, len(header)+4+len(data))
buf = append(buf, header...)
buf = buf[:len(header)+4]
binary.BigEndian.PutUint32(buf[6:], uint32(len(data)))
buf = append(buf, data...)
return c.write(buf)
} | [
"func",
"(",
"c",
"*",
"client",
")",
"sendHello",
"(",
"ctype",
"ClientType",
")",
"error",
"{",
"connHeader",
":=",
"&",
"pb",
".",
"ConnectionHeader",
"{",
"UserInfo",
":",
"&",
"pb",
".",
"UserInformation",
"{",
"EffectiveUser",
":",
"proto",
".",
"S... | // sendHello sends the "hello" message needed when opening a new connection. | [
"sendHello",
"sends",
"the",
"hello",
"message",
"needed",
"when",
"opening",
"a",
"new",
"connection",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L531-L551 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.