text stringlengths 10 1.05M |
|---|
package admin
// Configure the server, would be interesting to use a reaction menu here owo |
package acme
import (
"bytes"
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rsa"
"fmt"
"net/http"
"sync"
"gopkg.in/square/go-jose.v1"
)
type jws struct {
directoryURL string
privKey crypto.PrivateKey
nonces []string
sync.Mutex
}
func keyAsJWK(key interface{}) *jose.JsonWebKey {
switch k... |
package kube
import (
"github.com/ovrclk/akash/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/client-go/kubernetes"
)
func cleanupStaleResources(kc kubernetes.Interface, lid types.LeaseID, group *types.ManifestGroup) error {
ns :... |
package column
import (
"errors"
"fmt"
"strconv"
"strings"
"github.com/yetialex/clickhouse-go/lib/binary"
)
// Table of powers of 10 for fast casting from floating types to decimal type
// representations.
var factors10 = []float64{
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13,
1e1... |
package middleware
import "github.com/gofiber/fiber/v2"
func MaxBody(size int) fiber.Handler {
return func(c *fiber.Ctx) error {
if len(c.Body()) >= size {
return fiber.ErrRequestEntityTooLarge
}
return c.Next()
}
} |
// Copyright (c) 2016-2017 Tigera, 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 ap... |
package main
import (
"flag"
"fmt"
"log"
"os"
"runtime"
"time"
)
// version of the code
var version string
// helper function to return version string of the server
func info() string {
goVersion := runtime.Version()
tstamp := time.Now().Format("2006-02-01")
return fmt.Sprintf("register git=%s go=%s date=%s... |
package grafana
import (
"testing"
"github.com/stretchr/testify/assert"
)
const body = `
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & ... |
package code_test
import (
"testing"
. "github.com/pingcap/check"
"github.com/pingcap/failpoint/code"
)
func TestNewRestorer(t *testing.T) {
TestingT(t)
}
var _ = Suite(&restorerSuite{})
type restorerSuite struct{}
func (s *restorerSuite) TestRestore(c *C) {
restorer := code.NewRestorer("not-exists-path")
e... |
package alwaysencrypted
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/x509"
"encoding/pem"
"fmt"
"github.com/swisscom/mssql-always-encrypted/pkg/algorithms"
"github.com/swisscom/mssql-always-encrypted/pkg/encryption"
"github.com/swisscom/mssql-always-encrypted/pkg/keys"
"github.com/stretchr/testi... |
// Copyright 2018 The Fuchsia 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 system_updater
import (
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
"syscall"
"syscall/zx"
"syscal... |
/*
Copyright 2017 Google 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, software
dis... |
package main
import (
"testing"
cv "github.com/glycerine/goconvey/convey"
)
// cfgenv.go related test
//
func TestStripNanoAddr(t *testing.T) {
cv.Convey("StripNanomsgAddressPrefix should omit the 'tcp://' stuff", t, func() {
strip, err := StripNanomsgAddressPrefix("tcp://a.b.c.d:9090")
cv.So(strip, cv.Shou... |
//go:build e2e
// +build e2e
/*
Copyright 2020 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... |
/*
Copyright 2018 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 writing, software
dist... |
package evm
import (
"context"
"fmt"
"math/big"
"net/url"
"sync"
"github.com/pkg/errors"
"go.uber.org/multierr"
"go.uber.org/zap/zapcore"
evmconfig "github.com/smartcontractkit/chainlink/core/chains/evm/config"
"github.com/smartcontractkit/chainlink/core/chains/evm/types"
"github.com/smartcontractkit/chai... |
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package common
import (
"bytes"
"io"
)
// PacketWriter writes a packet to the given writer.
type PacketWriter interface {
Write(io.Writer) error
}
// PacketToBytes will convert a packet to a byte slice.
func PacketToBytes(w PacketWriter) []byte {
b := bytes.NewBuffer(nil)
if err := w.Write(b); err != nil {
pa... |
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the L... |
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by entc, DO NOT EDIT.
package runtime
import (
"context"
"github.com/joegilley/ent/entc/integration/pr... |
//go:build go1.18
// +build go1.18
package scr
// Must panics if err is not nil. v is returned if err is nil.
// f := scr.Must(os.Create("example"))
// defer scr.Close(f)
// // write to f
func Must[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
} |
package main
type FunctionType uint32
const (
FunctionTypeMedian = FunctionType(iota)
FunctionTypeAverage = FunctionType(iota)
FunctionTypeSum = FunctionType(iota)
FunctionTypeCPU = FunctionType(iota)
FunctionTypeMemory = FunctionType(iota)
)
type CallableFunction func([]float32) (float32, error)
type... |
package main
import (
"log"
"math"
"math/rand"
"os"
"strconv"
"time"
"github.com/3lvia/gs2"
)
const outputFile = "testdata/testFile.gs2"
const maxVal = 1000
func main() {
file, err := os.Create(outputFile)
if err != nil {
log.Fatal(err)
}
rand.Seed(time.Now().Unix())
startMessage := getStartMessage(... |
package platform
import (
"errors"
"github.com/2beens/ispend/internal/models"
)
var ErrNotFound = errors.New("not found")
var EmptySignal = models.Signal{}
const (
IPAddress = "localhost"
DefaultPort = "8080"
) |
package goyave
import (
"bufio"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
"os"
"strconv"
"strings"
"testing"
"gorm.io/gorm"
"goyave.dev/goyave/v3/config"
"goyave.dev/goyave/v3/database"
)
type ResponseTestSuite struct {
TestSuite
}
func (suite *ResponseTestSuite) getFileSi... |
package models
// This file is auto-generated.
// Please contact avi-sdk@avinetworks.com for any change requests.
// HttpsecurityAction httpsecurity action
// swagger:model HTTPSecurityAction
type HttpsecurityAction struct {
// Type of the security action to perform. Enum options - HTTP_SECURITY_ACTION_CLOSE_CONN, ... |
package outputs
// Code generated by go generate; DO NOT EDIT.
// It's generated by "github.com/KablamoOSS/kombustion/generate"
import (
"github.com/KablamoOSS/kombustion/types"
)
// ParseEC2SubnetCidrBlock Documentation http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.... |
// Copyright (c) 2016, Google 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 appli... |
package device
import (
"crypto/rand"
"errors"
"fmt"
"sort"
"github.com/groob/plist"
"github.com/jessepeterson/cfgprofiles"
bolt "go.etcd.io/bbolt"
)
type ProfileStore struct {
ID string
DB *bolt.DB
}
func NewProfileStore(id string, db *bolt.DB) *ProfileStore {
return &ProfileStore{ID: id, DB: db}
}
fun... |
/*
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, ... |
// 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 may not... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.22.0
// protoc v3.5.1
// source: message.proto
package message
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/pr... |
package bot
import (
"fmt"
"regexp"
"strings"
"github.com/indes/flowerss-bot/internal/config"
"github.com/indes/flowerss-bot/internal/model"
"go.uber.org/zap"
tb "gopkg.in/tucnak/telebot.v2"
)
// FeedForChannelRegister register fetcher for channel
func FeedForChannelRegister(m *tb.Message, url string, channe... |
/*
* Copyright (c) 2017, https://github.com/nebulaim
* 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
*
* Un... |
/*
LaunchDarkly REST API
API version: 2.0
Contact: support@launchdarkly.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package ldapi
import (
"encoding/json"
"time"
)
// UserRecord struct for UserRecord
type UserRecord struct {
LastPing *time.Time `json:"lastPing,o... |
package requests
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"github.com/google/go-querystring/query"
"github.com/atomicjolt/canvasapi"
"github.com/atomicjolt/canvasapi/models"
)
// ListConferencesForCurrentUser Retrieve the paginated list of conferences for all courses and groups
// the curren... |
// Copyright 2021 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package repo
import (
"encoding/base64"
"fmt"
"net/http"
"net/url"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io... |
package types
import vpcapi "github.com/Netflix/titus-executor/vpc/api"
func AssignmentToAllocation(assignment *vpcapi.AssignIPResponseV3) Allocation {
alloc := Allocation{
Success: true,
BranchENIID: assignment.BranchNetworkInterface.NetworkInterfaceId,
BranchENIMAC: assignment.BranchNetworkInt... |
package logger
import (
"context"
c "eventers-marketplace-backend/context"
"fmt"
"os"
"regexp"
"github.com/sirupsen/logrus"
)
type Logger struct {
logrus.Logger
}
var logger *logrus.Logger
const CorrelationId = "correlation_id"
func init() {
logger = logrus.New()
logger.SetOutput(os.Stdout)
}
func Fatal... |
package utils
import (
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
"math/big"
"strconv"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/pkg/errors"
"github.com/ethereum/go-ethereum/common"
"github.com/tidwall/gjson"
)
const (
// FormatBytes encodes the output as bytes
FormatBytes = "bytes... |
package digest_auth_client
import (
"regexp"
"strings"
)
type wwwAuthenticate struct {
Algorithm string // unquoted
Domain string // quoted
Nonce string // quoted
Opaque string // quoted
Qop string // quoted
Realm string // quoted
Stale bool // unquoted
Charset string // quoted
... |
package compression
// TileColorFunction is one which shall color the pixel of a video frame tile using the provided values.
// mask is a packed field of 16 indices, each with a length of indexBitSize. These indices point into a
// value of lookupArray.
type TileColorFunction func(hTile int, vTile int, lookupArray []b... |
package gin
import (
"context"
)
func (ctx *Context) BaseContext() context.Context {
return ctx.Request.Context()
}
func (ctx *Context) Make(key string) (interface{}, error) {
return ctx.container.Make(key)
}
func (ctx *Context) MustMake(key string) interface{} {
return ctx.container.MustMake(key)
}
func (ctx ... |
package server
import (
"os"
"path/filepath"
"reflect"
"testing"
"encoding/json"
"github.com/pkg/errors"
"github.com/thales-e-security/contribstats/pkg/cache"
"github.com/thales-e-security/contribstats/pkg/collector"
"github.com/thales-e-security/contribstats/pkg/config"
"net/http"
"net/http/httptest"
"ti... |
/*
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advanced ways ... |
// *** 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 cs
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// This resource will help you ... |
package solution220
import "testing"
func TestContainsNearbyAlmostDuplicate(t *testing.T) {
tests := []struct {
name string
nums []int
k int
t int
want bool
}{
{"test 1", []int{1, 2, 3, 1}, 3, 0, true},
{"test 2", []int{1, 0, 1, 1}, 1, 2, true},
{"test 3", []int{1, 5, 9, 1, 5, 9}, 2, 3, false}... |
package database
import (
"errors"
"log"
)
// ConfirmAdmin confirms whether the warrior is infact a GENERAL (ADMIN)
func (d *Database) ConfirmAdmin(AdminID string) error {
var warriorRank string
e := d.db.QueryRow("SELECT coalesce(rank, '') FROM warriors WHERE id = $1;", AdminID).Scan(&warriorRank)
if e != nil {... |
// Copyright 2018 Google LLC 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 l... |
/*
Copyright (c) 2019 Bitnami
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
dis... |
// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors.
//
// SPDX-License-Identifier: Apache-2.0
package dataobjects
import (
"encoding/json"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
lsv1alpha1 "github.com/gardener/landscaper/apis/core/v1alpha1"
lsv1alpha1helper "gith... |
package aescrypto
import (
"encoding/base64"
"fmt"
"strconv"
"testing"
)
func Test_ecb(t *testing.T) {
/*
*src 要加密的字符串
*key 用来加密的密钥 密钥长度可以是128bit、192bit、256bit中的任意一个
*16位key对应128bit
*/
src := "200"
key := "d201e68d1fe59792c308ca0b79b03d29"
crypted, err := AesEcbPkcs5Encrypt([]byte(src), []byte(key))
if... |
package create
import (
"strings"
"github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/ankitpokhrel/jira-cli/api"
"github.com/ankitpokhrel/jira-cli/internal/cmdcommon"
"github.com/ankitpokhrel/jira-cli/internal/cmdutil"
"github.com/ankitpokhrel/jira-cli/internal/qu... |
package otpreporedis_test
import (
"context"
"github.com/alicebob/miniredis"
"github.com/applicaset/otp-repo-redis"
"github.com/applicaset/otp-svc"
"github.com/go-redis/redis/v8"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
"time"
)
func TestR... |
/*
Copyright 2019 The Vitess 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, soft... |
package file_reader
import (
"fmt"
"path/filepath"
"strings"
"github.com/werf/werf/pkg/giterminism_manager/errors"
)
type UntrackedFilesError FileReaderError
type UncommittedFilesError FileReaderError
type FileNotAcceptedError FileReaderError
type FileNotFoundInProjectDirectoryError FileReaderError
type FileNotF... |
// Copyright 2015 The Go 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 mathstats
import "math"
func lgamma(x float64) float64 {
y, _ := math.Lgamma(x)
return y
}
// mathBetaInc returns the value of the regularized inco... |
package main
import (
"fmt"
"html/template"
"log"
"os"
"github.com/tvn/goweb/utility"
)
var tmpl *template.Template
func init() {
tmpl = template.Must(template.ParseFiles("templates/base.html"))
}
func main() {
// Create a person
p001 := utility.Person{
Fname: "Mike",
Lname: "McNillin",
SNN: utilit... |
// Copyright The OpenTelemetry 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 agr... |
// Copyright (c) 2018, Maxime Soulé
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
package testdeep
import (
"bytes"
"reflect"
"github.com/maxatome/go-testdeep/internal/util"
)
type tdList struct {
Ba... |
package promql
import (
"fmt"
"strconv"
"strings"
"time"
"github.com/influxdata/flux"
"github.com/influxdata/flux/ast"
"github.com/influxdata/flux/functions/inputs"
"github.com/influxdata/flux/functions/transformations"
"github.com/influxdata/flux/semantic"
)
type ArgKind int
const (
IdentifierKind ArgKin... |
package models
import (
"fmt"
u "github.com/JaredTSanders/nultat_backend/utils"
"github.com/jinzhu/gorm"
)
type AvailServer struct {
gorm.Model
Name string `json:"name"`
ServerID string `json:"serverID"`
UserId uint
}
func (availServer *AvailServer) Validate() (map[string]interface{}, bool) {
if ava... |
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-2019 Datadog, Inc.
// +build cri
package containers
import (
yaml "gopkg.in/yaml.v2"
pb "k8... |
package smartag
//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
//distr... |
// Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License included
// in the file licenses/BSL.txt and at www.mariadb.com/bsl11.
//
// Change Date: 2022-10-01
//
// On the date above, in accordance with the Business Source License, use
// of this software will be gov... |
package personfaces
import (
"net/http"
"strconv"
"vrs_web_server/src/model"
"vrs_web_server/src/model/entity"
"github.com/labstack/echo"
)
//List 获取人脸列表
func List(c echo.Context) error {
personID, err := strconv.Atoi(c.QueryParam("person_id"))
if err != nil {
return err
}
db := model.GetDb()
defer db.Cl... |
package logging_test
import (
. "github.com/dogmatiq/dodeca/logging"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Logging Functions", func() {
var (
logger BufferedLogger
originalDefault Logger
)
BeforeEach(func() {
logger.CaptureDebug = true
logger.Reset()
})
W... |
package breaker
import (
"time"
xtime "github.com/1024casts/snake/pkg/time"
)
// Config broker config.
type Config struct {
SwitchOff bool // breaker switch,default off.
// Google
K float64
Window xtime.Duration
Bucket int
Request int64
}
func (conf *Config) fix() {
if conf.K == 0 {
conf.K = 1.5
}
... |
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: external/applications/applications.proto
/*
Package applications is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package applications
import (
"context"
"io"
"net/http"
"github.com/chef/automate/api/external/common/version"
... |
package main
import (
"fmt"
"ioutil"
"log"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
INFURA_PROJECT_ID := string(ioutil.ReadFile("../.infura-key"))
client, err := ethclient.Dial("https://rinkeby.infura.io/v3/" + INFURA_PROJECT_ID)
if err != nil ... |
// Copyright 2016-2018, Pulumi Corporation.
//
// 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... |
package main
import (
"errors"
"github.com/hashicorp/go-multierror"
"github.com/remeh/sizedwaitgroup"
"gopkg.in/ffmt.v1"
"gopkg.in/yaml.v2"
"io/ioutil"
"net/http"
"os"
"strings"
)
type Redirect struct {
Source string
Dest string
}
type MapConfig struct {
Url string
Path string
}
var errorsList *multier... |
package main
import "fmt"
func canDecode(bits []int) bool {
l := len(bits)
if l == 0 {
return true
} else if l == 1 {
return bits[0] == 0
} else {
if bits[l-1] == 1 {
if bits[l-2] == 1 {
return canDecode(bits[:l-2])
} else {
return false
}
} else {
return canDecode(bits[:l-1]) || // on... |
// 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 routers
import (
"blog-service/global"
"blog-service/internal/middleware"
v1 "blog-service/internal/routers/api/v1"
"github.com/gin-gonic/gin"
)
func NewRouter() *gin.Engine {
r := gin.New()
r.Use(gin.Logger())
r.Use(gin.Recovery())
r.Use(middleware.Translations())
//
tag := v1.NewTag()
article :=... |
// Package cmd implements access-cli commands
package cmd
/*
Copyright © 2020 Barracuda Networks, 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.... |
// Copyright (c) 2015 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
//+build !generate
package rpchelp
import "github.com/giangnamnabka/btcd/btcjson"
// Common return types.
var (
returnsBool = []interface{}{(*bool)(nil)}
returnsN... |
package pipeline
import "errors"
var (
errAcctNotInitialized = errors.New("accounting not yet initialized")
errSinkNotInit = errors.New("sink must be initialized before registering with pipeline")
errProbeConfig = errors.New("received nil probe configuration")
) |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Copyright ©2017 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE fil... |
/*
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, ... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package ec2instanceconnect
import (
"context"
"errors"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
internalendpoints "github.com/aws/aws-sdk-go-v2/service/ec2instanceconnect/internal/endpoints"
"github.... |
// Copyright 2018 Huan Du. All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
package sqlbuilder
import (
"database/sql"
"fmt"
)
func ExampleSelectBuilder() {
sb := NewSelectBuilder()
sb.Distinct().Select("id", "name", sb.As("COUNT(*)", "t"))
sb.From("demo.user")
sb.W... |
package aralog
import (
"io"
"os"
"runtime"
"sync"
"time"
"strings"
"path/filepath"
"fmt"
)
// These flags define which text to prefix to each log entry generated by the Logger.
const (
// Bits or'ed together to control what's printed. There is no control over the
// order they appear ... |
package context
import (
"os"
"strings"
)
// Context holds variables in present context
type Context struct {
variables []Variable
}
// Variable is struct definition for variable
type Variable struct {
name string
value interface{}
}
// GetName returns name of variable
func (v Variable) GetName() string {
re... |
package tablestream
import (
"sync"
)
type TableSimple struct {
Table
name string
fields []*Field
rowSeparator string
typeInstance map[string]chan map[string]string
lock sync.Mutex
}
func CreateTable(name string) *TableSimple {
t := &TableSimple{
name: name,
typeInstance: ma... |
// +build windows
/*
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
*/
package bulk
import "github.com/pkg/errors"
func queryMaxOpenFiles() (int, error) {
return 0, errors.New("cannot detect max open files on thi... |
package stackandqueue
import "strings"
func validateStackSequences(pushed []int, popped []int) bool {
if len(pushed) == 0 {
return true
}
j := 0
stack := make([]int, 0)
for i := 0; i < len(pushed); i++ {
stack = append(stack, pushed[i])
for j < len(popped) && len(stack) != 0 && stack[len(stack) - 1] == po... |
/*
Copyright 2016 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 main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
"sync"
"time"
"github.com/boltdb/bolt"
"github.com/golang/protobuf/proto"
"github.com/gorilla/handlers"
pb "github.com/micro/micro/v2/cmd/usage/proto"
)
var (
db *bolt.DB
fd = "usage.db"
mtx sync.RWMute... |
/*
* 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 may ... |
// Copyright The OpenTelemetry Authors
// Copyright Splunk 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 b... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/field_mask.proto
package field_mask // import "google.golang.org/genproto/protobuf/field_mask"
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherw... |
package api
import (
"net/http"
"github.com/bleenco/abstruse/internal/version"
"github.com/bleenco/abstruse/pkg/render"
"go.uber.org/zap"
)
type system struct {
logger *zap.SugaredLogger
}
func newSystem(logger *zap.Logger) system {
return system{
logger: logger.With(zap.String("api", "system")).Sugar(),
}... |
package fakes
import (
"github.com/frodenas/bosh-registry/client"
)
// FakeClient represents a Fake BOSH Registry Client.
type FakeClient struct {
DeleteCalled bool
DeleteErr error
FetchCalled bool
FetchErr error
FetchSettings registry.AgentSettings
UpdateCalled bool
UpdateErr error
Update... |
package meta
import (
"fmt"
"github.com/influxdata/influxql"
)
// QueryAuthorizer determines whether a user is authorized to execute a given query.
type QueryAuthorizer struct {
Client *Client
}
// NewQueryAuthorizer returns a new instance of QueryAuthorizer.
func NewQueryAuthorizer(c *Client) *QueryAuthorizer {... |
/*
Copyright (c) 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 License.
You may ... |
package healthcheck
import (
"context"
"errors"
"fmt"
"net/http"
"strings"
"time"
"github.com/linkerd/linkerd2/controller/api/public"
spclient "github.com/linkerd/linkerd2/controller/gen/client/clientset/versioned"
healthcheckPb "github.com/linkerd/linkerd2/controller/gen/common/healthcheck"
pb "github.com/... |
package junos
import (
"context"
"fmt"
"strings"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
bchk "github.com/jeremmfr/go-utils/basiccheck"
)
type asPathGroupOptions struct {
dynamicDB bool
name string
asPath []map[string]interface... |
package net
import (
"context"
"fmt"
"net"
"sync"
"sync/atomic"
"time"
dtls "github.com/pion/dtls/v2"
)
type connData struct {
conn net.Conn
err error
}
// DTLSListener is a DTLS listener that provides accept with context.
type DTLSListener struct {
listener net.Listener
heartBeat time.Duration
wg ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.