text stringlengths 11 4.05M |
|---|
// Copyright 2018 Aleksandr Demakin. All rights reserved.
package printer
import (
"fmt"
"io"
"sync"
"github.com/avdva/unravel/card"
)
type cardData struct {
WebsiteUrl string
SessionId string
ResizeFrom card.Dimension
ResizeTo card.Dimension
CopyAndPaste map[string... |
package model
import (
"time"
"github.com/caos/zitadel/internal/model"
)
type OrgMemberView struct {
UserID string
OrgID string
UserName string
Email string
FirstName string
LastName string
DisplayName string
Roles []string
CreationDate time.Time
ChangeDate time.T... |
package main
import (
"fmt"
"net/http"
"os"
"os/exec"
"strings"
)
func main() {
p := os.Getenv("PORT")
if len(p) == 0 {
p = "8080"
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
host := r.Host
fmt.Fprintf(w, "(%s) (%s)", host, path)
})
http.HandleFunc("/e... |
package main
type response struct {
message string
index int
transactions []transaction
proof int
previousHash string
}
|
package test
import (
"reflect"
"runtime/debug"
"testing"
"github.com/juntaki/transparent"
"github.com/juntaki/transparent/simple"
)
// SimpleStorageFunc is Error message test for simple Storage
func SimpleStorageFunc(t *testing.T, storage transparent.BackendStorage) {
var err error
err = storage.Add(0, []byt... |
package parser
import (
"testing"
"zhenai-crawler/crawler/fetcher"
)
func TestParseProfile(t *testing.T) {
bytes, e := fetcher.Fetch("http://album.zhenai.com/u/1813331607")
if e != nil {
panic(e)
}
ParseProfile(bytes)
}
|
package main
import (
"encoding/json"
"flag"
"fmt"
"html/template"
"io/ioutil"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
)
//DailyHoroscope is a configuration struct for api response of daily horoscope based on user sunsign
type DailyHoroscope struct {
Date string `json:"date"`
Horoscope st... |
package mal
import (
"sort"
)
type AnimeType int
const (
Tv AnimeType = iota + 1
Ova
Movie
Special
Ona
Music
)
func (t AnimeType) String() string {
types := [...]string{
Tv: "TV",
Ova: "OVA",
Movie: "Movie",
Special: "Special",
Ona: "ONA",
Music: "Music",
}
if t < 1 || int(t) ... |
// Copyright 2018 David Sansome
//
// 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 i... |
package worker
import (
"log"
"net/http"
"os"
"testing"
"github.com/ory/dockertest/v3"
)
var testUrlPrefix string
func TestMain(m *testing.M) {
// Why mock database driver or orm when You can just run real thing
// Awesome library! https://github.com/ory/dockertest
// modified version of example from His gi... |
package boot
// Param contains options for discovery queries. Options passed to DiscoverPeers
// first populate a Param struct. Fields are exported for the sake of 3rd-party
// discovery implementations.
type Param struct {
Limit int
// Custom provides a place for 3rd-party Strategies to set implementation-specif... |
// Copyright 2019 The gVisor 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 agree... |
// Copyright 2021 The CUE 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... |
package exregctl
import (
"context"
"errors"
"github.com/operator-framework/operator-lib/status"
regv1 "github.com/tmax-cloud/registry-operator/api/v1"
"github.com/tmax-cloud/registry-operator/internal/schemes"
"github.com/tmax-cloud/registry-operator/internal/utils"
corev1 "k8s.io/api/core/v1"
k8serr "k8s.io... |
package main
import "fmt"
func main() {
var n uint64
fmt.Scanln(&n)
s := make([]int64,n)
result := int64(0)
for i := 0; i < int(n); i++ {
fmt.Scanln(&s[i])
result += s[i]
}
fmt.Println(result)
} |
package controller
import (
"fmt"
"net/http"
)
type Index struct {
}
func NewIndex() *Index {
return &Index{}
}
func (i *Index) Handle(w http.ResponseWriter, r *http.Request) {
_, _ = fmt.Fprintf(w, "Hi there, %s!", r.URL.Path[1:])
}
|
package main // import "github.com/Jguer/yay"
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
pacmanconf "github.com/Morganamilo/go-pacmanconf"
alpm "github.com/jguer/go-alpm"
)
func setPaths() error {
if configHome = os.Getenv("XDG_CONFIG_HOME"); configHome != "" {
configHome = filepath.Join... |
package controllers
import (
"net/http"
"testing"
"github.com/gavv/httpexpect"
)
const (
URL_ROOT = "http://localhost:8889"
)
// APIGET -
func APIGET(t *testing.T, path string) *httpexpect.Object {
return httpexpect.New(t, URL_ROOT).
GET("/api"+path).
Expect().
Status(http.StatusOK).
JSON().
Object()... |
package downloader
import (
"errors"
"net/http"
log "github.com/Sirupsen/logrus"
"github.com/l-dandelion/cwgo/data"
"github.com/l-dandelion/cwgo/module"
)
//重试次数
var RetryTimes = 3
//只能通过new创建downloader
func New(client *http.Client) module.Downloader {
return &myDownloader{
ModuleInternal: module.NewModuleI... |
package cart
import (
"encoding/json"
"net/http"
"net/url"
"shopping-cart/pkg/controllers/common"
"shopping-cart/pkg/service"
"shopping-cart/types"
"shopping-cart/utils/applog"
"github.com/gorilla/mux"
"gopkg.in/mgo.v2/bson"
)
// AddItem : handler function for PATCH /v1/cart call
func AddItem(w http.Respons... |
package main
import "math/rand"
// Leetcode 528. (medium)
type Solution struct {
sum []int
}
func Constructor(w []int) Solution {
s := Solution{
sum: make([]int, len(w)),
}
tmp := 0
for i := range w {
tmp += w[i]
s.sum[i] = tmp
}
return s
}
func (this *Solution) PickIndex() int {
left, right := 0, len... |
package model
import (
"errors"
"lhc.go.game.center/libs/mysql"
"time"
)
type Menu struct {
Id int `json:"id" form:"id"`
Mark string `json:"mark" form:"mark"`
Type string `json:"type" form:"type"`
Name string `json:"name" form:"name"`
Url string `json:"url" form:"u... |
/*
Copyright 2019 The Skaffold 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, sof... |
package cards
import "errors"
type Suit uint8
const (
Hearts Suit = iota
Diamonds
Clubs
Spades
none_suit
)
type Rank uint8
const (
Ace Rank = iota
King
Queen
Jack
Ten
Nine
Eight
Seven
Six
Five
Four
Three
Two
none_rank
)
const Joker Rank = 255
type Color uint8
const (
Red Color = iota
Black
... |
package v2
import (
"errors"
"log"
"net/http"
"github.com/labstack/echo/v4"
"github.com/traPtitech/trap-collection-server/src/domain/values"
"github.com/traPtitech/trap-collection-server/src/handler/v2/openapi"
"github.com/traPtitech/trap-collection-server/src/service"
)
type Seat struct {
seatService servic... |
package solutions
func longestPalindrome(s string) int {
cache := make(map[byte]struct{})
for i := range s {
if _, ok := cache[s[i]]; ok {
delete(cache, s[i])
} else {
cache[s[i]] = struct{}{}
}
}
if len(cache) == 0 {
return len(s)
}
re... |
package handlers
import (
"net/http"
"github.com/gorilla/mux"
khttp "github.com/kiali/k-charted/http"
"k8s.io/apimachinery/pkg/api/errors"
"github.com/kiali/kiali/business"
"github.com/kiali/kiali/prometheus"
)
// AppList is the API handler to fetch all the apps to be displayed, related to a single namespace
... |
package main
import "purelight/kafka2/consumer"
func main() {
//consumer.Exec()
consumer.GroupExec()
} |
//+build !js
package html
type Event struct{}
type MouseEvent struct{}
|
package main
import (
"fmt"
"math"
"math/cmplx"
)
// ## TIPOS
// bool
// string
// int int8 int16 int32 int64
// uint uint8 uint16 uint32 uint64 uintptr
// byte // pseudônimo para uint8
// rune // pseudônimo para int32 representa um ponto de código Unicode
// float32 float64
// complex64 complex128
// D... |
package main
import (
"github.com/barchart/common-go/pkg/logger"
"github.com/barchart/common-go/pkg/parameters"
)
// go run main.go --STAGE=DEV
//
// go run main.go --STAGE=DEV --HOST="some host" --PORT=1234 --DATABASE=database_name --LOCAL=true
//
// STAGE=DEV go run main.go --HOST="some host" --PORT=1234 --DATABA... |
package go_wasm_exec
import (
"errors"
"io"
"os"
"github.com/pgavlin/warp/wasi"
)
type fsObject struct {
Object
fs wasi.FS
files map[int]wasi.File
}
func (fs *fsObject) read(fd int, b []byte, offset int64) (uint32, error) {
f, ok := fs.files[fd]
if !ok {
return 0, errors.New("bad file descriptor")
}... |
// Copyright 2016 Zhang Peihao <zhangpeihao@gmail.com>
package util
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBufferPool(t *testing.T) {
buff := GetBuffer()
buff.WriteString("do be do be do")
assert.Equal(t, "do be do be do", buff.String())
PutBuffer(buff)
assert.Equal(t, 0, buff.Len... |
package main
import (
"log"
"net/http"
"github.com/hzy/web/framework"
"github.com/hzy/web/framework/middleware"
)
func main() {
core := framework.NewCore()
core.Use(middleware.Recovery())
core.Use(middleware.Cost())
registerRouter(core)
server := &http.Server{
Addr: ":8080",
Handler: core,
}
if ... |
/*******************************************************************************
* Copyright 2017 Samsung Electronics 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... |
package main
import "fmt"
/*
6.29日给我通知, 说coding有较为严重的bug,不给通过。。。 fail了,准备了两个月的g就这样解释了。。。
*/
/*
2018.6.28 3:30pm-4:15pm
Please use this Google doc to code during your interview. To free your hands for coding, we recommend that you use a headset or a phone with speaker option.
https://docs.google.com/document/d/1LlYt... |
package profiles
import (
"errors"
"fmt"
"github.com/classmethod/aurl/utils"
ini "github.com/rakyll/goini"
)
var (
Name = "aurl"
Version = "dev"
)
type Profile struct {
Name string
ClientId string
ClientSecret string
AuthorizationEndpoint string
TokenEndpoint ... |
package password
import (
passwordResetModel "go_simpleweibo/app/models/password_reset"
userModel "go_simpleweibo/app/models/user"
"go_simpleweibo/app/requests"
)
// PassWordResetForm -
type PassWordResetForm struct {
Email string
Token string
Password string
PasswordC... |
package discovery
import (
"encoding/json"
"fmt"
"log"
"sync"
"time"
"github.com/coreos/etcd/client"
"golang.org/x/net/context"
)
type Master struct {
members map[string]*Member
KeysAPI client.KeysAPI
}
// Member is a client machine
type Member struct {
InGroup bool
IP string
Name string
}
func... |
package main
import (
"github.com/DuongVu089x/golang-heroku/action"
"github.com/DuongVu089x/golang-heroku/config"
"github.com/labstack/echo"
"gopkg.in/telegram-bot-api.v4"
"log"
"net/http"
"os"
)
var bot *tgbotapi.BotAPI
func main() {
port := os.Getenv("PORT")
config.Init()
userChanel := make(map[int64]*... |
package main
import "fmt"
import "math"
// const 用于声明一个常量
const s string = "constant"
func main() {
fmt.Println(s)
// const 语句可以出现在任何var 语句可以出现的地方
const n = 50000000
//常数表达式可以执行任意精度的运算
const d = 3e20 / n
fmt.Println(d)
//数值型常量是没有确定的类型的,直到它们被给定了一个类型,比如说一次显示的类型转化。
fmt.Println(int64(... |
package logfmt_test
import (
"errors"
"fmt"
"os"
"strings"
"time"
"github.com/go-logfmt/logfmt"
)
func ExampleEncoder() {
check := func(err error) {
if err != nil {
panic(err)
}
}
e := logfmt.NewEncoder(os.Stdout)
check(e.EncodeKeyval("id", 1))
check(e.EncodeKeyval("dur", time.Second+time.Millise... |
package apiControllers
import (
"github.com/gin-gonic/gin"
"github.com/PROJECTS/user_application_go/dbConfig"
"github.com/PROJECTS/user_application_go/libs"
"github.com/PROJECTS/user_application_go/models"
"log"
"net/http"
"time"
)
func LoginUser(c *gin.Context) {
var loginUser models.Users
var form = struc... |
package upgrade
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
gversion "github.com/mcuadros/go-version"
"github.com/sirupsen/logrus"
"github.com/harvester/harvester/pkg/settings"
)
const (
syncInterval = time.Hour
)
type CheckUpgradeRequest struct {
HarvesterVersion strin... |
package ante_test
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/app/ante"
"github.com/tharsis/ethermint/tests"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
)
fun... |
//go:generate go run generator.go
package box
import (
"sort"
)
type Box interface{
// Add a file content to box
Add(file string, content []byte)
// Get a file from box
Get(file string) []byte
// Has a file in box
Has(file string) bool
// List files in box
List() []string
}
type embedBox struct {
st... |
// 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, ... |
package cmd
import (
docker "github.com/mdelapenya/lpn/docker"
liferay "github.com/mdelapenya/lpn/liferay"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(rmCmd)
subcommands := []*cobra.Command{rmCECmd, rmCommerceCmd, rmDXPCmd, rmNightlyCmd, rmReleaseCmd}
for i :... |
package main
import (
"fmt"
"strings"
)
// var name string
// var age int
// 批量赋值变量
var (
name string
age int
)
const pi = 3.1415926 //常量赋值
// 批量赋值常量
const (
a1 = 100
a2 //无值时继承前一个变量
a3
)
// iota是go语言的常量计数器,只能在常量的表达式中使用。
const (
b1 = iota //iota = 0
b2 //b2 = iota = 1
_ //_ = b2 = iota =... |
package pool
import (
"fmt"
v1 "github.com/tmax-cloud/registry-operator/api/v1"
"github.com/tmax-cloud/registry-operator/pkg/structs"
"sync"
)
// JobPool stores current status of v1.RegistryJobs, who are in Pending status or Running status
// All operations for this pool should be done in thread-safe manner, usin... |
package main
import "net"
type User struct {
Name string
Addr string
C chan string
conn net.Conn
server *Server
}
func NewUser(conn net.Conn, server *Server) *User {
userAddr := conn.RemoteAddr().String()
user := &User{
Name: userAddr,
Addr: userAddr,
C: make(chan string),
conn: ... |
package csvingest
import (
"os"
"testing"
)
func Benchmark_IngestCsv_10Lines(b *testing.B) {
noopIngester := noopIngester{}
file, _ := os.Open("./test-ingestions/benchmarks/10-lines.csv")
for i := 0; i < b.N; i++ {
ingestCsv(file, noopIngester)
}
}
func Benchmark_IngestCsv_1kLines(b *testing.B) {
noopInges... |
package sort
import (
"sort"
"testing"
)
func TestQuickSort(t *testing.T) {
is := sort.IntSlice{1, 2, 3, 23, 34, 2345, 12, 23}
QuickSort(is)
t.Log(is)
}
|
package certs
import (
corev1 "k8s.io/api/core/v1"
)
const (
RootCACert = "ca.crt"
RootCAPriv = "ca.key"
)
func CAData(secret *corev1.Secret) ([]byte, []byte) {
if secret == nil {
return nil, nil
}
return secret.Data[RootCACert], secret.Data[RootCAPriv]
}
|
// SPDX-License-Identifier: MIT
package cmd
import (
"bytes"
"testing"
"github.com/issue9/assert/v3"
"github.com/caixw/apidoc/v7/internal/docs"
)
func TestCmdCheckSyntax(t *testing.T) {
a := assert.New(t, false)
buf := new(bytes.Buffer)
cmd := Init(buf)
erro, _, succ, _ := resetPrinters()
err := cmd.Exec... |
package chconn
import (
"strconv"
"strings"
"github.com/vahid-sohrabloo/chconn/v2/internal/readerwriter"
)
// Setting is a setting for the clickhouse query.
//
// The list of setting is here: https://clickhouse.com/docs/en/operations/settings/settings/
// Some of settings doesn't have effect. for example `http_zl... |
package sim
import (
"fmt"
"image/color"
"gonum.org/v1/gonum/mat"
"gonum.org/v1/plot"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/vg"
"gonum.org/v1/plot/vg/draw"
)
// New2DPlot creates new plot of the simulation from the three data sources:
// model: idealised model values
// measure: measurement values
... |
package timex_test
import (
"context"
"errors"
"time"
"github.com/socialpoint-labs/bsk/timex"
)
func ExampleParse() {
_, err := timex.Parse("")
if err != nil {
return
}
_, err = timex.Parse("2016-04-23 12:56")
if err != nil {
return
}
_, err = timex.Parse("-10 days")
if err != nil {
return
}
_... |
// +build ios macAppStore
package udwOcAppStore
func setAppStoreLoading(loadType string) {
if gContext == nil {
return
}
if gContext.loadingCallback != nil {
gContext.loadingCallback(loadType)
}
}
func setAppStoreAlert(alertType string) {
if gContext == nil {
return
}
if gContext.alertCallback != nil {
... |
package gonsen
import (
"bytes"
"github.com/mitchellh/packer/common/json"
"io/ioutil"
"net/http"
"strconv"
"time"
)
type Program struct {
MediaType string
ThumbnailUrl string
MediaUrl string
Title string
Slug string
Personality string
Guest string
Updated time.Time
In... |
package main
import (
"fmt"
//"log"
. "math"
//"math/rand"
"bytes"
"strings"
//"time"
"strconv"
//"errors"
)
import (
"github.com/lxn/walk"
)
// Constants for XPCalcOps.flag
const (
OPS_NONE = 1
OPS_OBJ = 2
OPS_ERR = 3
OPS_ACT = 4
)
// Constants for XPCalcOps.notation
co... |
// Copyright 2023 The gVisor 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 agree... |
/**
允许向函数传递指针, 只需要在函数定义的参数上设置指针类型即可.
下面实例厌食了如何向函数传递指针, 并在函数调用后修改函数内的值:
**/
package main
import "fmt"
func main() {
var a int = 100
var b int = 200
fmt.Printf("交换前a的值: %d\n", a)
fmt.Printf("交换前b的值: %d\n", b)
/* 调用函数用于交换值
* &a指向a变量的地址
* &b指向b变量的地址
*/
swap(&a, &b)
fmt.Printf("交换后a的值:%d\n", a)
fmt.Prin... |
package src
import (
"fmt"
"log"
"sync"
"time"
)
var counter = sync.Map{}
func addKeyspace(ks keyspace) {
counter.Store(ks.db, ks)
}
func examined(db int, size int) {
if value, ok := counter.Load(db); ok {
if ks, ok := value.(keyspace); ok {
ks.examined += size
counter.Store(db, ks)
}
}
}
func pri... |
package main
import "fmt"
func main() {
for i := 1; i <= 10; i++ {
fmt.Println(i * i)
}
}
// Напишите программу, которая выводит квадраты натуральных чисел от 1 до 10.
// Квадрат каждого числа должен выводится в новой строке.
|
package leetcode
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
// recursion
func isSymmetric(root *TreeNode) bool {
return isSameTree(root, root)
}
func isSameTree(p *TreeNode, q *TreeNode) bool {
if p == nil && q == nil {
... |
package Controllers
import (
"TaibaiSupport/Models"
"TaibaiSupport/TaibaiDBHelper"
"encoding/json"
"github.com/gorilla/websocket"
"sync"
)
type TaibaiClassroomManager struct {
OperationRWMux sync.RWMutex
WSConns map[int]map[int]*Models.TaibaiWSConn
}
func NewTaibaiClassroomManager() *TaibaiClassroomMan... |
package main
import (
"fmt"
"strconv"
)
var maps = map[string][]string{
"app": []string{"apptest1", "apptest2"},
}
func main() {
initApps(maps)
fmt.Println(len(maps["app"]))
}
func initApps(maps map[string][]string) {
apps := maps["app"]
for i := 0; i < 10; i++ {
apps = append(apps, "test"+strconv.Itoa(i))... |
// Copyright (c) 2016-2019 Uber Technologies, 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... |
package main
const HOGE = true
const Fuga = 2
const moge = "moge"
func export() {
const Pugya = "Pugya"
println(Pugya)
}
|
package main
import (
"fmt"
"os"
"os/exec"
"github.com/hashicorp/go-plugin"
"platform-plugin/shared"
"bytes"
"io"
"strings"
"platform-plugin/plugin-utils"
"io/ioutil"
"path/filepath"
"github.com/hashicorp/go-hclog"
"platform-plugin/output"
"encoding/json"
)
// ... |
/*
* Databricks
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 0.0.1
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package models
type ClustersAwsAttributes struct {
FirstOnDemand int32 `json:... |
package main
import (
"fmt"
"strconv"
)
func main() {
max, prod := 0, 0
for i := 100; i < 1000; i++ {
for j := i; j < 1000; j++ {
prod = i * j
if isPalindrome(prod) && prod > max {
max = prod
}
}
}
fmt.Println(max)
}
func isPalindrome(num int) bool {
string := strconv.Itoa(num)
i, j := 0, le... |
package main
import (
"bytes"
"encoding/pem"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"github.com/davidwalter0/fetchhostcerts"
)
var version = ""
func main() {
var format string
var template string
var skipVerify bool
var utc bool
var timeout int
var showVersion bool
flag.StringVar(&format, "f", "simple ... |
// Copyright 2020 The gVisor 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 agree... |
package main
import (
"fmt"
"github.com/xeb/backq/modules/private"
"gopkg.in/alecthomas/kingpin.v2"
)
var (
reqport = kingpin.Flag("request_port", "The 0MQ port for publishing requests to bqprivate, e.g. a value of 20000 means binding to 'tcp://*:20000'").Required().Int()
repport = kingpin.Flag("reply_port... |
package safemap
type SafeMap interface {
Each(EachFunc) int
Set(interface{}, interface{})
Del(interface{})
Get(interface{}) (interface{}, bool)
GetInterface(interface{}) interface{}
GetInt(interface{}) *int
GetInt64(interface{}) *int64
GetString(interface{}) *string
GetBool(interface{}) *bool
Len() int
Up... |
package main
import (
"context"
"fmt"
"os"
)
func main() {
ctx := context.Background()
client := NewGithubClient(ctx)
repositories, err := RepositoryListByReviewRequest(ctx, client)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
view := NewView(repositories)
view.Show()
}
|
package pagination
import (
"github.com/gin-gonic/gin"
"net/url"
)
type paginationRenderData struct {
URL string // 分页的 root url
CurrentPage int // 当前页码
OnFirstPage bool // 是否在第一页
HasMorePages bool // 是否有更多页
Elements []int // 页码
PreviousButtonText string // 前一页按钮文本
PreviousPageIndex ... |
package server
import (
"github.com/mercadolibre/time-zone-front/src/api/controller"
"github.com/mercadolibre/time-zone-front/src/api/service"
)
type Controllers struct {
TimeZoneController controller.TimeZoneController
}
func AppendControllers() *Controllers {
tzController := newTZController()
return &Controll... |
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package wifi
import (
"context"
"chromiumos/tast/common/wifi/security/wpa"
"chromiumos/tast/remote/wificell"
"chromiumos/tast/remote/wificell/hostapd"
"chromiumos/tast... |
package models
import (
"time"
// import mysql driver
_ "github.com/jinzhu/gorm/dialects/mysql"
)
// TournamentSignup struct
type TournamentSignup struct {
ID uint `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `sql:"... |
package FlatFS
type UUIDToQuery struct {
uuid string
querykeyValue QueryKeyValue
}
type QueryKeyValue struct {
keyValue map[string]string
}
type QueryType struct {
addSpec bool
querySpec bool
replaceSpec bool
deleteSpec bool
fileSpec bool
emptyType bool
}
|
// This file is part of CycloneDX GoMod
//
// 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... |
// Package libasciidoc is an open source Go library that converts Asciidoc
// content into HTML.
package libasciidoc
import (
"io"
"os"
"strings"
"time"
"github.com/bytesparadise/libasciidoc/pkg/configuration"
"github.com/bytesparadise/libasciidoc/pkg/parser"
"github.com/bytesparadise/libasciidoc/pkg/renderer"... |
/*
* Copyright (c) 2018-present unTill Pro, Ltd. and Contributors
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
package cli
import (
"fmt"
"io/ioutil"
"path/filepath"
"strings"
"github.com/spf13/cobra"
gc "github.com/unt... |
package models
import(
"encoding/json"
)
/**
* Type definition for ApplicationEnvironmentEnum enum
*/
type ApplicationEnvironmentEnum int
/**
* Value collection for ApplicationEnvironmentEnum enum
*/
const (
ApplicationEnvironment_KVMWARE ApplicationEnvironmentEnum = 1 + iota
Applicat... |
// Copyright ©2017 Dan Kortschak. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
// gen_nlo_const outputs candidate constants and a deBruijn look up table
// for implementing a fast bit fiddling number of leading ones funct... |
package scalars
import (
"io"
"strconv"
"time"
"github.com/99designs/gqlgen/graphql"
"github.com/neighborly/go-errors"
)
func MarshalDate(t time.Time) graphql.Marshaler {
return graphql.WriterFunc(func(w io.Writer) {
io.WriteString(w, strconv.Quote(t.Format("2006-01-02")))
})
}
func UnmarshalDate(v interfa... |
package main
import (
"net/http"
"github.com/gorilla/mux"
)
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
type Routes []Route
func NewRouter() *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
router.
... |
package api
import (
"bytes"
"crypto/tls"
"encoding/json"
"errors"
"github.com/bitmaelum/bitmaelum-server/core"
"github.com/bitmaelum/bitmaelum-server/core/encrypt"
"io/ioutil"
"net/http"
"time"
)
type Api struct {
account *core.AccountInfo
jwt string
client... |
package main
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/pjirsa/azure-costmanagement-samples/export"
"github.com/pjirsa/azure-costmanagement-samples/internal/config"
)
func main() {
err := config.ParseEnvironment()
if err != nil {
return
}
ctx, cancel := context.WithTimeout(context.Backgr... |
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package crash
import (
"context"
"path"
"path/filepath"
"strings"
"time"
"github.com/golang/protobuf/ptypes/empty"
"chromiumos/tast/ctxutil"
"chromiumos/tast/dut"
... |
// Copyright 2019 Istio 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 i... |
package queue
import "sync"
// Queue represents a ring buffer.
type Queue[T any] struct {
ringBuffer []T
read int
write int
capacity int
size int
mutex sync.Mutex
}
// New creates a new queue with the specified capacity.
func New[T any](capacity int) *Queue[T] {
return &Queue[T]{
rin... |
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
//
package kops
import (
"os"
"os/exec"
"path"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
const (
outputDirName = "output"
kubeConfigName = "kubeconfig"
)
// Cmd is the kops comma... |
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package scanner contains local Tast tests that exercise scanning
// functionality for ChromeOS.
package scanner
|
package main
// Stack is a FIFO stack of chatLines implemented as a ring buffer, so
// that it always keep the latest <size> messages.
type Stack struct {
items []chatLine
oldest int // oldest item in buffer
next int // next write mark
size int // current size of items
full bool // true when buffer is f... |
package accesscontrol
import (
"context"
"net/http"
"github.com/corioders/gokit/errors"
"github.com/corioders/gokit/web"
"github.com/corioders/gokit/web/middleware/accesscontrol/role"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
)
type loginOptions struct{}
type loginOption func(o *loginOptio... |
package models
type Currency struct {
ID int64
Name string
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.