query stringlengths 8 4.68k | pos stringlengths 30 210k | negs listlengths 7 7 |
|---|---|---|
function to display os system running | func five() {
fmt.Print("Go runs on ")
switch os := runtime.GOOS; os {
case "darwin":
fmt.Println("OS X.")
case "linux":
fmt.Println("Linux.")
default:
// freebsd, openbsd,
// plan9, windows...
fmt.Printf("%s.\n", os)
}
} | [
"func Status() (salida string) {\n\t_, salida = RunCommand(\"ps aux | grep geth | grep alastria/data | grep -v grep | awk '{print $2}'\")\n\treturn\n}",
"func getOSC() string {\n\n\tosc := \"sh\"\n\tif runtime.GOOS == \"windows\" {\n\t\tosc = \"cmd\"\n\t}\n\n\treturn osc\n}",
"func SystemInfo() string {\n\tret... |
Emit emits messages to arbitrary topics. The mock simply forwards the emit to the KafkaMock which takes care of queueing calls to handled topics or putting the emitted messages in the emittedmessageslist | func (p *producerMock) Emit(topic string, key string, value []byte) *kafka.Promise {
return p.emitter(topic, key, value)
} | [
"func Mock(t *testing.T) *KafkaMock {\n\tasyncP, aMock := client.GetAsyncProducerMock(t)\n\tsyncP, sMock := client.GetSyncProducerMock(t)\n\tproducers := multiplexerProducers{\n\t\tsyncP, syncP, asyncP, asyncP,\n\t}\n\n\treturn &KafkaMock{\n\t\tNewMultiplexer(getMockConsumerFactory(t), producers, &client.Config{}, ... |
Age returns the age as time.Duration for the given key. Returns duration 0 for keys that don't exist. | func (cache *ttlCache) Age(key string) time.Duration {
cache.mut.Lock()
defer cache.mut.Unlock()
if val, exists := cache.times[key]; exists {
return time.Now().Sub(val)
}
return time.Duration(0)
} | [
"func (p Player) Age() int {\n\treturn int(time.Now().Sub(p.Birthday).Hours() / 24 / 365)\n}",
"func _CalcAge(entry CacheEntry) int64 {\n secs := time.Now().Unix()\n return entry.timestamp - secs\n}",
"func Age(seconds float64, planet Planet) float64 {\n\n\tvar earthYears float64 = seconds / Earth\n\n\tsw... |
Fatalf logs to the SQL_INTERNAL_PERF channel with severity FATAL. It extracts log tags from the context and logs them along with the given message. Arguments are handled in the manner of fmt.Printf. The SQL_INTERNAL_PERF channel is like the SQL perf channel above but aimed at helping developers of CockroachDB itself. I... | func (loggerSqlInternalPerf) Fatalf(ctx context.Context, format string, args ...interface{}) {
logfDepth(ctx, 1, severity.FATAL, channel.SQL_INTERNAL_PERF, format, args...)
} | [
"func (loggerSqlExec) VFatalf(ctx context.Context, level Level, format string, args ...interface{}) {\n\tif VDepth(level, 1) {\n\t\tlogfDepth(ctx, 1, severity.FATAL, channel.SQL_EXEC, format, args...)\n\t}\n}",
"func (h *HookContext) Fatal(msg string) error {\n\tpayload := fmt.Sprintf(\"%serror: %s\\n\", fatalStr... |
Enable enables issuing of requestPaused events. A request will be paused until client calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth. See: parameters: | func Enable() *EnableParams {
return &EnableParams{}
} | [
"func (c *ChromeRuntime) Enable() (*ChromeResponse, error) {\n return sendDefaultRequest(c.target.sendCh, &ParamRequest{Id: c.target.getId(), Method: \"Runtime.enable\"})\n}",
"func (_Comptroller *ComptrollerTransactorSession) SetMintPaused(cToken common.Address, state bool) (*types.Transaction, error) {\n\tretu... |
AssignProperties_From_RoutingServiceBusQueueEndpointProperties populates our RoutingServiceBusQueueEndpointProperties from the provided source RoutingServiceBusQueueEndpointProperties | func (properties *RoutingServiceBusQueueEndpointProperties) AssignProperties_From_RoutingServiceBusQueueEndpointProperties(source *v20210702s.RoutingServiceBusQueueEndpointProperties) error {
// AuthenticationType
if source.AuthenticationType != nil {
authenticationType := RoutingServiceBusQueueEndpointProperties_... | [
"func (properties *RoutingServiceBusTopicEndpointProperties) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif properties == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &RoutingServiceBusTopicEndpointProperties_ARM{}\n\n\t// Set property \"AuthenticationType\":\n\tif proper... |
IsRedirect returns true when this list m t os internal server error response has a 3xx status code | func (o *ListMTOsInternalServerError) IsRedirect() bool {
return false
} | [
"func (o *FcInterfaceGetDefault) IsRedirect() bool {\n\treturn o._statusCode/100 == 3\n}",
"func (o *ListClustersInternalServerError) IsRedirect() bool {\n\treturn false\n}",
"func (o *BindHostInternalServerError) IsRedirect() bool {\n\treturn false\n}",
"func (o *V2UpdateHostIgnitionInternalServerError) IsRe... |
ReadPointerAtAddress returns pointer at a given virtual address | func (f *File) ReadPointerAtAddress(address uint64) (uint64, error) {
uuid, offset, err := f.GetOffset(address)
if err != nil {
return 0, fmt.Errorf("failed to get offset for address %#x: %v", address, err)
}
return f.ReadPointerForUUID(uuid, offset)
} | [
"func (tp taggedPointer) pointer() unsafe.Pointer {\n\treturn unsafe.Pointer(uintptr(tp >> 32))\n}",
"func (thread *ThreadContext) ReturnAddressFromOffset(offset int64) uint64 {\n\tregs, err := thread.Registers()\n\tif err != nil {\n\t\tpanic(\"Could not obtain register values\")\n\t}\n\n\tretaddr := int64(regs.R... |
DefaultMessage return the default url error message | func (u Url) DefaultMessage() string {
return MessageTmpls["Url"]
} | [
"func errorNotFound() (string, error, int) {\n return \"\", errors.New(\"Requested URL not found\"), http.StatusNotFound\n}",
"func (c Chinese) DefaultMessage() string {\n\treturn MessageTmpls[\"Chinese\"]\n}",
"func (o *MonitorRequestExecutionResult) GetUrlOk() (*string, bool) {\n\tif o == nil || o.Url == ni... |
GetFaqCategoryBySlugOrId Get an FAQ category by slug or id | func (co *PlatformAppContent) GetFaqCategoryBySlugOrId(IDOrSlug string) (GetFaqCategoryBySlugSchema, error) {
var (
rawRequest *RawRequest
response []byte
err error
getFaqCategoryBySlugOrIdResponse GetFaqCategoryBySlugSchema
)
... | [
"func (pr PortalRepo) OneCategory(ctx context.Context, search *CategorySearch, ops ...OpFunc) (*Category, error) {\n\tobj := &Category{}\n\terr := buildQuery(ctx, pr.db, obj, search, pr.filters[Tables.Category.Name], PagerTwo, ops...).Select()\n\n\tif errors.Is(err, pg.ErrMultiRows) {\n\t\treturn nil, err\n\t} else... |
WithHeaders if set, overrides the request headers. Note that the overrides do not extend to subsequent redirect hops, if a redirect happens. Another override may be applied to a different request produced by a redirect. | func (p ContinueRequestParams) WithHeaders(headers []*HeaderEntry) *ContinueRequestParams {
p.Headers = headers
return &p
} | [
"func (rq *Request) Headers(headers []string) {\n\trq.headers = headers\n}",
"func (options *GetAppRevisionOptions) SetHeaders(param map[string]string) *GetAppRevisionOptions {\n\toptions.Headers = param\n\treturn options\n}",
"func ForwardHeaders(ctx context.Context, req *http.Request) *http.Request {\n\tretur... |
IsNoSymlink returns true if this is an error like ErrNoSymlink. | func IsNoSymlink(err error) bool {
if err == nil {
return false
}
pe, ok := err.(*pathError)
return ok && pe.message == "no symlink"
} | [
"func IsErrRedirectNotExist(err error) bool {\n\t_, ok := err.(ErrRedirectNotExist)\n\treturn ok\n}",
"func (l *Link) Symlink(force bool) error {\n\tif force {\n\t\terr := os.Remove(l.Dest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn os.Symlink(l.Src, l.Dest)\n}",
"func isMissingRelation(err er... |
Cmp compare two Numeric. 1 if x y | func (x *Numeric) Cmp(y *Numeric) (r int) {
if x.sign == NaN || y.sign == NaN {
return -1 // TODO is it good
}
if x.sign == Positive && y.sign == Negative {
return +1
} else if x.sign == Negative && y.sign == Positive {
return -1
}
r = cmpAbs(x.digits, x.weight, y.digits, y.weight)
if x.sign == Negative... | [
"func compare(iv, jv interface{}) int {\n\tistr, istrok := iv.(string)\n\tjstr, jstrok := jv.(string)\n\tiint, iintok := iv.(int)\n\tjint, jintok := jv.(int)\n\n\tswitch {\n\tcase istrok && jintok:\n\t\t// i is a string, j is an int\n\t\t// cwl spec: \"ints sort before strings\"\n\t\treturn 1\n\tcase iintok && jstr... |
ClearPassword clears the value of the "password" field. | func (ftuo *FieldTypeUpdateOne) ClearPassword() *FieldTypeUpdateOne {
ftuo.mutation.ClearPassword()
return ftuo
} | [
"func TestPasswords_SetPassword_empty(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip()\n\t}\n\n\tt.Parallel()\n\tctx, _, done := testContext()\n\tdefer done()\n\n\ts := newPassword()\n\tuid := nextUID()\n\tif err := s.SetPassword(ctx, uid, \"\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// No password should b... |
NewTrafficManager init a new TrafficManager by setting | func NewTrafficManager(duration int, maxConnection, banPeriod int64, route url.URL) *TrafficManager {
return &TrafficManager{
Stats: new(sync.Map),
BufferDuration: time.Duration(duration),
Route: route,
maxConnection: maxConnection,
banPeriod: banPeriod,
}
} | [
"func New(logger *log.Logger, shutdownCh chan struct{}, clusterInfo ManagerSerfCluster, connPoolPinger Pinger) (m *Manager) {\n\tm = new(Manager)\n\tm.logger = logger\n\tm.clusterInfo = clusterInfo // can't pass *consul.Client: import cycle\n\tm.connPoolPinger = connPoolPinger // can't pass *consul.ConnPool: ... |
getHTTPListener gets a listener on a port or unix socket depending on the options provided. If HTTP should not be enabled, it returns nil. | func (o *options) getHTTPListener() (net.Listener, error) {
protocol := "HTTP"
if o.httpAddr != "" {
return getPortListener(o.httpAddr, protocol)
}
if o.httpPort != -1 {
return getPortListener(fmt.Sprintf(":%v", o.httpPort), protocol)
}
if o.httpUnixSocket != "" {
return getUnixSocketListener(o.httpUnixS... | [
"func GetListenerRule(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *ListenerRuleState, opts ...pulumi.ResourceOpt) (*ListenerRule, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"actions\"] = state.Actions\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"conditions\"]... |
genPrivKey creates a RSA Private Key of specified byte size | func genPrivKey(bitSize int) (*rsa.PrivateKey, error) {
// Private Key generation
privateKey, err := rsa.GenerateKey(rand.Reader, bitSize)
if err != nil {
return nil, err
}
// Validate Private Key
err = privateKey.Validate()
if err != nil {
return nil, err
}
return privateKey, nil
} | [
"func (s *SSHKeyGen) generatePrivateKey(bitSize int) (*rsa.PrivateKey, error) {\n\t// Private Key generation\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, bitSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Validate Private Key\n\terr = privateKey.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\... |
FromFile return config from file path. | func FromFile(path string) (Config, error) {
var config Config
err := cfg.Init(&config, path)
if err != nil {
return config, fmt.Errorf("init path %s: %w", path, err)
}
return config, nil
} | [
"func ConfFromFile(filename string) (*CaptainConf, error) {\n\tbytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading %s: %s\", filename, err)\n\t}\n\treturn ConfFromBytes(bytes)\n}",
"func FromFile(path string) (*Config, error) {\n\tobj := Config{}\n\tdata, err := ... |
Validate validates this price list collection response meta | func (m *PriceListCollectionResponseMeta) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validatePagination(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
"func (m *ListAssessmentResultsResponse) Validate() error {\n\treturn m.validate(false)\n}",
"func (mt *Photo) Validate() (err error) {\n\tif mt.Alt == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"alt\"))\n\t}\n\tif mt.Original == \"\" {\n\t\terr = goa.MergeErrors(err, goa.Missin... |
EnterUnannType is called when production unannType is entered. | func (s *BaseJava8ParserListener) EnterUnannType(ctx *UnannTypeContext) {} | [
"func (s *BaseJava8ParserListener) EnterUnannArrayType(ctx *UnannArrayTypeContext) {}",
"func (s *BaseVisualBasic6ParserListener) EnterTypeStmt(ctx *TypeStmtContext) {}",
"func (s *BaseSV2017ParserListener) EnterData_type_usual(ctx *Data_type_usualContext) {}",
"func (s *BaseSV2017ParserListener) EnterN_input... |
FUNCTION_NAME = gtk_text_view_set_pixels_above_lines, NONE, NONE, 2, WIDGET, INT | func (w *TextView) SetPixelsAboveLines(pixelsAboveLines int) {
w.Candy().Guify("gtk_text_view_set_pixels_above_lines", w, pixelsAboveLines)
} | [
"func renderLineWithMarkup(x, y, maxWidth int, str string, markup *Markup) int {\n\tcolumn := x\n\tstringWidth := 0\n\t//tracks the number of screen lines used to render\n\tadditionalLines := 0\n\n\tavailableWidth := maxWidth\n\n\tfor _, token := range Tokenize(str, SupportedTags) {\n\t\t// First check if it's a ta... |
schedule schedules a post to be published later. | func (h hugo) schedule(c *filemanager.RequestContext, w http.ResponseWriter, r *http.Request) (int, error) {
t, err := time.Parse("2006-01-02T15:04", r.Header.Get("Schedule"))
path := filepath.Join(string(c.User.FileSystem), r.URL.Path)
path = filepath.Clean(path)
if err != nil {
return http.StatusInternalServer... | [
"func (r *RDB) Schedule(ctx context.Context, msg *base.TaskMessage, processAt time.Time) error {\n\tvar op errors.Op = \"rdb.Schedule\"\n\tencoded, err := base.EncodeMessage(msg)\n\tif err != nil {\n\t\treturn errors.E(op, errors.Unknown, fmt.Sprintf(\"cannot encode message: %v\", err))\n\t}\n\tif err := r.client.S... |
PriceAsString returns the price as a string | func (p *PriceLevelRecord) PriceAsString() string {
return big.NewRat(int64(p.Pricen), int64(p.Priced)).FloatString(7)
} | [
"func (s EstimateTemplateCostOutput) String() string {\n\treturn awsutil.Prettify(s)\n}",
"func (q *quote) String() string {\n\n\t// Build a slice up containing the return format.\n\tvar s []string\n\ts = append(s, fmt.Sprintf(\"Requested amount: £%d\", q.RequestedAmount))\n\ts = append(s, fmt.Sprintf(\"Rate: %.1... |
Get the list of Networks mapped to the account in its Primary Data Center. NOTE: The API docs mention acctAlias/location arguments, but their use did not show any influence on the result (which referred to account default and home data center). This command seems to be subsumed by GetAccountNetworks() | func (c *Client) GetNetworks() (nets []Network, err error) {
err = c.getResponse("/Network/GetNetworks/JSON", nil, &struct {
BaseResponse
Networks *[]Network
} { Networks: &nets })
return
} | [
"func getNetworks(osp *OpenstackPlugin) component.Component {\n\trows := []component.TableRow{}\n\n\terr := networks.List(networkClientHelper(osp), networks.ListOpts{}).EachPage(\n\t\tfunc(page pagination.Page) (bool, error) {\n\t\t\tnetworkList, err := networks.ExtractNetworks(page)\n\n\t\t\tif err != nil {\n\t\t\... |
CreditLimits is a free data retrieval call binding the contract method 0x99bc1873. Solidity: function creditLimits(address ) view returns(uint256) | func (_Comptroller *ComptrollerSession) CreditLimits(arg0 common.Address) (*big.Int, error) {
return _Comptroller.Contract.CreditLimits(&_Comptroller.CallOpts, arg0)
} | [
"func (SkAdNetworkAttributionCreditEnum_SkAdNetworkAttributionCredit) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_enums_sk_ad_network_attribution_credit_proto_rawDescGZIP(), []int{0, 0}\n}",
"func (_AastraRouter *AastraRouterCaller) GetRangeAmounts(opts *bind.CallOpts, _vault common... |
SetPayload sets the payload to the list cluster hosts internal server error response | func (o *ListClusterHostsInternalServerError) SetPayload(payload *models.Error) {
o.Payload = payload
} | [
"func (o *GetCurrencySymbolInternalServerError) SetPayload(payload models.Error) {\n\to.Payload = payload\n}",
"func (o *GetClusterByIDUnauthorized) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}",
"func (o *V2ImportClusterInternalServerError) SetPayload(payload *models.Error) {\n\to.Payloa... |
Adds a field to this Binson object. | func (b Binson) Put(name string, value interface{}) (Binson) {
key := binsonString(name)
switch o := value.(type) {
case Binson:
b[key] = o
case *BinsonArray:
b[key] = o
case int:
b[key] = binsonInt(int64(o))
case int64:
b[key] = bi... | [
"func (m *ActivitiesMutation) AddField(name string, value ent.Value) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown Activities numeric field %s\", name)\n}",
"func (f *Fields) AddField(field *Field) {\n\t*f = append(*f, field)\n}",
"func (m *StudyplanMutation) AddField(name string, value ent.Value... |
GetOffsetForUUID returns the offset for a given virtual address for a given cache UUID | func (f *File) GetOffsetForUUID(uuid types.UUID, address uint64) (uint64, error) {
for _, mapping := range f.Mappings[uuid] {
if mapping.Address <= address && address < mapping.Address+mapping.Size {
return (address - mapping.Address) + mapping.FileOffset, nil
}
}
return 0, fmt.Errorf("address %#x not within ... | [
"func (s *Cursor) GetOffset() *Vec2 {\n\tvar ret *Vec2\n\tret = (*Vec2)(unsafe.Pointer(&s.offset))\n\treturn ret\n}",
"func (m *Map) ByID(uuid string) *Device {\n\tm.RLock()\n\tdefer m.RUnlock()\n\n\tif node, ok := m.devices[uuid]; ok {\n\t\treturn node\n\t}\n\treturn nil\n}",
"func (_class ClusterClass) GetByU... |
Input: 1 / \ 2 3 \ 5 Output: ["1>2>5", "1>3"] Explanation: All roottoleaf paths are: 1>2>5, 1>3 | func binaryTreePaths(root *TreeNode) []string {
var paths []string
if root == nil {
return paths
}
helper(root, "", &paths)
return paths
} | [
"func (t *TreeNode) flatten() []string {\n\n\tlineage := []string{}\n\n\tp := t\n\tfor p != nil {\n\t\t// Prepend the lineage\n\t\tlineage = append([]string{p.name}, lineage...)\n\t\tp = p.parent\n\t}\n\n\treturn lineage\n}",
"func ancestryPath(as []*cloudresourcemanager.Ancestor) string {\n\tvar path []string\n\... |
NewApiaryOptions make new Options for the Apiary format | func NewApiaryOptions(name string) Options {
return Options{
Header: fmt.Sprintf("FORMAT: 1A\n# %s Blueprint\n", name),
Optionals: true,
}
} | [
"func configureFlags(api *operations.SavoodAPI) {\n\t// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }\n}",
"func newOpenAPIParam(name, description string, in paramLocation, options ...ParamOption) *openAPIParam {\n\tp := &openAPIParam{\n\t\tName: name,\n\t\tDescription: description,\... |
SubStep prints a line console, at a given indent and stops the spinner ignoreVerboseRule true, ensures the SubStep always prints | func SubStep(message string, indent int, last, ignoreVerboseRule bool) {
if outputTTY {
if message != previousSubStepMessage {
previousSubStepMessage = message
// Substeps are only printed if the verbose flag is set at init
// Unless it's the last substep
if verbose || ignoreVerboseRule || last {
var... | [
"func (proxy *Metrics) printVerbose(elapsedTime time.Duration, base string) {\n\tfmt.Printf(\"time:%v\\ttemplate:%s\\tbase:%s\\telapsed:%f\\n\",\n\t\ttime.Now(),\n\t\tproxy.name,\n\t\tbase,\n\t\telapsedTime.Seconds(),\n\t)\n}",
"func PrintSolution(step *riddle.Step, elapsed time.Duration) {\n\tif step == nil {\n\... |
splitAndScatterKey implements the splitAndScatterer interface. It is safe to always return 0 since during processor planning the range router has a `DefaultStream` specified in case the range generated by this node ID doesn't match any of the result router's spans. | func (n noopSplitAndScatterer) splitAndScatterKey(
_ context.Context, _ keys.SQLCodec, _ *kv.DB, _ *storageccl.KeyRewriter, _ roachpb.Key, _ bool,
) (roachpb.NodeID, error) {
return 0, nil
} | [
"func (s dbSplitAndScatterer) splitAndScatterKey(\n\tctx context.Context,\n\tcodec keys.SQLCodec,\n\tdb *kv.DB,\n\tkr *storageccl.KeyRewriter,\n\tkey roachpb.Key,\n\trandomizeLeases bool,\n) (roachpb.NodeID, error) {\n\texpirationTime := db.Clock().Now().Add(time.Hour.Nanoseconds(), 0)\n\tnewSpanKey, err := rewrite... |
Dijkstra's algorithm to find shortest path from s to destin | func dijkstra(G [][]railway, src int, destin int) []int {
n := len(G)
dist := make([]int, n)
pred := make([]int, n) // preceeding node in path
visited := make([]bool, n) // all false initially
for i:=0; i<n; i++ {
dist[i] = 30000 //very big value
}
dist[src] = 0
for i:=0; ... | [
"func Dijkstra(graph [V][V]int, src int) {\n\tvar dist [V]int // The output array. dist[i] will hold the shortest\n\t// distance from src to i\n\tvar sptSet [V]bool // sptSet[i] will be true if vertex i is included in shortest\n\t// path tree or shortest distance from src to i is finalized\n\t// Initialize all dis... |
Tag generates a tag from c. | func (c CompactCoreInfo) Tag() Tag {
return Tag{
LangID: Language(c >> 20),
RegionID: Region(c & 0x3ff),
ScriptID: Script(c>>12) & 0xff,
}
} | [
"func (t *FakeTickers) Tag(tag string) {\n\tt.tag = tag\n}",
"func (f SymbolField) Tag() quickfix.Tag { return tag.Symbol }",
"func genTag() string {\n\t// use UTC time for everything\n\tnow := time.Now().UTC()\n\treturn fmt.Sprintf(\"a8t-ec2-%d%x%x\", now.Year()-2000, int(now.Month()), now.Day())\n}",
"func ... |
RegisterTransactionPoolHTTPHandlers registers the default Rivine handlers for all default Rivine TransactionPool HTTP endpoints. | func RegisterTransactionPoolHTTPHandlers(router Router, cs modules.ConsensusSet, tpool modules.TransactionPool, requiredPassword string) {
if cs == nil {
build.Critical("no consensus set module given")
}
if tpool == nil {
build.Critical("no transaction pool module given")
}
if router == nil {
build.Critical(... | [
"func RegisterClientsHandlers() {\n\thttp.HandleFunc(\"/control/clients\", postInstall(optionalAuth(ensureGET(handleGetClients))))\n}",
"func InitializeHandlers() {\n\thttp.HandleFunc(\"/login/\", LoginPostHandler)\n\thttp.HandleFunc(\"/logout/\", LogoutPostHandler)\n\thttp.HandleFunc(\"/\", LoginPageHandler)\n\n... |
Exec executes a prepared statement with the given arguments and returns a sql.Result summarizing the effect of the statement. | func (db *DB) Exec(query string, args ...interface{}) (sql.Result, error) {
stmt, err := db.prepare(query, args...)
if err != nil {
return nil, err
}
defer stmt.Close()
result, err := stmt.Exec(args...)
if err != nil {
return nil, err
}
return result, err
} | [
"func (q *queryWrapper) Exec(args ...interface{}) (sql.Result, error) {\n\treturn q.db.Exec(q.sqlQuery, args...)\n}",
"func (db *DB) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {\n\tdone := make(chan struct{}, 1)\n\n\tvar res sql.Result\n\tvar err error\n\n\tf := func(sqldb *s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.