text stringlengths 3.08k 10.4k |
|---|
package master
import (
"fmt"
"net/http"
"os"
"path"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/build"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
"github.com/GoogleClou... |
package solutions
import (
"sort"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSolution1(t *testing.T) {
assert := assert.New(t)
var arr = []int{2, 7, 11, 15}
actual := twoSum(arr, 9)
var expected = []int{0, 1}
assert.Equal(actual, expected, "Solution1")
}
func TestSolution287(t *t... |
package db
import (
"database/sql"
"errors"
"fmt"
"strconv"
"time"
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
base "github.com/shiniu0606/engine/core/base"
)
const DEFAULT_DB_DRIVER = "mysql"
const TEST_DB_DRIVER = "sqlite3"
//db实例
var gdb *gorm.DB
type Action func(db *gorm.DB) (interface... |
package config
import (
"encoding/json"
"fmt"
"io/ioutil"
"path/filepath"
"reflect"
"strings"
validator "gopkg.in/go-playground/validator.v9"
yaml "gopkg.in/yaml.v2"
)
var validate = validator.New()
func init() {
validate.RegisterTagNameFunc(func(field reflect.StructField) string {
return field.Tag.Get("... |
package forgery
import (
"fmt"
"strings"
"github.com/emily33901/forgery/core/events"
"github.com/emily33901/forgery/core/filesystem"
"github.com/emily33901/forgery/core/vmf"
"github.com/emily33901/forgery/core/world"
imguiBackend "github.com/emily33901/forgery/forgery/imgui"
"github.com/emily33901/forgery/for... |
package mt
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"os"
"strings"
"time"
mtjson "github.com/jefflinse/melatonin/json"
)
var (
defaultRequestTimeout = 10 * time.Second
)
func init() {
envTimeoutStr := os.Getenv("MELATONIN_DEFAULT_TEST_TIMEOUT")
if e... |
package autoscaling
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/cloudquery/cloudquery/providers/common"
"github.com/mitchellh/mapstructure"
"go.uber.org/zap"
"gorm.io/gorm"
"time"
)
type LaunchConfiguration struct {
ID uint `gorm:"primarykey"`
// AWS ... |
package mtx
import (
"fmt"
)
type Shape = [2]int
type Mtx struct {
Shape Shape
data []float64
}
func NewMtx(s Shape) Mtx {
sum := 1
for _, v := range s {
sum *= v
}
return Mtx{
s,
make([]float64, sum),
}
}
func NewMtxNE(s Shape, data []float64) Mtx {
return Mtx{s, data}
}
func NewOnes(s Shape) Mtx... |
package main
import (
"bytes"
"encoding/json"
"flag"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"strings"
"time"
)
const (
// ApiHost of the slack api.
ApiHost = "https://slack.com/api/"
)
func main() {
token := flag.String("token", "", "Slack user token.")
channelID := flag.String("channel", "", "Tar... |
package pod
import (
"encoding/json"
"errors"
"fmt"
"k8s.io/kubectl/pkg/metricsutil"
"time"
"github.com/golang/glog"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/kubectl/pkg/cmd/top"
metricsapi "k8s.io/metrics/pkg/apis/metrics"
metricsv1beta1a... |
package binlog
import (
"encoding/binary"
"fmt"
"time"
"github.com/juju/errors"
"github.com/sryanyuan/binp/serialize"
)
const (
timefOfs int64 = 0x800000000000
)
var (
decimalTimeFormat = []string{
"2006-01-02 15:04:05",
"2006-01-02 15:04:05.0",
"2006-01-02 15:04:05.00",
"2006-01-02 15:04:05.000",
... |
package nsptopoviewer
import (
"encoding/json"
"fmt"
"os"
"strconv"
"strings"
log "github.com/sirupsen/logrus"
//nsptopoviewer "local.com/nspgo/nspGo-topoViewer"
)
type CyGraph struct {
GraphNodes []CyNode `json:"nodes"`
GraphLinks []CyLink `json:"links"`
}
type CyNode struct {
Data struct {
ID ... |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
// Package secp256k1 is an implementation of the kyber.{Group,Point,Scalar}
////////////////////////////////////////////////////////////////////////////////
// XXX: Do not use in production until this code has been audited.
////////////////////////////////////////////////////////////////////////////////
// interf... |
// GeneSeq contains functions and other data structures for processing gene models and annotations
// from difference public data bases like ENSEMBL and UCSC
// Currently supports genePred and GTF formats
package geneSeq
import (
"bytes"
"fmt"
"log"
"strings"
"github.com/edotau/goFish/concurrency"
"github.com/e... |
// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
/*
* Copyright 2018 Nokia
* Licensed under BSD 3-Clause Clear License,
* see LICENSE file for details.
*/
package elasticsearch
import (
"bytes"
"crypto/tls"
"elasticsearchplugin/pkg/config"
"fmt"
"io/ioutil"
"net/http"
"os"
"path"
"strings"
"sync"
"time"
log "github.com/sirupsen/logrus"
)
var (
once ... |
package main
import (
"encoding/json"
"os"
"runtime"
"strings"
"time"
astilectron "github.com/asticode/go-astilectron"
bootstrap "github.com/asticode/go-astilectron-bootstrap"
)
// ListItem represents a list item
type ListItem struct {
Name string `json:"name"`
Type string `json:"type"`
}
func sendLog(msg ... |
package backup
import (
"archive/tar"
"archive/zip"
"bufio"
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"path/filepath"
"strings"
"time"
"github.com/danhale-git/craft/internal/files"
docker "github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/danhale-git/craft/internal/log... |
package GUI
import (
"fmt"
"github.com/icza/gowut/gwu"
cm "myProject/videoCli/common"
"strconv"
"strings"
)
var (
PreSizeCb gwu.CheckBox
PreSizeW gwu.TextBox
PreSizeH gwu.TextBox
)
/*
Size float64 // 字号
Bold bool // 是否加粗
TextColor string // 文字颜色
StrokeColor string ... |
package client
import (
"compress/flate"
"compress/gzip"
"encoding/json"
"fmt"
"github.com/neuronlabs/neuron/controller"
"github.com/neuronlabs/neuron/encoding/jsonapi"
"github.com/neuronlabs/neuron/errors"
"github.com/neuronlabs/neuron/log"
"github.com/neuronlabs/neuron/query/scope"
"gopkg.in/go-playground/... |
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package glue
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource Type definition for AWS::Glue::Job
func LookupJob(ctx *pulumi.C... |
package logic
//nolint:goimports //i like it
import (
"bufio"
"fmt"
"github.com/hedzr/bgo/internal/logic/build"
"github.com/hedzr/bgo/internal/logic/logx"
"github.com/hedzr/cmdr"
"github.com/hedzr/log/exec"
"gopkg.in/yaml.v3"
"io"
"os"
"strconv"
"strings"
"text/template"
)
func setSaveMode(b bool) {
k2 :... |
package main
import (
"github.com/ant0ine/go-json-rest/rest"
"github.com/bsphere/celery"
"github.com/streadway/amqp"
"log"
"net/http"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"time"
"os"
"encoding/json"
"flag"
"fmt"
)
// -- Main function --
// Sets up server and Tasks struct, starts listening ... |
// +build mage
package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"runtime"
"strings"
"time"
"github.com/magefile/mage/mg" // mg contains helpful utility functions, like Deps
"github.com/magefile/mage/sh"
)
const (
packageName = "github.com/duckpuppy/algolia-hugo"
)
var ldflags = "-w -s" +
" -X $PACKA... |
package database
import "strings"
type TypeConverter struct {
driver string
fromJdbc map[string]map[string]string
toJdbc map[string]map[string]string
valid map[string]bool
}
func NewTypeConverter(driver string) *TypeConverter {
fromJdbc := map[string]map[string]string{
"mysql": {
"clob": "longt... |
// Copyright (c) 2016, 2018, 2022, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
package resource
import (
"fmt"
"os"
"sort"
"strconv"
"strings"
"sync"
"github.com/jckuester/awsls/util"
"github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/gocty"
"github.com/apex/log"
"github.com/fatih/color"
"github.com/gobwas/glob"
"github.com/jckuester/awsls/aws"
"github.com/jckuester/... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package containerservice
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to access informat... |
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
package cluster
import (
"context"
"encoding/json"
"time"
"github.com/capella-pw/queue/compress"
"github.com/myfantasy/mft"
)
const (
CtxStopTimeName = "ctx_stop_time"
)
type ServiceRequest struct {
AuthentificationType string `json:"auth_type"`
UserName string `json:"user_name"`
Authentificati... |
// Copyright 2021 Antrea Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package reclustering
import (
"context"
"fmt"
"time"
"infra/appengine/weetbix/internal/clustering"
"infra/appengine/weetbix/internal/clustering/alg... |
package munn
import (
"fmt"
"io"
"regexp"
"strings"
"sync"
"time"
"gopkg.in/yaml.v2"
)
var (
scheduleParsersLock sync.Mutex
scheduleParsers = make(map[string]ScheduleParser)
)
// RegisterScheduleParser registers a schedule parser
func RegisterScheduleParser(name string, parser Schedu... |
package cmd
import (
"context"
"fmt"
"time"
"github.com/BurntSushi/toml"
"github.com/google/go-github/v27/github"
"github.com/rs/zerolog/log"
"github.com/traefik/aloba/internal/gh"
"github.com/traefik/aloba/label"
"github.com/traefik/aloba/milestone"
"github.com/traefik/aloba/options"
)
const stateOpened =... |
//
// KULADO INC. CONFIDENTIAL
// __________________
//
// [2014] - [2019] KULADO INC.
// All Rights Reserved.
//
// NOTICE: All information contained herein is, and remains
// the property of KULADO INC. and its suppliers,
// if any. The intellectual and technical concepts contained
// herein are proprietary to KULA... |
package broker
import (
"github.com/Masterminds/semver"
"github.com/sirupsen/logrus"
"k8s.io/helm/pkg/proto/hapi/chart"
rls "k8s.io/helm/pkg/proto/hapi/services"
"github.com/kyma-project/kyma/components/helm-broker/internal"
"github.com/kyma-project/kyma/components/helm-broker/internal/bind"
"github.com/kyma-... |
// Copyright 2019 GoAdmin Core Team. All rights reserved.
// Use of this source code is governed by a Apache-2.0 style
// license that can be found in the LICENSE file.
package dialect
import (
"fmt"
"strings"
"github.com/GoAdminGroup/go-admin/modules/config"
)
// Dialect is methods set of different driver.
type... |
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distri... |
package renter
import (
"bytes"
"io"
"github.com/pkg/errors"
"gitlab.com/SiaPrime/SiaPrime/modules"
"github.com/JayRama/us/hostdb"
"github.com/JayRama/us/merkle"
"github.com/JayRama/us/renter/proto"
"github.com/JayRama/us/renterhost"
)
// ErrBadChecksum indicates that a piece of sector data failed checksum
/... |
package db
import (
"errors"
"fmt"
"github.com/certusone/wormhole/node/pkg/vaa"
"github.com/dgraph-io/badger/v3"
"strconv"
"strings"
)
type Database struct {
db *badger.DB
}
type VAAID struct {
EmitterChain vaa.ChainID
EmitterAddress vaa.Address
Sequence uint64
}
// VaaIDFromString parses a <chain... |
package cwhub
import (
"fmt"
"os"
"path/filepath"
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
//DisableItem to disable an item managed by the hub, removes the symlink if purge is true
func DisableItem(hub *csconfig.Hub, target Item, purge bool, fo... |
/*
* Copyright 2018 The Trickster Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... |
/*
* Copyright 2019 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in wr... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package lambda
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides information about a Lambda Code Signing ... |
// Copyright 2015 <NAME>. All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
package xstrings
import (
"strconv"
"strings"
"testing"
)
func TestReverse(t *testing.T) {
runTestCases(t, Reverse, _M{
"reverse string": "gnirts esrever",
"中文如何?": "?何如文中",
"中en... |
// Copyright 2017 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package request
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jl... |
package auth
import (
"context"
"encoding/hex"
"encoding/pem"
"errors"
"fmt"
"github.com/enfabrica/enkit/astore/common"
"github.com/enfabrica/enkit/astore/rpc/auth"
"github.com/enfabrica/enkit/lib/kcerts"
"github.com/enfabrica/enkit/lib/logger"
"github.com/enfabrica/enkit/lib/oauth"
"golang.org/x/crypto/nac... |
// Copyright (c) 2016-2018 iQIYI.com. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required b... |
/*
* Copyright 2019-2020 VMware, Inc.
* All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law... |
package miner
import (
"fmt"
"sort"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
"github.com/filecoin-project/specs-actors/v6/actors/util/adt"
)
// Wrapper for working with an AMT[ChainEpoch]*Bitfield functioning as... |
package main
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
)
const (
tEscape = "\t"
quoteEscape = "\""
nEscape = "\n"
midEscape = "-"
downEscape = "_"
slashEscape = "/"
)
func GetFilesAndDirs(dirPth string) (files []string, dirs []string, err erro... |
package RowBinary
import (
"bufio"
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"math"
"os"
"strings"
"time"
"github.com/pierrec/lz4"
)
// Read all good records from unfinished RowBinary file.
type Reader struct {
fd *os.File
reader *bufio.Reader
offset int
size int
eof ... |
package server
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"net"
"strings"
"time"
"github.com/tidwall/resp"
"github.com/quesurifn/tile38/pkg/core"
"github.com/quesurifn/tile38/pkg/log"
)
// This phrase is copied nearly verbatim from Redis.
var deniedMessage = []byte(strings.Replace(strings.Trim... |
package logic
import (
"context"
"encoding/json"
"sort"
"strings"
"unicode/utf8"
"tracking/cmd/api/internal/model"
"tracking/cmd/api/internal/svc"
"tracking/cmd/api/internal/types"
"github.com/tal-tech/go-zero/core/logx"
)
type QueryPageDetailLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc... |
package machine
import (
gocontext "context"
"crypto/tls"
"crypto/x509"
goerrors "errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"time"
"github.com/code-ready/crc/pkg/crc/cluster"
"github.com/code-ready/crc/pkg/crc/constants"
"github.com/code-ready/crc/pkg/crc/erro... |
package eventloop
import (
"context"
"errors"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.org/x/sync/errgroup"
"os"
"sync"
"sync/atomic"
"time"
)
// Loop struct
type Loop struct {
events chan *Event
listeners *eventListenerMap
running uint32
logger *zap.Logger
wg sync.WaitGroup
}
// E... |
package chunked
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"testing"
)
func TestIsZstdChunkedFrameMagic(t *testing.T) {
b := append(zstdChunkedFrameMagic[:], make([]byte, 200)...)
if !isZstdChunkedFrameMagic(b) {
t.Fatal("Chunked frame magic not found")
}
// change a byte
b[0] = -b[... |
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"strings"
"github.com/golang/glog"
"github.com/olekukonko/tablewriter"
kapiv1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth"
_ ... |
package deployment
import (
"encoding/json"
"fmt"
"io/ioutil"
"strings"
"github.com/pkg/errors"
"github.com/imdario/mergo"
"gopkg.in/yaml.v3"
)
var (
supportedFileExt = []string{"yaml", "yml", "json"}
)
type interceptorOps string
const (
interceptorOpsString = "String"
interceptorOpsIntercept = "Inte... |
// Copyright (c) 2020 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package webapi
import (
"net/http"
"github.com/decred/vspd/rpc"
"github.com/gin-gonic/gin"
"github.com/gorilla/sessions"
)
// WalletStatus describes the current status o... |
package state
import (
"encoding/gob"
"fmt"
"log"
"math"
"math/rand"
"os"
"os/signal"
"sort"
"strings"
"time"
)
func (g *Game) write(fn string) {
g.Lock()
defer g.Unlock()
new := fn + ".new"
old := fn + ".old"
f, err := os.OpenFile(fn+".new", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
... |
package admin
import (
"go-blog/models/admin"
"go-blog/utils"
"time"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/astaxie/beego/validation"
)
type ReviewController struct {
BaseController
}
type Item struct {
Id int
Name string
Review string
Reply string
Site strin... |
// Package ui takes a sysl module with attributes defined (uiFields)
// and serves a webserver listing the applications and endpoints
// It also uses GRPCUI and Redoc in order to generate an interactive page to interact with all the endpoints
// GRPC currently uses server reflection TODO: Support gpcui directly from sw... |
// +build !linux
package unix
import (
"fmt"
"runtime"
"syscall"
)
var errNonLinux = fmt.Errorf("unsupported platform %s/%s", runtime.GOOS, runtime.GOARCH)
const (
ENOENT = syscall.ENOENT
EAGAIN = syscall.EAGAIN
ENOSPC = syscall.ENOSPC
EINVAL ... |
/*******************************************************************************
* Copyright 1995-2018 Hitachi Vantara Corporation. All rights reserved.
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of ... |
package browser
import (
"context"
"encoding/json"
"encoding/xml"
"fmt"
"log"
"time"
"github.com/chromedp/cdproto/network"
"github.com/chromedp/chromedp"
"github.com/ianmarmour/nvidia-clerk/internal/config"
)
type InventoryStatus struct {
XMLName xml.Name `xml:"inventoryStatus"`
URI ... |
// Package telemetry implements a client for reporting telemetry data used to
// prioritize development of SpiceDB.
//
// For more information, see:
// https://github.com/authzed/spicedb/blob/main/TELEMETRY.md
package telemetry
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"n... |
package rboot
import (
"errors"
"fmt"
"os"
"path"
"sync"
"github.com/boltdb/bolt"
"github.com/sirupsen/logrus"
)
// Brain 是Rboot缓存器实现的接口
type Brain interface {
Set(bucket, key string, value []byte) error
Get(bucket, key string) ([]byte, error)
GetBucket() ([]string, error)
GetKeys(bucket string) ([]string... |
package gonion
import (
"net/http"
"strings"
)
//Composer is the main API in gonion and is responsible for
//composing the middleware and routes of your application
type Composer struct {
start string
routeRegistry *routeRegistry
middlewareRegistry *middlewareRegistry
}
//New is a factory meth... |
package mtbulk
import (
"context"
"fmt"
"reflect"
"strings"
"sync"
"github.com/migotom/mt-bulk/internal/entities"
"github.com/migotom/mt-bulk/internal/kvdb"
"github.com/migotom/mt-bulk/internal/mode"
"github.com/migotom/mt-bulk/internal/service"
"github.com/migotom/mt-bulk/internal/vulnerabilities"
"githu... |
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... |
package availability
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
bls2 "github.com/harmony-one/harmony/crypto/bls"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/numeric"
"github.com/harmony-one/harmony/shard"
"github.com/harmony-one/harmony/staking/effective"
... |
package auth_test
import (
"context"
"testing"
"time"
"github.com/dolthub/go-mysql-server/auth"
"github.com/dolthub/go-mysql-server/sql"
"github.com/sanity-io/litter"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/require"
)
type Authentication struct {
u... |
package openapi
import (
"encoding/json"
"github.com/pulumi/pulumi/pkg/v2/codegen"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
)
// versioner checks whether the given combination of a provider, a resource path, and a versions
// are known in version metadata returned by Azure (retrieved via the Azure CLI... |
package cmd
import (
"bytes"
"errors"
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"github.com/spf13/afero"
"github.com/cbush06/kosher/common"
"github.com/cbush06/kosher/resources/configfiles"
"github.com/spf13/cobra"
)
type initCommand struct {
name string
command *cobra.Command
initPlatf... |
// Code generated by go-swagger; DO NOT EDIT.
package public
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/g... |
package band
import (
"time"
"github.com/brocaar/lorawan"
)
type cn779Band struct {
band
}
func (b *cn779Band) GetDefaults() Defaults {
return Defaults{
RX2Frequency: 786000000,
RX2DataRate: 0,
MaxFCntGap: 16384,
ReceiveDelay1: time.Second,
ReceiveDelay2: time.Second * 2,
JoinAc... |
package cache
import (
"strconv"
"time"
"github.com/kataras/iris/cache/client"
"github.com/kataras/iris/context"
)
// CacheControlHeaderValue is the header value of the
// "Cache-Control": "private, no-cache, max-age=0, must-revalidate, no-store, proxy-revalidate, s-maxage=0".
//
// It can be overridden.
var Cac... |
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "Li... |
package server
import (
"log"
"net"
"net/http"
"os"
"strconv"
"strings"
"sync"
"github.com/gorilla/websocket"
"github.com/khlieng/dispatch/config"
"github.com/khlieng/dispatch/pkg/https"
"github.com/khlieng/dispatch/pkg/ident"
"github.com/khlieng/dispatch/pkg/session"
"github.com/khlieng/dispatch/storage... |
package vs
import (
"context"
"fmt"
"os"
"path"
"runtime"
"sort"
"testing"
"text/tabwriter"
"github.com/tetratelabs/wazero/internal/testing/require"
)
// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbi... |
package apcupsdexporter
import (
"regexp"
"strings"
"testing"
"time"
"github.com/inkdude/apcupsd"
)
func TestUPSCollector(t *testing.T) {
var tests = []struct {
desc string
ss *testStatusSource
matches []*regexp.Regexp
}{
{
desc: "empty",
ss: &testStatusSource{
s: &apcupsd.Status{},
... |
package initialize
import (
"gin-vue-admin/global"
"gin-vue-admin/model"
"go.uber.org/zap"
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
"gorm.io/driver/sqlserver"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"os"
)
var err error
// Gorm 初始化数据库并产生数据库全局变量
func Gorm() {
switch global.GVA_CONFIG.System.DbType {
c... |
package opentsdbhttp
import (
"fmt"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/logger"
"github.com/VictoriaMetrics/metrics"
"github.com/valyala/fastjson"
"github.com/valyala/fastjson/fastfloat"
)
// Rows contains parsed OpenTSDB rows.
type Rows st... |
/*
Copyright <NAME> Fintech Research Institute 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable la... |
//
// Modified BSD 3-Clause Clear License
//
// Copyright (c) 2019 Insolar Technologies GmbH
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted (subject to the limitations in the disclaimer below) provided that
// the following conditions a... |
package process
import (
"bytes"
"errors"
"os/exec"
"strconv"
)
type windowsProcessInfo struct {
Id int `json:"id" statusFileKey:"Pid"`
Handle int `json:"handle"`
Command string `json:"command" statusFileKey:"Name"`
UserName string `json:"userName" statusFileKey:... |
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed un... |
package mempool
import (
"errors"
"fmt"
"sync"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/events"
"github.com/spacemeshos/go-spacemesh/pendingtxs"
"github.com/spacemeshos/go-spacemesh/rand"
)
// TxMempool is a struct that holds txs received via gossip network.
type... |
// Copyright (c) 2022 <NAME>. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
/* Plugin provides all the required interfaces to implement a GoPlugin
*/
package pluginlib
import (
"encoding/json"
"fmt"
log "github.com/spf13/jwalterweatherman"
plugreg "github.com/swarvanusg/GoPlug"
common "github.com/swarvanusg/GoPlug/common"
PluginConn "github.com/swarvanusg/GoPlug/common/pluginconn"
"i... |
/*
Copyright 2015 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
package pkg
import (
"errors"
"fmt"
"math"
"strings"
)
type funcType int64
const (
noneFunc funcType = 0
sqrtFunc funcType = 1
logFunc funcType = 2
)
const (
defaultOperator byte = 0
skipOperator byte = 27
)
type functionItem struct {
name string
value funcType
}
var functons []functionItem = []fu... |
// Copyright 2019 Antrea Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package runner
import (
"context"
"fmt"
"io"
"net"
"os"
"sync"
"time"
docker "github.com/fsouza/go-dockerclient"
"github.com/pkg/errors"
"github.com/tedsuo/ifrit"
)
const ZooKeeperDefaultImage = "hyperledger/fabric-zookeep... |
package main
import (
//"fmt"
"errors"
"flag"
"fmt"
"html/template"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"regexp"
)
var (
addr = flag.Bool("addr", false, "find open address and print to final-port.txt")
)
type Page struct {
Title string
//Body []byte
Body template.HTML
}
func (p *Page) save() er... |
package main
import (
"fmt"
"os"
"regexp"
"strconv"
"strings"
)
// keyNames contains the names of the keys to check for in each resource in the
// state file. This allows us to support multiple types of resource without too
// much fuss.
var keyNames []string
var nameParser *regexp.Regexp
func init() {
keyName... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.