query
stringlengths
8
6.75k
document
stringlengths
9
1.89M
negatives
listlengths
19
19
metadata
dict
Removes a zone rcode0 API docs:
func (s *ZoneManagementService) Delete(zone string) (*StatusResponse, error) { resp, err := s.client.NewRequest(). SetPathParams( map[string]string{ "zone": zone, }). Delete( s.client.BaseURL.String() + s.client.APIVersion + RC0Zone, ) if err != nil { return nil, err } return s.clien...
[ "func (u *Unbound) ZoneRemove(zoneName string) error {\n\tczoneName := C.CString(zoneName)\n\tdefer C.free(unsafe.Pointer(czoneName))\n\ti := C.ub_ctx_zone_remove(u.ctx, czoneName)\n\treturn newError(int(i))\n}", "func (c *NegAssertionImpl) RemoveZone(zone string) {\n\tif set, ok := c.zoneMap.Remove(zone); ok {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewUpdateRTResponsePoliciesOK creates a UpdateRTResponsePoliciesOK with default headers values
func NewUpdateRTResponsePoliciesOK() *UpdateRTResponsePoliciesOK { return &UpdateRTResponsePoliciesOK{} }
[ "func NewGetRTResponsePoliciesDefault(code int) *GetRTResponsePoliciesDefault {\n\treturn &GetRTResponsePoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func AddToExistingPolicies(aReview *v1.AdmissionReview) RuleResponse {\n\tvar rr RuleResponse\n\tvar aPolicy AdmissionPolicy\n\n\taJSON, _ := aReview.Request....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsRedirect returns true when this update r t response policies o k response has a 3xx status code
func (o *UpdateRTResponsePoliciesOK) IsRedirect() bool { return false }
[ "func (o *UpdateRTResponsePoliciesNotFound) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesBadRequest) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsRedirect() bool {\n\treturn false\n}", "func (o *SnapmirrorPolicyModifyDefault) I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsCode returns true when this update r t response policies o k response a status code equal to that given
func (o *UpdateRTResponsePoliciesOK) IsCode(code int) bool { return code == 200 }
[ "func (o *UpdateExtensionOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *UpdateDetectsByIdsV2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *DryRunPolicyUsingPOST2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code gets the status code for the update r t response policies o k response
func (o *UpdateRTResponsePoliciesOK) Code() int { return 200 }
[ "func (o *UpdateRTResponsePoliciesForbidden) Code() int {\n\treturn 403\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) Code() int {\n\treturn 500\n}", "func (o *UpdateRTResponsePoliciesNotFound) Code() int {\n\treturn 404\n}", "func (o *UpdateRTResponsePoliciesBadRequest) Code() int {\n\treturn 4...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewUpdateRTResponsePoliciesBadRequest creates a UpdateRTResponsePoliciesBadRequest with default headers values
func NewUpdateRTResponsePoliciesBadRequest() *UpdateRTResponsePoliciesBadRequest { return &UpdateRTResponsePoliciesBadRequest{} }
[ "func (o *UpdateRTResponsePoliciesBadRequest) Code() int {\n\treturn 400\n}", "func NewGetRTResponsePoliciesDefault(code int) *GetRTResponsePoliciesDefault {\n\treturn &GetRTResponsePoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewUpdateSecurityPolicyBadRequest() *UpdateSecurityPolicyBadRequest {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsSuccess returns true when this update r t response policies bad request response has a 2xx status code
func (o *UpdateRTResponsePoliciesBadRequest) IsSuccess() bool { return false }
[ "func (o *UpdateRTResponsePoliciesInternalServerError) IsSuccess() bool {\n\treturn false\n}", "func (o *QueryCombinedRTResponsePoliciesBadRequest) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateMTOServiceItemBadRequest) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesForbid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsRedirect returns true when this update r t response policies bad request response has a 3xx status code
func (o *UpdateRTResponsePoliciesBadRequest) IsRedirect() bool { return false }
[ "func (o *QueryCombinedRTResponsePoliciesBadRequest) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesNotFound) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsCode returns true when this update r t response policies bad request response a status code equal to that given
func (o *UpdateRTResponsePoliciesBadRequest) IsCode(code int) bool { return code == 400 }
[ "func (o *QueryCombinedRTResponsePoliciesBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "func (o *UpdateRTResponsePoliciesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "func (o *G...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code gets the status code for the update r t response policies bad request response
func (o *UpdateRTResponsePoliciesBadRequest) Code() int { return 400 }
[ "func (o *UpdateRTResponsePoliciesOK) Code() int {\n\treturn 200\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) Code() int {\n\treturn 500\n}", "func (o *UpdateRTResponsePoliciesForbidden) Code() int {\n\treturn 403\n}", "func (o *UpdateRTResponsePoliciesNotFound) Code() int {\n\treturn 404\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewUpdateRTResponsePoliciesForbidden creates a UpdateRTResponsePoliciesForbidden with default headers values
func NewUpdateRTResponsePoliciesForbidden() *UpdateRTResponsePoliciesForbidden { return &UpdateRTResponsePoliciesForbidden{} }
[ "func NewGetRTResponsePoliciesDefault(code int) *GetRTResponsePoliciesDefault {\n\treturn &GetRTResponsePoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewPostRoutingpoliciesForbidden() *PostRoutingpoliciesForbidden {\n\treturn &PostRoutingpoliciesForbidden{}\n}", "func (o *UpdateRTResponsePoliciesForb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsSuccess returns true when this update r t response policies forbidden response has a 2xx status code
func (o *UpdateRTResponsePoliciesForbidden) IsSuccess() bool { return false }
[ "func (o *UpdateRTResponsePoliciesBadRequest) IsSuccess() bool {\n\treturn false\n}", "func (o *GetGitWebhookByIDUsingGETForbidden) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateMTOServiceItemForbidden) IsSuccess() bool {\n\treturn false\n}", "func (o *QueryCombinedRTResponsePoliciesForbidden) IsSuc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsRedirect returns true when this update r t response policies forbidden response has a 3xx status code
func (o *UpdateRTResponsePoliciesForbidden) IsRedirect() bool { return false }
[ "func (o *UpdateRTResponsePoliciesBadRequest) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesNotFound) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesTooManyR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsCode returns true when this update r t response policies forbidden response a status code equal to that given
func (o *UpdateRTResponsePoliciesForbidden) IsCode(code int) bool { return code == 403 }
[ "func (o *QueryCombinedRTResponsePoliciesForbidden) IsCode(code int) bool {\n\treturn code == 403\n}", "func (o *GetGitWebhookByIDUsingGETForbidden) IsCode(code int) bool {\n\treturn code == 403\n}", "func (o *BatchGetCmdStatusForbidden) IsCode(code int) bool {\n\treturn code == 403\n}", "func (o *UpdateConne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code gets the status code for the update r t response policies forbidden response
func (o *UpdateRTResponsePoliciesForbidden) Code() int { return 403 }
[ "func (o *UpdateConnectionForbidden) Code() int {\n\treturn 403\n}", "func (o *QueryCombinedRTResponsePoliciesForbidden) Code() int {\n\treturn 403\n}", "func (o *UpdateMTOServiceItemForbidden) Code() int {\n\treturn 403\n}", "func (o *UpdateRulesV1Forbidden) Code() int {\n\treturn 403\n}", "func (o *PatchE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewUpdateRTResponsePoliciesNotFound creates a UpdateRTResponsePoliciesNotFound with default headers values
func NewUpdateRTResponsePoliciesNotFound() *UpdateRTResponsePoliciesNotFound { return &UpdateRTResponsePoliciesNotFound{} }
[ "func NewGetRTResponsePoliciesDefault(code int) *GetRTResponsePoliciesDefault {\n\treturn &GetRTResponsePoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *UpdateRTResponsePoliciesNotFound) Code() int {\n\treturn 404\n}", "func NewPostRoutingpoliciesNotFound() *PostRoutingpoliciesNotFound {\n\treturn &...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsSuccess returns true when this update r t response policies not found response has a 2xx status code
func (o *UpdateRTResponsePoliciesNotFound) IsSuccess() bool { return false }
[ "func (o *UpdateRTResponsePoliciesBadRequest) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesForbidden) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsSuccess() bool {\n\treturn false\n}", "func (o *GetDeploymentRequestsUsingGET2Unau...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsRedirect returns true when this update r t response policies not found response has a 3xx status code
func (o *UpdateRTResponsePoliciesNotFound) IsRedirect() bool { return false }
[ "func (o *UpdateRTResponsePoliciesOK) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesBadRequest) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesForbidden) IsR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsCode returns true when this update r t response policies not found response a status code equal to that given
func (o *UpdateRTResponsePoliciesNotFound) IsCode(code int) bool { return code == 404 }
[ "func (o *UpdateRTResponsePoliciesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "func (o *QueryCombinedRTResponsePoliciesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *UpdateRTR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code gets the status code for the update r t response policies not found response
func (o *UpdateRTResponsePoliciesNotFound) Code() int { return 404 }
[ "func (o *UpdateRTResponsePoliciesOK) Code() int {\n\treturn 200\n}", "func (o *UpdateRTResponsePoliciesForbidden) Code() int {\n\treturn 403\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) Code() int {\n\treturn 500\n}", "func (o *UpdateRTResponsePoliciesBadRequest) Code() int {\n\treturn 400\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewUpdateRTResponsePoliciesTooManyRequests creates a UpdateRTResponsePoliciesTooManyRequests with default headers values
func NewUpdateRTResponsePoliciesTooManyRequests() *UpdateRTResponsePoliciesTooManyRequests { return &UpdateRTResponsePoliciesTooManyRequests{} }
[ "func NewGetRTResponsePoliciesDefault(code int) *GetRTResponsePoliciesDefault {\n\treturn &GetRTResponsePoliciesDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewPostKeysTooManyRequests() *PostKeysTooManyRequests {\n\treturn &PostKeysTooManyRequests{}\n}", "func AddNewThrottlePolicy(t *testing.T, client *apim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsSuccess returns true when this update r t response policies too many requests response has a 2xx status code
func (o *UpdateRTResponsePoliciesTooManyRequests) IsSuccess() bool { return false }
[ "func (o *QueryCombinedRTResponsePoliciesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesBadRequest) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesForbidden) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesInterna...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsRedirect returns true when this update r t response policies too many requests response has a 3xx status code
func (o *UpdateRTResponsePoliciesTooManyRequests) IsRedirect() bool { return false }
[ "func (o *QueryCombinedRTResponsePoliciesTooManyRequests) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesNotFound) IsRedirect() bool {\n\treturn false\n}", "func (o *ExtractionGetV1TooManyRequests) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesOK) IsRed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsCode returns true when this update r t response policies too many requests response a status code equal to that given
func (o *UpdateRTResponsePoliciesTooManyRequests) IsCode(code int) bool { return code == 429 }
[ "func (o *UpdateRTResponsePoliciesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *QueryCombinedRTResponsePoliciesTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "func (o *UpdateDetectsByIdsV2TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "func (o *Batc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code gets the status code for the update r t response policies too many requests response
func (o *UpdateRTResponsePoliciesTooManyRequests) Code() int { return 429 }
[ "func (o *UpdateRTResponsePoliciesOK) Code() int {\n\treturn 200\n}", "func (o *UpdateRTResponsePoliciesForbidden) Code() int {\n\treturn 403\n}", "func (o *UpdateRTResponsePoliciesInternalServerError) Code() int {\n\treturn 500\n}", "func (o *UpdateRTResponsePoliciesNotFound) Code() int {\n\treturn 404\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsSuccess returns true when this update r t response policies internal server error response has a 2xx status code
func (o *UpdateRTResponsePoliciesInternalServerError) IsSuccess() bool { return false }
[ "func (o *UpdateRTResponsePoliciesBadRequest) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateMTOServiceItemInternalServerError) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesForbidden) IsSuccess() bool {\n\treturn false\n}", "func (o *UpdateMTOServiceItemBadRequest) IsSucc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsRedirect returns true when this update r t response policies internal server error response has a 3xx status code
func (o *UpdateRTResponsePoliciesInternalServerError) IsRedirect() bool { return false }
[ "func (o *UpdateRTResponsePoliciesBadRequest) IsRedirect() bool {\n\treturn false\n}", "func (o *UpdateRTResponsePoliciesNotFound) IsRedirect() bool {\n\treturn false\n}", "func (o *QueryCombinedRTResponsePoliciesInternalServerError) IsRedirect() bool {\n\treturn false\n}", "func (o *QueryCombinedRTResponsePo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsCode returns true when this update r t response policies internal server error response a status code equal to that given
func (o *UpdateRTResponsePoliciesInternalServerError) IsCode(code int) bool { return code == 500 }
[ "func (o *QueryCombinedRTResponsePoliciesInternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "func (o *UpdateRTResponsePoliciesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *GetGitWebhookByIDUsingGETInternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code gets the status code for the update r t response policies internal server error response
func (o *UpdateRTResponsePoliciesInternalServerError) Code() int { return 500 }
[ "func (o *UpdateRTResponsePoliciesOK) Code() int {\n\treturn 200\n}", "func (o *QueryCombinedRTResponsePoliciesInternalServerError) Code() int {\n\treturn 500\n}", "func (o *UpdateRTResponsePoliciesForbidden) Code() int {\n\treturn 403\n}", "func (o *UpdateRulesV1InternalServerError) Code() int {\n\treturn 50...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SetBook sets the Book field's value.
func (s *CreateBookOutput) SetBook(v *BookData) *CreateBookOutput { s.Book = v return s }
[ "func (s *UpdateBookOutput) SetBook(v *BookData) *UpdateBookOutput {\n\ts.Book = v\n\treturn s\n}", "func (ap *Adapter) SetAddrBook(addrBook AddrBook) {\n\tap.addrBook = addrBook\n}", "func (k Keeper) setOrderBook(ctx sdk.Context, orderBook OrderBook) {\n\tstore := ctx.KVStore(k.storeKey)\n\tbz, err := k.cdc.Ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CreateBookWithContext is the same as CreateBook with the addition of the ability to pass a context and additional request options. See CreateBook for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future th...
func (c *BookstoreAPI) CreateBookWithContext(ctx aws.Context, input *CreateBookInput, opts ...request.Option) (*CreateBookOutput, error) { req, out := c.CreateBookRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
[ "func (c *M2) CreateApplicationWithContext(ctx aws.Context, input *CreateApplicationInput, opts ...request.Option) (*CreateApplicationOutput, error) {\n\treq, out := c.CreateApplicationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *IoTFleetHub) CreateAp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeleteBookWithContext is the same as DeleteBook with the addition of the ability to pass a context and additional request options. See DeleteBook for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future th...
func (c *BookstoreAPI) DeleteBookWithContext(ctx aws.Context, input *DeleteBookInput, opts ...request.Option) (*DeleteBookOutput, error) { req, out := c.DeleteBookRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
[ "func (c *RoboMaker) DeleteFleetWithContext(ctx aws.Context, input *DeleteFleetInput, opts ...request.Option) (*DeleteFleetOutput, error) {\n\treq, out := c.DeleteFleetRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *WorkLink) DeleteFleetWithContext(ctx a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SetBooks sets the Books field's value.
func (s *ListBooksOutput) SetBooks(v []*BookRef) *ListBooksOutput { s.Books = v return s }
[ "func Books() []Book {\n\treturn books\n}", "func (s *UpdateBookOutput) SetBook(v *BookData) *UpdateBookOutput {\n\ts.Book = v\n\treturn s\n}", "func (ru *RoomamountUpdate) RemoveBooks(b ...*Books) *RoomamountUpdate {\n\tids := make([]int, len(b))\n\tfor i := range b {\n\t\tids[i] = b[i].ID\n\t}\n\treturn ru.Re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ListBooksWithContext is the same as ListBooks with the addition of the ability to pass a context and additional request options. See ListBooks for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future the S...
func (c *BookstoreAPI) ListBooksWithContext(ctx aws.Context, input *ListBooksInput, opts ...request.Option) (*ListBooksOutput, error) { req, out := c.ListBooksRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
[ "func (c *BookstoreAPI) ListBooksPagesWithContext(ctx aws.Context, input *ListBooksInput, fn func(*ListBooksOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListBooksInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ListBooksPagesWithContext same as ListBooksPages except it takes a Context and allows setting request options on the pages. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create subcontexts for http.Requests. See for more informa...
func (c *BookstoreAPI) ListBooksPagesWithContext(ctx aws.Context, input *ListBooksInput, fn func(*ListBooksOutput, bool) bool, opts ...request.Option) error { p := request.Pagination{ NewRequest: func() (*request.Request, error) { var inCpy *ListBooksInput if input != nil { tmp := *input inCpy = &tmp ...
[ "func (c *M2) ListApplicationsPagesWithContext(ctx aws.Context, input *ListApplicationsInput, fn func(*ListApplicationsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListApplicationsInput\n\t\t\tif input != nil {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SetBookName sets the BookName field's value.
func (s *DescribeBookInput) SetBookName(v string) *DescribeBookInput { s.BookName = &v return s }
[ "func (s *UpdateBookInput) SetBookName(v string) *UpdateBookInput {\n\ts.BookName = &v\n\treturn s\n}", "func (r *VAdaptor) SetName(n string) {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\n\tr.name = n\n}", "func (w *workerPool) SetName(name string) {\n\tw.Name = name\n}", "func (client *Client) SetLoadBala...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DescribeBookWithContext is the same as DescribeBook with the addition of the ability to pass a context and additional request options. See DescribeBook for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the fut...
func (c *BookstoreAPI) DescribeBookWithContext(ctx aws.Context, input *DescribeBookInput, opts ...request.Option) (*DescribeBookOutput, error) { req, out := c.DescribeBookRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
[ "func (c *Personalize) DescribeRecipeWithContext(ctx aws.Context, input *DescribeRecipeInput, opts ...request.Option) (*DescribeRecipeOutput, error) {\n\treq, out := c.DescribeRecipeRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *AutoScaling) DescribeTag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SetBookName sets the BookName field's value.
func (s *UpdateBookInput) SetBookName(v string) *UpdateBookInput { s.BookName = &v return s }
[ "func (s *DescribeBookInput) SetBookName(v string) *DescribeBookInput {\n\ts.BookName = &v\n\treturn s\n}", "func (r *VAdaptor) SetName(n string) {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\n\tr.name = n\n}", "func (w *workerPool) SetName(name string) {\n\tw.Name = name\n}", "func (client *Client) SetLoad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SetBook sets the Book field's value.
func (s *UpdateBookOutput) SetBook(v *BookData) *UpdateBookOutput { s.Book = v return s }
[ "func (s *CreateBookOutput) SetBook(v *BookData) *CreateBookOutput {\n\ts.Book = v\n\treturn s\n}", "func (ap *Adapter) SetAddrBook(addrBook AddrBook) {\n\tap.addrBook = addrBook\n}", "func (k Keeper) setOrderBook(ctx sdk.Context, orderBook OrderBook) {\n\tstore := ctx.KVStore(k.storeKey)\n\tbz, err := k.cdc.Ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UpdateBookWithContext is the same as UpdateBook with the addition of the ability to pass a context and additional request options. See UpdateBook for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future th...
func (c *BookstoreAPI) UpdateBookWithContext(ctx aws.Context, input *UpdateBookInput, opts ...request.Option) (*UpdateBookOutput, error) { req, out := c.UpdateBookRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() }
[ "func (c *M2) UpdateApplicationWithContext(ctx aws.Context, input *UpdateApplicationInput, opts ...request.Option) (*UpdateApplicationOutput, error) {\n\treq, out := c.UpdateApplicationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Personalize) UpdateRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displayProcessTree displays a tree of all the running Go processes.
func DisplayProcessTree(ps models.Process) { pstree = make(map[int][]goprocess.P) for _, p := range ps.Process { pstree[p.PPID] = append(pstree[p.PPID], p) } tree := treeprint.New() tree.SetValue("...") seen := map[int]bool{} for _, p := range ps.Process { constructProcessTree(p.PPID, p, seen, tree) } fmt....
[ "func PrintProcessTree() {\n\tfmt.Println(GetProcessTree().Print())\n}", "func GetProcessTree() gotree.Tree {\n\tlist := make(map[int][]*process)\n\tprocesses, err := GetProcessStats()\n\tutil.ErrorCheck(err)\n\n\tfor _, ps := range processes {\n\t\tif ps.IsGhostProcess() {\n\t\t\tcontinue\n\t\t}\n\t\tp := new(pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructProcessTree constructs the process tree in a depthfirst fashion.
func constructProcessTree(ppid int, p goprocess.P, seen map[int]bool, tree treeprint.Tree) { if seen[ppid] { return } seen[ppid] = true if ppid != p.PPID { output := strconv.Itoa(ppid) + " (" + p.Path + " " + p.Arguments + " " + fmt.Sprintf("user:%v, uid:%v", p.Username, p.Uid) + ")" tree = tree.AddBranch(...
[ "func CreateProcessTree(caseinfo CaseInformation, computername string, filename string) []byte {\n xmlData,_ := ioutil.ReadFile(filename)\n var rl RlProcessMemory\n var auditinfo RlAuditType\n\n rl.ParseAuditData(computername, caseinfo, auditinfo, xmlData) \n\n var root ProcessTree\n root.Parent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetBalance get ether balance for a specified address
func (e *Etherscan) GetBalance(address string) (*apd.Decimal, error) { url := fmt.Sprintf("https://%s/api?module=account&action=balance&address=%s&tag=latest&apikey=%s", e.Domain, address, e.APIKey, ) res, err := req.Get(url) if err != nil { return nil, err } var result map[string]interface{} res.ToJSON(&re...
[ "func (c *Client) GetAddressBalance(address string) (balance Balance, err error) {\n\tr, err := c.request(\"getaddressbalance\", []interface{}{address})\n\tif err = c.error(err, &r); err != nil {\n\t\treturn\n\t}\n\n\tvar b map[string]interface{}\n\terr = json.Unmarshal(r.Result, &b)\n\tif err != nil {\n\t\treturn\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetTokenBalance get token balance for a specified address
func (e *Etherscan) GetTokenBalance(address string) (*apd.Decimal, error) { url := fmt.Sprintf("https://%s/api?module=account&action=tokenbalance&contractaddress=%s&address=%s&tag=latest&apikey=%s", e.Domain, e.ContractAddress, address, e.APIKey, ) res, err := req.Get(url) if err != nil { return nil, err } v...
[ "func (e *Ethereum) Balance(address, token string) (ethBal, tokBal *big.Int, err error) {\n\treturn e.c.GetBalance(address, token)\n}", "func tcTokenBalance(eng *vm.Engine, index int64, args []uint64) (uint64, error) {\n\trunningFrame, _ := eng.RunningAppFrame()\n\tvmem := runningFrame.VM.VMemory()\n\taddrTmp, er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increment the total time in microseconds based on the elapsed time
func (ph *PasswordHash) incrementTime(start time.Time) { elapsed := time.Since(start) ph.totalTimeMicro = ph.totalTimeMicro + elapsed.Microseconds() }
[ "func advanceCounterTime(t time.Duration) {\n\tatomic.AddInt64(&ticks, t.Nanoseconds())\n}", "func (time_ TimeVal) Add(microseconds int) {\n\tC.g_time_val_add(time_.native(), C.glong(microseconds))\n}", "func (s *Stats) incTimeout() {\n\ts.totalCount++\n}", "func AddGigasecond(inputTime time.Time) time.Time {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calcEtag will create an etag based on the md5 of mtime, inode (if available), device (if available) and size. errors are logged, but an etag will still be returned
func calcEtag(ctx context.Context, fi os.FileInfo) string { log := appctx.GetLogger(ctx) h := md5.New() err := binary.Write(h, binary.BigEndian, fi.ModTime().UnixNano()) if err != nil { log.Error().Err(err).Msg("error writing mtime") } // device and inode have no meaning on windows err = binary.Write(h, binary...
[ "func ComputeEtag(path string) (string, error) {\n\tvar result []byte\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer Close(file)\n\n\thash := md5.New()\n\tif _, err := io.Copy(hash, file); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn hex.EncodeToString(hash.Sum(result)),...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AttachProgram attaches a BPF program from a file to the TC attach point
func AttachProgram(attachPoint AttachPoint, hostIP net.IP) error { // FIXME we use this lock so that two copies of tc running in parallel don't re-use the same jump map. // This can happen if tc incorrectly decides the two programs are identical (when in fact they differ by attach // point). log.Debug("AttachProgra...
[ "func attachProgram(Ifindex int, program *ebpf.Program) error {\n\tlink, err := netlink.LinkByIndex(Ifindex)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn netlink.LinkSetXdpFdWithFlags(link, program.FD(), int(DefaultXdpFlags))\n}", "func bpftoolMapAttach(progID string, mapID string) error {\n\tprog := \"bpfto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CleanUpJumpMaps scans for cali_jump maps that are still pinned to the filesystem but no longer referenced by our BPF programs.
func CleanUpJumpMaps() { // So that we serialise with AttachProgram() log.Debug("CleanUpJumpMaps waiting for lock...") tcLock.Lock() defer tcLock.Unlock() log.Debug("CleanUpJumpMaps got lock, cleaning up...") // Find the maps we care about by walking the BPF filesystem. mapIDToPath := make(map[int]string) err ...
[ "func CleanupPerClusterCTMaps(ipv4, ipv6 bool) error {\n\tmaps := NewPerClusterCTMaps(ipv4, ipv6)\n\treturn maps.cleanup()\n}", "func cleanUpMaps(o *ORSet, key string) {\n\t// go through add and remove Maps and delete similar timestamps\n\trm, ok := o.removeMap[key]\n\tif ok {\n\t\tam, ok := o.addMap[key]\n\t\tif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EnsureQdisc makes sure that qdisc is attached to the given interface
func EnsureQdisc(ifaceName string) { // FIXME Avoid flapping the tc program and qdisc cmd := exec.Command("tc", "qdisc", "del", "dev", ifaceName, "clsact") _ = cmd.Run() cmd = exec.Command("tc", "qdisc", "add", "dev", ifaceName, "clsact") _ = cmd.Run() }
[ "func (t *tcShaper) interfaceExists() (bool, string, error) {\n\tdata, err := t.e.Command(\"tc\", \"qdisc\", \"show\", \"dev\", t.iface).CombinedOutput()\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\tvalue := strings.TrimSpace(string(data))\n\tif len(value) == 0 {\n\t\treturn false, \"\", nil\n\t}\n\t// N...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SQL returns the SQL filter.
func (f FUOTADeploymentFilters) SQL() string { var filters []string var nullDevEUI lorawan.EUI64 if f.DevEUI != nullDevEUI { filters = append(filters, "fdd.dev_eui = :dev_eui") } if f.ApplicationID != 0 { filters = append(filters, "d.application_id = :application_id") } if len(filters) == 0 { return "" ...
[ "func FilterSQL(sql string) string {\n\treturn sqlCharPattern.ReplaceAllStringFunc(sql, func(match string) string {\n\t\treturn escapeRep[match]\n\t})\n}", "func (f *FilterQuery) getFilterConditionSQL() {\n\tswitch f.condition {\n\tcase \"like\":\n\t\tf.ConditionSQL = fmt.Sprintf(\" %v like ? \", f.queryParam)\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate validates the FUOTADeployment data.
func (fd FUOTADeployment) Validate() error { if strings.TrimSpace(fd.Name) == "" { return errHandler.ErrFUOTADeploymentInvalidName } if len(fd.Payload) <= 0 || fd.Payload == nil { return errHandler.ErrFUOTADeploymentNullPayload } return nil }
[ "func (m *Deployment) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetId()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn DeploymentValidationError{\n\t\t\t\tfield: \"Id\",\n\t\t\t\treason: \"embedded message failed validati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gomake creates a cli app for the given Gomakefile.
func Gomake(gomakefile *Gomakefile) *cli.App { app := &cli.App{ Name: "gomake - Makefile for gophers", Version: Version, Action: func(ctx *cli.Context) error { _, ok := gomakefile.Targets[""] if !ok { return nil } results := gomakefile.Make("") return HandleResults(results) }, } for g...
[ "func Generate() *cli.App {\n\tapp := cli.NewApp()\n\n\tapp.Name = \"Command line application\"\n\tapp.Usage = \"Find IPs and server names over the internet\"\n\n\tflags := []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"host\",\n\t\t\tValue: \"devbook.com.br\",\n\t\t},\n\t}\n\n\tapp.Commands = []cli.Command{\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init returns an initialised Mongo object encapsulating a connection to the mongo server/cluster with the given configuration, a health client to check the health of the mongo server/cluster, and a lock client
func (m *Mongo) Init(ctx context.Context) (err error) { m.Connection, err = mongodriver.Open(&m.MongoDriverConfig) if err != nil { return err } databaseCollectionBuilder := map[mongohealth.Database][]mongohealth.Collection{ mongohealth.Database(m.Database): { mongohealth.Collection(m.ActualCollectionName(co...
[ "func (m *MongoConnect) Init() error {\n\tif m.client != nil {\n\t\treturn nil\n\t}\n\topts := options.Client().ApplyURI(m.url)\n\tif m.poolOpts != nil {\n\t\tif m.poolOpts.ConnectTimeout > 0 {\n\t\t\topts.SetConnectTimeout(m.poolOpts.ConnectTimeout)\n\t\t}\n\t\tif m.poolOpts.SocketTimeout > 0 {\n\t\t\topts.SetSock...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checker is called by the healthcheck library to check the health state of this mongoDB instance
func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error { return m.healthClient.Checker(ctx, state) }
[ "func New(config Config) func() error {\n\tif config.TimeoutConnect == 0 {\n\t\tconfig.TimeoutConnect = defaultTimeoutConnect\n\t}\n\n\tif config.TimeoutDisconnect == 0 {\n\t\tconfig.TimeoutDisconnect = defaultTimeoutDisconnect\n\t}\n\n\tif config.TimeoutPing == 0 {\n\t\tconfig.TimeoutPing = defaultTimeoutPing\n\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Itoabs returns the absolute value of x.
func Itoabs(x int64) int64 { if x < 0 { return -x } return x }
[ "func IAbs(x int) int {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn x * -1\n}", "func _abs(i numint) numint {\n\tif i < 0 {\n\t\treturn -i\n\t}\n\treturn i\n}", "func AbsI(i int) int {\n\tif i < 0 {\n\t\treturn i * -1\n\t}\n\treturn i\n}", "func Ftoabs(x float32) float32 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ftoabs returns the absolute value of x.
func Ftoabs(x float32) float32 { if x < 0 { return -x } return x }
[ "func Itoabs(x int64) int64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x Literal) int {\n\tif x < 0 {\n\t\treturn int(-x)\n\t}\n\treturn int(x)\n}", "func Abs(f float32) float32 {\n\tif f < 0.0 {\n\t\treturn f * -1.0\n\t}\n\treturn f\n}", "func Abs(float64) float64", "func absolute(value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decode ccqline to (key string, symbols []string)
func decodeCCQLine(line string) CcqLine { temp := strings.Split(line, " ") // clean word slice in case some "" inside temp = func(a []string) []string { b := []string{} for _, w := range a { if w != "" { b = append(b, w) } } return b }(temp) key := temp[0][1:] temp = temp[1:] temp[0] = temp[...
[ "func GetKeyFromString(ns string, recInfoLine string) (*as.Key, error) {\n recInfoList := strings.Split(recInfoLine, FIELD_DEL)\n keyDigest := recInfoList[REC_LINE_OFFSET_DG]\n byteDigest, err := hex.DecodeString(keyDigest)\n PanicOnError(err)\n return as.NewKeyWithDigest(ns, recInfoList[REC_LINE_OF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sqlQueryInts takes a repostory ID, a SQL statement and returns intergers retrieved.
func sqlQueryInts(config *Config, repoID string, stmt string) ([]int, error) { if db, ok := config.Connections[repoID]; ok { rows, err := db.Query(stmt) if err != nil { return nil, fmt.Errorf("ERROR: query error (%q), %s", repoID, err) } defer rows.Close() value := 0 values := []int{} for rows.Next() ...
[ "func sqlQueryIntIDs(config *Config, repoID string, stmt string, args ...interface{}) ([]int, error) {\n\tif db, ok := config.Connections[repoID]; ok {\n\t\trows, err := db.Query(stmt, args...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ERROR: query error (%q), %s\", repoID, err)\n\t\t}\n\t\tdefer rows.Cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sqlQueryIntIDs takes a repostory ID, a SQL statement and applies the args returning a list of integer id or error.
func sqlQueryIntIDs(config *Config, repoID string, stmt string, args ...interface{}) ([]int, error) { if db, ok := config.Connections[repoID]; ok { rows, err := db.Query(stmt, args...) if err != nil { return nil, fmt.Errorf("ERROR: query error (%q), %s", repoID, err) } defer rows.Close() value := 0 valu...
[ "func sqlQueryInts(config *Config, repoID string, stmt string) ([]int, error) {\n\tif db, ok := config.Connections[repoID]; ok {\n\t\trows, err := db.Query(stmt)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ERROR: query error (%q), %s\", repoID, err)\n\t\t}\n\t\tdefer rows.Close()\n\t\tvalue := 0\n\t\tvalue...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sqlQueryStringIDs takes a repostory ID, a SQL statement and applies the args returning a list of string type id or error.
func sqlQueryStringIDs(config *Config, repoID string, stmt string, args ...interface{}) ([]string, error) { if db, ok := config.Connections[repoID]; ok { rows, err := db.Query(stmt, args...) if err != nil { return nil, fmt.Errorf("ERROR: query error (%q), %s", repoID, err) } defer rows.Close() value := ``...
[ "func sqlQueryIntIDs(config *Config, repoID string, stmt string, args ...interface{}) ([]int, error) {\n\tif db, ok := config.Connections[repoID]; ok {\n\t\trows, err := db.Query(stmt, args...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ERROR: query error (%q), %s\", repoID, err)\n\t\t}\n\t\tdefer rows.Cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IsPublic takes an EPrintID and returns true if public, false otherwise Check if an EPrint record "is public"
func IsPublic(config *Config, repoID string, eprintid int) (bool, error) { if db, ok := config.Connections[repoID]; ok { stmt := `SELECT IFNULL(eprint_status, '') AS status, IFNULL(metadata_visibility, '') AS visibility FROM eprint WHERE eprintid = ? LIMIT 1` rows, err := db.Query(stmt, eprintid) if err != nil {...
[ "func (c *ExternalService) IsPublic() bool {\n\treturn false\n}", "func (m *Measurement) IsPublic() bool {\n return m.data.IsPublic\n}", "func IsPublic(req *http.Request) bool {\n\tif req == nil {\n\t\treturn true\n\t}\n\treturn req.Header.Get(headerXPublic) == \"true\"\n}", "func (o AccessPointPolicyStatu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EPrint User Info GetUsernames returns a list of all usernames in a repository
func GetUsernames(config *Config, repoID string, userids ...int) ([]string, error) { stmt := `SELECT username FROM user ORDER BY userid` return sqlQueryStringIDs(config, repoID, stmt) }
[ "func GetAllUserNames() []string {\n\treturn usernames\n}", "func (api *API) getUsernames(ctx *gin.Context) {\n\tusernames, err := api.database.GetAllUsernames()\n\tif api.check(err, ctx) {\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusOK, gr(usernames))\n}", "func SearchUserNames(search string) ([]string, error) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetUserID takes a username and returns a list of userid
func GetUserID(config *Config, repoID string, username string) ([]int, error) { stmt := `SELECT userid FROM user WHERE username = ?` return sqlQueryIntIDs(config, repoID, stmt, username) }
[ "func GetUsernames(config *Config, repoID string, userids ...int) ([]string, error) {\n\tstmt := `SELECT username FROM user ORDER BY userid`\n\treturn sqlQueryStringIDs(config, repoID, stmt)\n}", "func (ic IrcContext) UserIDsToNames(userIDs ...string) []string {\n\tvar names []string\n\t// TODO implement using ic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetUserBy takes a field name (e.g. userid, username) and value and returns an EPrintUser object.
func GetUserBy(config *Config, repoID string, queryField string, queryValue interface{}) (*EPrintUser, error) { var ( year, month, day, hour, minute, second int hideEMail string ) if db, ok := config.Connections[repoID]; ok { stmt := fmt.Sprintf(`SELECT userid, username, usertype, ...
[ "func (s *Store) getUserByField(ctx context.Context, field, value string) (*User, error) {\n\titer := s.Client.Collection(UsersCollection).Where(field, \"==\", value).Limit(1).Documents(ctx)\n\n\tsnapshot, err := iter.Next()\n\tif err == iterator.Done {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EPrint ID Lists GetAllEPrintIDs return a list of all eprint ids in repository or error
func GetAllEPrintIDs(config *Config, repoID string) ([]int, error) { return sqlQueryIntIDs(config, repoID, `SELECT eprintid FROM eprint ORDER BY date_year DESC, date_month DESC, date_day DESC`) }
[ "func GetAllEPrintIDsWithStatus(config *Config, repoID string, status string) ([]int, error) {\n\treturn sqlQueryIntIDs(config, repoID, `SELECT eprintid FROM eprint WHERE (eprint_status = ?) ORDER BY date_year DESC, date_month DESC, date_day DESC`, status)\n}", "func GetEPrintIDsForUniqueID(config *Config, repoID...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetAllEPrintIDsWithStatus return a list of all eprint ids in a repository with a given status or return error
func GetAllEPrintIDsWithStatus(config *Config, repoID string, status string) ([]int, error) { return sqlQueryIntIDs(config, repoID, `SELECT eprintid FROM eprint WHERE (eprint_status = ?) ORDER BY date_year DESC, date_month DESC, date_day DESC`, status) }
[ "func GetEPrintIDsWithStatus(config *Config, repoID string, status string, start string, end string) ([]int, error) {\n\tstmt := `SELECT eprintid FROM eprint WHERE (eprint_status = ?) AND\n(CONCAT(lastmod_year, \"-\",\nLPAD(IFNULL(lastmod_month, 1), 2, \"0\"), \"-\",\nLPAD(IFNULL(lastmod_day, 1), 2, \"0\"), \" \",\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsInTimestampRange return a list of EPrintIDs in created timestamp range or return error. field maybe either "datestamp" (for created date), "lastmod" (for last modified date)
func GetEPrintIDsInTimestampRange(config *Config, repoID string, field string, start string, end string) ([]int, error) { stmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE (CONCAT(%s_year, "-", LPAD(IFNULL(%s_month, 1), 2, "0"), "-", LPAD(IFNULL(%s_day, 1), 2, "0"), " ", LPAD(IFNULL(%s_hour, 0), 2, "0"), ":", LPA...
[ "func GetEPrintIDsWithStatusInTimestampRange(config *Config, repoID string, status string, field string, start string, end string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE\n(eprint_status = ?) AND\n(CONCAT(%s_year, \"-\",\nLPAD(IFNULL(%s_month, 1), 2, \"0\"), \"-\",\nLPAD(IFNULL(%s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsWithStatusInTimestampRange return a list of EPrintIDs with eprint_status in field timestamp range or return error. field maybe either "datestamp" (for created date), "lastmod" (for last modified date)
func GetEPrintIDsWithStatusInTimestampRange(config *Config, repoID string, status string, field string, start string, end string) ([]int, error) { stmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE (eprint_status = ?) AND (CONCAT(%s_year, "-", LPAD(IFNULL(%s_month, 1), 2, "0"), "-", LPAD(IFNULL(%s_day, 1), 2, "0")...
[ "func GetEPrintIDsInTimestampRange(config *Config, repoID string, field string, start string, end string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE\n(CONCAT(%s_year, \"-\",\nLPAD(IFNULL(%s_month, 1), 2, \"0\"), \"-\",\nLPAD(IFNULL(%s_day, 1), 2, \"0\"), \" \",\nLPAD(IFNULL(%s_hour, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsWithStatus returns a list of eprints in a timestmap range for a given status or returns an error
func GetEPrintIDsWithStatus(config *Config, repoID string, status string, start string, end string) ([]int, error) { stmt := `SELECT eprintid FROM eprint WHERE (eprint_status = ?) AND (CONCAT(lastmod_year, "-", LPAD(IFNULL(lastmod_month, 1), 2, "0"), "-", LPAD(IFNULL(lastmod_day, 1), 2, "0"), " ", LPAD(IFNULL(lastmod_...
[ "func GetEPrintIDsWithStatusInTimestampRange(config *Config, repoID string, status string, field string, start string, end string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE\n(eprint_status = ?) AND\n(CONCAT(%s_year, \"-\",\nLPAD(IFNULL(%s_month, 1), 2, \"0\"), \"-\",\nLPAD(IFNULL(%s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsForDateType returns list of eprints in date range or returns an error
func GetEPrintIDsForDateType(config *Config, repoID string, dateType string, start string, end string) ([]int, error) { stmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE ((date_type) = ?) AND (CONCAT(date_year, "-", LPAD(IFNULL(date_month, 1), 2, "0"), "-", LPAD(IFNULL(date_day, 1), 2, "0")) >= ?) AND (CONCAT(dat...
[ "func GetEPrintIDsWithStatusForDateType(config *Config, repoID string, status string, dateType string, start string, end string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT eprintid FROM eprint\nWHERE (eprint_status = ? ) AND (date_type = ?) AND\n(CONCAT(date_year, \"-\",\nLPAD(IFNULL(date_month, 1), 2, \"0\"),...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsWithStatusForDateType returns list of eprints in date range for a given status or returns an error
func GetEPrintIDsWithStatusForDateType(config *Config, repoID string, status string, dateType string, start string, end string) ([]int, error) { stmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE (eprint_status = ? ) AND (date_type = ?) AND (CONCAT(date_year, "-", LPAD(IFNULL(date_month, 1), 2, "0"), "-", LPAD(IFN...
[ "func GetEPrintIDsForDateType(config *Config, repoID string, dateType string, start string, end string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT eprintid FROM eprint\nWHERE ((date_type) = ?) AND\n(CONCAT(date_year, \"-\",\nLPAD(IFNULL(date_month, 1), 2, \"0\"), \"-\",\nLPAD(IFNULL(date_day, 1), 2, \"0\")) >=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetAllUniqueID return a list of unique id values in repository
func GetAllUniqueID(config *Config, repoID string, field string) ([]string, error) { stmt := fmt.Sprintf(`SELECT %s FROM eprint WHERE %s IS NOT NULL GROUP BY %s ORDER BY %s`, field, field, field, field) return sqlQueryStringIDs(config, repoID, stmt) }
[ "func (dbobj PGSQLDB) GetUniqueList(t Tbl, keyName string) ([]bson.M, error) {\n\ttable := GetTable(t)\n\tkeyName = dbobj.escapeName(keyName)\n\tq := \"select distinct \" + keyName + \" from \" + table + \" ORDER BY \" + keyName\n\t//fmt.Printf(\"q: %s\\n\", q)\n\tvalues := make([]interface{}, 0)\n\treturn dbobj.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsForUniqueID return list of eprints for DOI
func GetEPrintIDsForUniqueID(config *Config, repoID string, field string, value string) ([]int, error) { // NOTE: There should only be one eprint per DOI but we have dirty data because the field is not contrained as Unique stmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE LOWER(%s) = LOWER(?)`, field) return sq...
[ "func GetAllEPrintIDs(config *Config, repoID string) ([]int, error) {\n\treturn sqlQueryIntIDs(config, repoID, `SELECT eprintid FROM eprint\nORDER BY date_year DESC, date_month DESC, date_day DESC`)\n}", "func GetEPrintIDsForORCID(config *Config, repoID string, orcid string) ([]int, error) {\n\treturn sqlQueryInt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetAllPersonOrOrgIDs return a list of creator ids or error
func GetAllPersonOrOrgIDs(config *Config, repoID string, field string) ([]string, error) { stmt := fmt.Sprintf(`SELECT %s_id FROM eprint_%s_id WHERE %s_id IS NOT NULL GROUP BY %s_id ORDER BY %s_id`, field, field, field, field, field) return sqlQueryStringIDs(config, repoID, stmt) }
[ "func GetEPrintIDsForPersonOrOrgID(config *Config, repoID string, personOrOrgType string, personOrOrgID string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT eprint_%s_id.eprintid AS eprintid\nFROM eprint_%s_id JOIN eprint ON (eprint_%s_id.eprintid = eprint.eprintid)\nWHERE eprint_%s_id.%s_id = ?\nORDER BY date_y...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDForPersonOrOrgID return a list of eprint ids associated with the person or organization id
func GetEPrintIDsForPersonOrOrgID(config *Config, repoID string, personOrOrgType string, personOrOrgID string) ([]int, error) { stmt := fmt.Sprintf(`SELECT eprint_%s_id.eprintid AS eprintid FROM eprint_%s_id JOIN eprint ON (eprint_%s_id.eprintid = eprint.eprintid) WHERE eprint_%s_id.%s_id = ? ORDER BY date_year DESC, ...
[ "func GetAllPersonOrOrgIDs(config *Config, repoID string, field string) ([]string, error) {\n\tstmt := fmt.Sprintf(`SELECT %s_id FROM eprint_%s_id\nWHERE %s_id IS NOT NULL\nGROUP BY %s_id ORDER BY %s_id`, field, field, field, field, field)\n\treturn sqlQueryStringIDs(config, repoID, stmt)\n}", "func GetEPrintIDsF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetAllORCIDs return a list of all ORCID in repository
func GetAllORCIDs(config *Config, repoID string) ([]string, error) { values, err := sqlQueryStringIDs(config, repoID, `SELECT creators_orcid FROM eprint_creators_orcid WHERE creators_orcid IS NOT NULL GROUP BY creators_orcid ORDER BY creators_orcid`) return values, err }
[ "func GetEPrintIDsForORCID(config *Config, repoID string, orcid string) ([]int, error) {\n\treturn sqlQueryIntIDs(config, repoID, `SELECT eprint.eprintid AS eprintid\nFROM eprint_creators_orcid JOIN eprint ON (eprint_creators_orcid.eprintid = eprint.eprintid)\nWHERE creators_orcid = ?\nORDER BY date_year DESC, date...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsForORCID return a list of eprint ids associated with the ORCID
func GetEPrintIDsForORCID(config *Config, repoID string, orcid string) ([]int, error) { return sqlQueryIntIDs(config, repoID, `SELECT eprint.eprintid AS eprintid FROM eprint_creators_orcid JOIN eprint ON (eprint_creators_orcid.eprintid = eprint.eprintid) WHERE creators_orcid = ? ORDER BY date_year DESC, date_month DES...
[ "func GetAllEPrintIDs(config *Config, repoID string) ([]int, error) {\n\treturn sqlQueryIntIDs(config, repoID, `SELECT eprintid FROM eprint\nORDER BY date_year DESC, date_month DESC, date_day DESC`)\n}", "func GetEPrintIDsForPersonOrOrgID(config *Config, repoID string, personOrOrgType string, personOrOrgID string...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetAllItems returns a list of simple items (e.g. local_group)
func GetAllItems(config *Config, repoID string, field string) ([]string, error) { stmt := fmt.Sprintf(`SELECT %s FROM eprint_%s WHERE eprint_%s.%s IS NOT NULL GROUP BY eprint_%s.%s ORDER BY eprint_%s.%s`, field, field, field, field, field, field, field, field) return sqlQueryStringIDs(config, repoID, stmt) }
[ "func GetAllItems() []*Item {\n\titems := []*Item{}\n\titemCol.ForEachDoc(func(id int, docContent []byte) (willMoveOn bool) {\n\t\tvar item Item\n\t\tjson.Unmarshal(docContent, &item)\n\t\titem.ID = fmt.Sprintf(\"%d\", id)\n\t\titems = append(items, &item)\n\t\treturn true\n\t})\n\treturn items\n}", "func (s *Sma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetAllPersonNames return a list of person names in repository
func GetAllPersonNames(config *Config, repoID string, field string) ([]string, error) { stmt := fmt.Sprintf(`SELECT CONCAT(%s_family, "/", %s_given) AS %s FROM eprint_%s WHERE (%s_family IS NOT NULL) OR (%s_given IS NOT NULL) GROUP BY %s_family, %s_given ORDER BY %s_family, %s_given`, field, field, field, field, f...
[ "func (pc *PersonController) GetPersonsByName(w http.ResponseWriter, r *http.Request) {\n\n\t// get the name parameter\n\tvars := mux.Vars(r)\n\tsearchValue := vars[\"name\"]\n\tif searchValue == \"\" {\n\t\trespondWithError(w, http.StatusBadRequest, \"missing search criteria\")\n\t\treturn\n\t}\n\n\t// adjust oper...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintIDsForPersonName return a list of eprint id for a person's name (family, given)
func GetEPrintIDsForPersonName(config *Config, repoID, field string, family string, given string) ([]int, error) { conditions := []string{} if strings.Contains(family, "*") || strings.Contains(given, "%") { conditions = append(conditions, fmt.Sprintf(`%s_family LIKE ?`, field)) } else if family != "" { condition...
[ "func GetEPrintIDsForPersonOrOrgID(config *Config, repoID string, personOrOrgType string, personOrOrgID string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT eprint_%s_id.eprintid AS eprintid\nFROM eprint_%s_id JOIN eprint ON (eprint_%s_id.eprintid = eprint.eprintid)\nWHERE eprint_%s_id.%s_id = ?\nORDER BY date_y...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetAllYears returns the publication years found in a repository
func GetAllYears(config *Config, repoID string) ([]int, error) { stmt := fmt.Sprintf(`SELECT date_year FROM eprint WHERE date_type = "published" AND date_year IS NOT NULL GROUP BY date_year ORDER BY date_year DESC`) return sqlQueryInts(config, repoID, stmt) }
[ "func GetYears() map[int]Record {\n\tyears := make(map[int]Record)\n\tpages := page.GetAllPages()\n\tfor _, p := range pages {\n\t\tif p.Status == page.Published && p.Template == \"post\" {\n\t\t\tyear := p.PubDate.Year()\n\t\t\tr, present := years[year]\n\t\t\tif present {\n\t\t\t\tr.Count++\n\t\t\t} else {\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetEPrintsIDsForYear returns a list of published eprint IDs for a given year.
func GetEPrintIDsForYear(config *Config, repoID string, year int) ([]int, error) { stmt := fmt.Sprintf(`SELECT eprintid FROM eprint WHERE date_type = "published" AND date_year = ? ORDER BY date_year DESC, date_month DESC, date_day DESC`) return sqlQueryIntIDs(config, repoID, stmt, year) }
[ "func GetAllEPrintIDs(config *Config, repoID string) ([]int, error) {\n\treturn sqlQueryIntIDs(config, repoID, `SELECT eprintid FROM eprint\nORDER BY date_year DESC, date_month DESC, date_day DESC`)\n}", "func GetAllYears(config *Config, repoID string) ([]int, error) {\n\tstmt := fmt.Sprintf(`SELECT date_year FRO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Column mapping for tables. colExpr takes a column name, ifNull bool and default value. If the "ifNull" bool is true then the form expressed is `IFNULL(%s, %s) AS %s` otherwise just the column name is returned.
func colExpr(name string, ifNull bool, value string) string { if ifNull { return fmt.Sprintf(`IFNULL(%s, %s) AS %s`, name, value, name) } return name }
[ "func doltColToSqlCol(tableName string, col schema.Column) *sql.Column {\n\treturn &sql.Column{\n\t\tName: col.Name,\n\t\tType: nomsTypeToSqlType(col.Kind),\n\t\tDefault: nil,\n\t\tNullable: col.IsNullable(),\n\t\tSource: tableName,\n\t}\n}", "func GetColName(node Expr) string {\n\tif n, ok := node.(*C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
eprintToColumnsAndValues for a given EPrints struct generate a list of column names to query along with a recieving values array. Return a list of column names (with null handle and aliases) and values. The bool ifNull will control the type of expression of the column.
func eprintToColumnsAndValues(eprint *EPrint, columnsIn []string, ifNull bool) ([]string, []interface{}) { columnsOut := []string{} values := []interface{}{} for i, key := range columnsIn { switch key { case "eprintid": values = append(values, &eprint.EPrintID) columnsOut = append(columnsOut, key) case "...
[ "func (a *Generator) colvals(fields []*internal.Field, ignoreNames ...interface{}) string {\n\tignore := ignoreFromMultiTypes(ignoreNames)\n\n\tstr := \"\"\n\ti := 0\n\tfor _, f := range fields {\n\t\tif ignore[f.Name] {\n\t\t\tcontinue\n\t\t}\n\n\t\tif i != 0 {\n\t\t\tstr = str + \", \"\n\t\t}\n\t\tstr = str + a.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SQLReadEPrint expects a repository map and EPrint ID and will generate a series of SELECT statements populating a new EPrint struct or return an error (e.g. "not found" if eprint id is not in repository)
func SQLReadEPrint(config *Config, repoID string, baseURL string, eprintID int) (*EPrint, error) { var ( tables map[string][]string columns []string ) if eprintID == 0 { return nil, fmt.Errorf("not found, %d not in %q", eprintID, repoID) } _, ok := config.Repositories[repoID] if !ok { return nil, fmt.Err...
[ "func ImportEPrints(config *Config, repoID string, ds *DataSource, eprints *EPrints) ([]int, error) {\n\tvar importErrors error\n\tids := []int{}\n\n\tif config.Connections == nil {\n\t\treturn nil, fmt.Errorf(`no databases are not configured`)\n\t}\n\t_, ok := config.Connections[repoID]\n\tif !ok {\n\t\treturn nil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
qmList generates an array of string where each element holds "?".
func qmList(length int) []string { list := []string{} for i := 0; i < length; i++ { list = append(list, `?`) } return list }
[ "func getQueries(raw []string) []string {\n\tvar res []string\n\n\tfor _, q := range raw {\n\t\tfor _, qs := range strings.Split(q, \";\") {\n\t\t\tif nq := strings.TrimSpace(qs); len(nq) > 0 {\n\t\t\t\tres = append(res, nq+\";\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func (n BIP39Korean) GetList() []string ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
insertItemList takes an repoID, table name, list of columns and an EPrint datastructure then generates and executes a series of INSERT statement to create an Item List for the given table.
func insertItemList(db *sql.DB, repoID string, tableName string, columns []string, eprint *EPrint) error { var ( itemList ItemsInterface ) eprintid := eprint.EPrintID switch { case strings.HasPrefix(tableName, `eprint_creators_`): itemList = eprint.Creators case strings.HasPrefix(tableName, `eprint_editors_`)...
[ "func buildItems(db *sql.DB) {\n\tstm := `CREATE TABLE IF NOT EXISTS items (\n\t\titem_id SERIAL PRIMARY KEY,\n\t\tname varchar(80),\n\t\tprice INT\n\t\t);`\n\t_, err := db.Exec(stm)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func InsertItem(offers []model.Offer) bool {\n\tdb, err := sql.Open(\"sqlite3\", dbPa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SQLCreateEPrint will read a EPrint structure and generate SQL INSERT, REPLACE and DELETE statements suitable for creating a new EPrint record in the repository.
func SQLCreateEPrint(config *Config, repoID string, ds *DataSource, eprint *EPrint) (int, error) { var ( err error ) db, ok := config.Connections[repoID] if !ok { return 0, fmt.Errorf(`no database connection for %s`, repoID) } // If eprint id is zero generate a sequence of INSERT statements // for the record...
[ "func SQLReadEPrint(config *Config, repoID string, baseURL string, eprintID int) (*EPrint, error) {\n\tvar (\n\t\ttables map[string][]string\n\t\tcolumns []string\n\t)\n\tif eprintID == 0 {\n\t\treturn nil, fmt.Errorf(\"not found, %d not in %q\", eprintID, repoID)\n\t}\n\t_, ok := config.Repositories[repoID]\n\tif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ImportEPrints take an repository id, eprints structure. It is a reimplementation of EPrints Perl Import EPrint XML. ImportEPrints will create EPrint records using SQLCreateEPrint function. ImportEPrint is responsible for applly any rule sets and eprint status, SQLCreateEPRint is responsible for datestamps and timestamp...
func ImportEPrints(config *Config, repoID string, ds *DataSource, eprints *EPrints) ([]int, error) { var importErrors error ids := []int{} if config.Connections == nil { return nil, fmt.Errorf(`no databases are not configured`) } _, ok := config.Connections[repoID] if !ok { return nil, fmt.Errorf(`%s databas...
[ "func GetAllEPrintIDs(config *Config, repoID string) ([]int, error) {\n\treturn sqlQueryIntIDs(config, repoID, `SELECT eprintid FROM eprint\nORDER BY date_year DESC, date_month DESC, date_day DESC`)\n}", "func SQLReadEPrint(config *Config, repoID string, baseURL string, eprintID int) (*EPrint, error) {\n\tvar (\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EncodeNode Converts a node to labels. nodes > labels.
func EncodeNode(node *Node) map[string]string { labels := make(map[string]string) encodeNode(labels, node.Name, node) return labels }
[ "func LabelNode(nodeName, key, value string) (*corev1.Node, error) {\n\tNodeObject, err := client.Client.Nodes().Get(context.Background(), nodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tNodeObject.Labels[key] = value\n\tNodeObject, err = client.Client.Nodes().Update(context.Backgro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert no error occurred
func assertNoErr(err error, t *testing.T) { if err != nil { t.Errorf(err.Error()) panic(err.Error()) } }
[ "func TestEmptyResponse(t *testing.T) {\n\tcheck := assert.New(t)\n\terr := HandleErrorStatusCode(0, []byte(``))\n\tcheck.Contains(err.Error(), \"internal error\")\n}", "func cGoTestMayBeError(t *testing.T, message string, aPossibleError error) {\n if aPossibleError != nil {\n t.Errorf(\"%s\\nerror: %s\", mes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test encoding message sizes
func TestEncodeMessageSize(t *testing.T) { assertEq(encodeMessageSize(0), []byte{0, 0, 0, 0, 0}, t) assertEq(encodeMessageSize(1), []byte{0, 0, 0, 0, 1}, t) assertEq(encodeMessageSize(255), []byte{0, 0, 0, 0, 255}, t) assertEq(encodeMessageSize(256), []byte{0, 0, 0, 1, 0}, t) assertEq(encodeMessageSize(257), []byt...
[ "func TestDecodeMessageSize(t *testing.T) {\n\tassertEq(decodeMessageSize([]byte{0, 0, 0, 0, 0}), 0, t)\n\tassertEq(decodeMessageSize([]byte{0, 0, 0, 0, 1}), 1, t)\n\tassertEq(decodeMessageSize([]byte{0, 0, 0, 0, 255}), 255, t)\n\tassertEq(decodeMessageSize([]byte{0, 0, 0, 1, 0}), 256, t)\n\tassertEq(decodeMessageS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test decoding message sizes
func TestDecodeMessageSize(t *testing.T) { assertEq(decodeMessageSize([]byte{0, 0, 0, 0, 0}), 0, t) assertEq(decodeMessageSize([]byte{0, 0, 0, 0, 1}), 1, t) assertEq(decodeMessageSize([]byte{0, 0, 0, 0, 255}), 255, t) assertEq(decodeMessageSize([]byte{0, 0, 0, 1, 0}), 256, t) assertEq(decodeMessageSize([]byte{0, 0...
[ "func TestSize_UnmarshalText_MB(t *testing.T) {\n\tvar s itoml.Size\n\tif err := s.UnmarshalText([]byte(\"200m\")); err != nil {\n\t\tt.Fatalf(\"unexpected error: %s\", err)\n\t} else if s != 200*(1<<20) {\n\t\tt.Fatalf(\"unexpected size: %d\", s)\n\t}\n}", "func TestEncodeMessageSize(t *testing.T) {\n\tassertEq(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test object encoding and decoding
func TestObjectEncodeDecode(t *testing.T) { // Encode/decode an integer intValue := 29275 encodedInt, err := encodeObject(intValue) assertNoErr(err, t) decodedInt, err := decodeObject[int](encodedInt) assertNoErr(err, t) assertEq(decodedInt, intValue, t) // Encode/decode a string stringValue := "Hello, encode...
[ "func TestEncode(t *testing.T) {\n\ttt := []struct {\n\t\tname string\n\t\tm msg.MSG\n\t\tlength int\n\t}{\n\t\t{\n\t\t\tname: \"length\",\n\t\t\tm: msg.MSG{\n\t\t\t\tSender: \"BillKenned\",\n\t\t\t\tRecipient: \"JillKenned\",\n\t\t\t\tData: \"hello\",\n\t\t\t},\n\t\t\tlength: 27,\n\t\t},\n\t\t{\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test server creation and serving
func TestServerServe(t *testing.T) { // Create server server, _ := NewServer[any, any]() assert(!server.Serving(), t, "Server should not be serving") // Start server err := server.Start("0.0.0.0", 0) assertNoErr(err, t) assert(server.Serving(), t, "Server should be serving") time.Sleep(waitTime) // Check ser...
[ "func TestMultiRunningServers_v2(t *testing.T) {\n\tdomain := \"mydomain.com\"\n\thost := domain + \":443\"\n\tinitDefault()\n\tConfig.DisableBanner = true\n\tConfig.Tester.ListeningAddr = host\n\t// create the key and cert files on the fly, and delete them when this test finished\n\tcertFile, ferr := ioutil.TempFi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test getting server and client addresses
func TestAddresses(t *testing.T) { // Create server server, serverEvent := NewServer[any, any]() assert(!server.Serving(), t, "Server should not be serving") // Start server err := server.Start("127.0.0.1", 0) assertNoErr(err, t) assert(server.Serving(), t, "Server should be serving") time.Sleep(waitTime) //...
[ "func (f *FakeServer) GetAddr() (string, error) { return \"\", nil }", "func TestMultipleClients(t *testing.T) {\n\t// Create server\n\tserver, serverEvent := NewServer[int, string]()\n\tassert(!server.Serving(), t, \"Server should not be serving\")\n\n\t// Start server\n\terr := server.Start(\"127.0.0.1\", 0)\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test sending messages between server and client
func TestSend(t *testing.T) { // Create server server, serverEvent := NewServer[int, string]() assert(!server.Serving(), t, "Server should not be serving") // Start server err := server.Start("127.0.0.1", 0) assertNoErr(err, t) assert(server.Serving(), t, "Server should be serving") time.Sleep(waitTime) // C...
[ "func TestSendingNumerousMessages(t *testing.T) {\n\t// Create server\n\tserver, serverEvent := NewServer[int, int]()\n\tassert(!server.Serving(), t, \"Server should not be serving\")\n\n\t// Start server\n\terr := server.Start(\"127.0.0.1\", 0)\n\tassertNoErr(err, t)\n\tassert(server.Serving(), t, \"Server should ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test sending large random messages between server and client
func TestLargeSend(t *testing.T) { // Create server server, serverEvent := NewServer[[]byte, []byte]() assert(!server.Serving(), t, "Server should not be serving") // Start server err := server.Start("127.0.0.1", 0) assertNoErr(err, t) assert(server.Serving(), t, "Server should be serving") time.Sleep(waitTime...
[ "func TestSendingNumerousMessages(t *testing.T) {\n\t// Create server\n\tserver, serverEvent := NewServer[int, int]()\n\tassert(!server.Serving(), t, \"Server should not be serving\")\n\n\t// Start server\n\terr := server.Start(\"127.0.0.1\", 0)\n\tassertNoErr(err, t)\n\tassert(server.Serving(), t, \"Server should ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test sending numerous messages
func TestSendingNumerousMessages(t *testing.T) { // Create server server, serverEvent := NewServer[int, int]() assert(!server.Serving(), t, "Server should not be serving") // Start server err := server.Start("127.0.0.1", 0) assertNoErr(err, t) assert(server.Serving(), t, "Server should be serving") time.Sleep(...
[ "func send(ch IPCChannel, messages []string, name string) {\n\n\tfor _, testMsg := range messages {\n\t\tlogger.Infof(\"%v sending messages: %v\", name, testMsg)\n\t\tch.Send(testMsg)\n\t\ttime.Sleep(200 * time.Millisecond)\n\t}\n}", "func _TestHugeMessages(t *testing.T) {\n\tfmt.Println(\"Starting large message ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test sending custom types
func TestSendingCustomTypes(t *testing.T) { // Create server server, serverEvent := NewServer[custom, custom]() assert(!server.Serving(), t, "Server should not be serving") // Start server err := server.Start("127.0.0.1", 0) assertNoErr(err, t) assert(server.Serving(), t, "Server should be serving") time.Sleep...
[ "func TestTypeSerializations(t *testing.T) {\n\ttype T struct{}\n\t// Expected buffer from serialization\n\tvar expectedBuffer = []byte{5, 0, 0, 0, 0}\n\t// Serialize tests\n\tSerializeTest(t, NewDocument(), expectedBuffer)\n\tSerializeTest(t, &T{}, expectedBuffer)\n}", "func TestTypeConversionOperarion(t *testin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }