text
stringlengths
11
4.05M
package models import ( "gopkg.in/mgo.v2/bson" "time" ) type Users []User type User struct { Id bson.ObjectId `bson:"_id,omitempty" json:"_id"` Username string `bson:"Username" json:"Username"` Password string `bson:"Password" json:"Password"` Email string `bson:"Email" json:"Emai...
package main import ( "fmt" "github.com/skip2/go-qrcode" "image/color" "log" ) func main() { //文件输出 qrcode.WriteFile("http://www.baidu.org/", qrcode.Medium, 256, "./qrcode.png") //byte数组输出 byteArr, _ := qrcode.Encode("http://www.baidu.org/", qrcode.Medium, 256) fmt.Println(string(byteArr)) // 自定义输出 qr, err...
package ui import ( "image" "testing" "github.com/stretchr/testify/assert" ) var ( benchButton = NewButton(30, 8) ) // BenchmarkDrawButton-2 200000000 5.58 ns/op (mbp-2010) func BenchmarkDrawButton(b *testing.B) { for n := 0; n < b.N; n++ { benchButton.Draw(0, 0) } } func TestButtonOnly(t *t...
// Copyright 2015 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 datasource import ( "sync" "time" ) type DistributedCache struct { mutex sync.Mutex data map[string]any } func NewDistributedCache() *DistributedCache { return &DistributedCache{ data: map[string]any{}, } } func (dc *DistributedCache) Value(key string) (any, error) { // simulate 100ms roundtrip to...
package create import ( "encoding/json" "fmt" "net/http" "github.com/ocoscope/face/db" "github.com/ocoscope/face/utils" "github.com/ocoscope/face/utils/answer" ) func EmployeeInDepartment(w http.ResponseWriter, r *http.Request) { type tbody struct { CompanyID, UserID, EmployeeID, DepartmentID int64 Acces...
package types import ( "testing" ) // TestFileContractTax probes the Tax function. func TestTax(t *testing.T) { fc := FileContract{ Payout: NewCurrency64(435000), } if fc.Tax().Cmp(NewCurrency64(10000)) != 0 { t.Error("Tax producing unexpected result") } fc.Payout = NewCurrency64(150000) if fc.Tax().Cmp(Ne...
package mq_manager import ( "fmt" "github.com/dollarkillerx/galaxy/internal/mq_manager/es" "github.com/dollarkillerx/galaxy/internal/mq_manager/kafka" "github.com/dollarkillerx/galaxy/internal/mq_manager/mongodb" "github.com/dollarkillerx/galaxy/internal/mq_manager/nsq" "github.com/dollarkillerx/galaxy/pkg" "g...
package main import ( "time" "github.com/yam8511/zrpc" ) // Arith 數學運算 type Arith int // Args 參數 type Args struct { A, B int } // Sum 總和 func (t *Arith) Sum(args *Args, sum *int) error { if args.A == 0 && args.B == 0 { return zrpc.NewZrpcError("422", "缺少參數", map[string]int{ "A": args.A, "B": args.B, ...
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. // package main import ( "encoding/json" "fmt" "os" "strings" "github.com/mattermost/mattermost-cloud/clusterdictionary" "github.com/mattermost/mattermost-cloud/model" "github.com/pkg/errors" "gith...
package main import ( "flag" "fmt" "io" "io/ioutil" "log" "os" "os/user" "path" "text/tabwriter" "time" "github.com/mrfuxi/go-codebase/codebase" "gopkg.in/yaml.v2" "github.com/mrfuxi/codebase-standup/descriptor" ) type Conf struct { Auth struct { Usern...
package container import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1" ) var ( sel = MustParseSelector("gcr.io/foo/bar") ) func TestNewRefSetWithInvalidRegistryErrors(t *testing.T) { reg := &v1alpha1.RegistryHosting{Ho...
package ProcessURL import ( "testing" "12306/config" ) func TestGetCDNList(t *testing.T) { Init(config.FormatJson) }
package main import ( "os" "github.com/go-ap/fedbox/internal/cmd" ) var version = "HEAD" func main() { if err := cmd.NewApp(version).Run(os.Args); err != nil { cmd.Errf(err.Error()) os.Exit(1) } }
package mocking import ( "errors" "github.com/ednailson/languages-experiments/golang/mocking/gomock_mocks" gomocklib "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "testing" "time" ) func TestMethodAGoMock(t *testing.T) { // Initiating a new mock ctrl := gomocklib.NewController(t) mock ...
// Copyright 2011 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 strogonoff import ( "bytes" "image" "image/png" "io/ioutil" "rand" "os" "testing" ) var testCase = []struct { filename string quality int...
// standard file server to serve up HTML/JS // includes blob emitter to test XHR request speed package main import ( "fmt" "net/http" "os" "runtime" ) func main() { runtime.GOMAXPROCS(runtime.NumCPU()) cwd, err := os.Getwd() if err != nil { panic(err) } http.HandleFunc("/blob.js", emitBlob) http.Handle...
package main import ( "fmt" ) // 包级别 var packageVar string = "package Var" var ( flag = "global" status = true ) func main() { // 函数级别 var a int var b string = "hello" c := true var d *int d = &a name, age := "wovert", 20 fmt.Println("a=", a) fmt.Println("b=", b) fmt.Println("c=", c) fmt.Println("d="...
package state // PostgresServerStats - Statistics for a Postgres server. type PostgresServerStats struct { CurrentXactId Xid8 NextMultiXactId Xid8 XminHorizonBackend Xid XminHorizonReplicationSlot Xid XminHorizonReplicationSlotCatalog Xid XminHorizonPreparedXact Xid XminHorizo...
package utils import ( "net/url" "regexp" "strings" ) // hand write regex, not tested well. var regexpValidEmail = regexp.MustCompile(`^[+-_.a-zA-Z0-9]+@[[:alnum:]]+(\.[[:alnum:]]+)+$`) func IsEmail(email string) bool { return regexpValidEmail.MatchString(email) } func IsURL(Url string, addScheme bool) bool { ...
package routes import ( "fmt" "github.com/kataras/iris/v12" ) func registerGroupRoute(app *iris.Application) { users1 := app.Party("/users1", myAuthMiddlewareHandler1) // /users1/profile users1.Get("/profile", userProfileHandler) // /users1/messages users1.Get("/messages", userMessageHandler) app.PartyFunc...
// +build js package template import ( "testing" ) func TestParseGlob(t *testing.T) { t.Skip() } func TestParseGlobWithData(t *testing.T) { t.Skip() }
package main import "fmt" func main() { numbers := make([]int, 3, 5) fmt.Printf("numbers= %v\n", numbers) fmt.Printf("length= %d\n", len(numbers)) fmt.Printf("capacity= %d\n", cap(numbers)) //This line will cause a runtime error index out of range [4] with length 3 //numbers[4] = 5 //Increasing the length fr...
package main import ( "crypto/md5" "encoding/hex" "errors" "fmt" "log" "os" "os/exec" "strconv" "strings" ) func main() { // Get hostid cmd, err := exec.Command("hostid").Output() hostid := "" if err != nil { fmt.Println("Warning: Unable to get hostid: " + err.Error()) fmt.Println("Warning: Assuming ...
package wyre import ( "strconv" "time" ) func normalizePath(path string) string { if path[0] == '/' { return path } return "/" + path } func getTimestampString() string { now := time.Now().UnixNano() / 10000 return strconv.FormatInt(now, 10) }
// Copyright 2016 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...
package murmurhash3 import ( "hash" ) type Hash128 interface { hash.Hash Sum128() []byte } func fmix64(k uint64) uint64 { k ^= k >> 33 k *= 0xff51afd7ed558ccd k ^= k >> 33 k *= 0xc4ceb9fe1a85ec53 k ^= k >> 33 return k } func fmix32(h uint32) uint32 { h ^= h >> 16 h *= 0x85ebca6b h ^= h >> 13 h *= 0xc2b...
package main import ( "flag" "log" "net" "os" "strconv" "strings" "time" "github.com/brewlin/net-protocol/protocol/link/loopback" "github.com/brewlin/net-protocol/pkg/waiter" "github.com/brewlin/net-protocol/protocol/network/arp" "github.com/brewlin/net-protocol/protocol/network/ipv4" "github.com/brewli...
// GENERATED CODE, DO NOT EDIT package arrowtools import ( "github.com/apache/arrow/go/arrow/array" ) // GetUint8SliceFromRecord returns a slice corresponding to the given // column position in the given record. func (rh *RecordHelper) Uint8Slice() []uint8 { return array.NewUint8Data(rh.rec.Column(rh.curpos).Data(...
package repository import ( "github.com/porter-dev/porter/internal/models" ) // InviteRepository represents the set of queries on the Invite model type InviteRepository interface { CreateInvite(invite *models.Invite) (*models.Invite, error) ReadInvite(id uint) (*models.Invite, error) ReadInviteByToken(token strin...
package e2e // This file exists to allow `go fmt` to traverse here on its own. The build tags were keeping it out before
package peercube import ( "fmt" "sync" ) type MessageEventHandler interface { Wait() Trigger(m Message) error fire() setCleanUp(func()) cleanUp() kill() } type InvalidMessageTypeError struct { t MsgType } func NewInvalidMessageTypeError(t MsgType) InvalidMessageTypeError { return InvalidMessageTypeError{t...
package util import ( "fmt" "runtime" ) // VersionString returns a version string that should be printed with the -v // or the --version flag. It gets the components from the following keys from // the options: // program-name // program-version // program-timestamp func VersionString(opts Options) string { progNa...
package rabbit import ( message "github.com/I-Reven/Hexagonal/src/domain/message/rabbit" "github.com/I-Reven/Hexagonal/src/framework/logger" "github.com/juju/errors" "github.com/streadway/amqp" ) type Consume struct { log logger.Log rabbit Rabbit } func (c *Consume) Message(message message.Message) (<-chan ...
package product import "github.com/rudiarta/refactory_test/model" type ProductService interface { Create(entity model.Product) error Fetch() (error, []model.Product) FetchByID(id int) (error, *model.Product) }
// Copyright 2014 The Cockroach 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 ag...
package test import ( log "github.com/sirupsen/logrus" "io/ioutil" "net/http" "strings" ) type errConfigForFile struct { status int fileName string } type FileBasedURLHandler struct { exactURLs map[string]string exactErrorURLs map[string]errConfigForFile startsWithURLs map[string]string } func NewFi...
// Copyright (c) 2020 - for information on the respective copyright owner // see the NOTICE file and/or the repository at // https://github.com/hyperledger-labs/perun-node // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may...
// test project main.go package main // "strings" pour les fonctions sur les chaînes de charactères. import ( "log" "net/http" "strconv" restful "github.com/emicklei/go-restful" _ "github.com/jinzhu/gorm/dialects/postgres" "github.com/tipounet/go-bank/configuration" "github.com/tipounet/go-bank/controllers" "...
package store import ( "time" ) type UserModel struct { ID int Name string CreatedAt time.Time `db:"created_at"` } func (db *DB) NewUser() UserModel { return UserModel{} } func (db *DB) GetUsers() ([]UserModel, error) { users := []UserModel{} err := db.conn.Select(&users, "SELECT * FROM users") ...
package tests import ( "bytes" "github.com/jpnauta/remote-structure-test/pkg/color" "io" "testing" ) func compareText(t *testing.T, expected, actual string, expectedN int, actualN int, err error) { t.Helper() if err != nil { t.Errorf("did not expect error when formatting text but got %s", err) } if actualN ...
package proxy import ( "fmt" "log" "os" "github.com/elazarl/goproxy" "github.com/oov/socks5" "github.com/mimoto-xxxxxx/dockerns/accounts" ) // SOCKS は SOCKS5 プロトコルによるプロキシサーバ。 // AccountName を指定した場合は認証は行わずに接続できる。 type SOCKS struct { AccountName string Password string Logger *log.Logger accounts ...
package entity // Component ... type Component struct { Id string `json:"id,omitempty"` // ID компонента (Только для чтения) AccountId string `json:"accountId,omitempty"` // ID учетной записи (Только для чтения) Quantity float64 `json:"quantity,omit...
package app import ( "gopkg.in/urfave/cli.v1" ) const repoURL = "HELMSMAN_REPO_URL" //HemlCmdOptions ... type HemlCmdOptions struct { Port int RepoDir string RepoUrl string Debug bool Envs []string } //NewHemlCmdOptionsCmdOptions ... func NewHemlCmdOptionsCmdOptions() *HemlCmdOptions { return &HemlCm...
package main import ( "github.com/scalalang2/load-balancing-simulator/balancer" ) func main() { context := balancer.ExpContext{ FromBlock: 6000000, CollationCycle: 100, BlockEpoch: 20, NumberOfShards: 20, GasLimit: 12000000, GasCrossShardTx: 42000, } saccBalancer := balancer.SACC { Context: context }...
package gotenv_test import ( "bufio" "errors" "io" "os" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/subosito/gotenv" ) var formats = []struct { in string out gotenv.Env preset bool }{ // parses unquoted values {`FOO=bar`, gotenv.Env{"FOO": "bar"}, false}, // parses valu...
package main import ( "github.com/hyperledger/fabric/core/chaincode/shim" pb "github.com/hyperledger/fabric/protos/peer" "github.com/op/go-logging" ) var log *logging.Logger var format logging.Formatter // // AssetTransferChaincode is a type of the chaincode // type AssetTransferChaincode struct { } func init() ...
/* Copyright 2018 The KubeSphere 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 ( "fmt" "net" "os" "bytes" "time" ) type RedisClient interface { Connect() error Get(key string) (ret string, err error) } type SimpleRedisClient struct { Conn net.Conn Addr string } func (client *SimpleRedisClient) Connect() (err error) ...
package model type Directory struct { Agent string `json:"agent" xml:"agent,attr"` AllowSync bool `json:"allowSync" xml:"allowSync,attr"` Art string `json:"art" xml:"art,attr"` Composite string `json:"composite" xml:"composite,attr"` CreatedAt int `json:"createdAt" xml...
package utils import "time" func TimeNow() string { return time.Now().Format("2006-01-02 15:04:05") }
package auth import ( "context" "crypto/rsa" "math/big" "net/http" "net/http/httptest" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" ) func TestResuseKeySource(t *testing.T) { testTime := time.Date(2018, 10, 29, 12, 0, 0, 0, time.UTC) timeNow = func() time.Time { ...
package sat import ( "context" "crypto" "encoding/json" "fmt" "sync" "github.com/hashicorp/hcl" "github.com/spiffe/spire/pkg/common/catalog" "github.com/spiffe/spire/pkg/common/plugin/k8s" "github.com/spiffe/spire/proto/spire/common" spi "github.com/spiffe/spire/proto/spire/common/plugin" "github.com/spiff...
// Copyright 2021 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package arc import ( "bufio" "context" "strconv" "strings" "time" "chromiumos/tast/common/testexec" "chromiumos/tast/local/arc" "chromiumos/tast/testing" ) func in...
package git import "io" type Blob struct { *TreeEntry } func (b *Blob) Data() (io.ReadCloser, error) { _, _, dataRc, err := b.ptree.repo.getRawObject(b.Id, false) if err != nil { return nil, err } return dataRc, nil } /* func (b *Blob) Save(w io.Writer, compress bool) (string, error) { var data []byte buf ...
/* * traPCollection API * * traPCollectionのAPI * * API version: 1.0.0 * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package openapi import ( "errors" "fmt" "net/http" echo "github.com/labstack/echo/v4" ) type VersionApi interface { GetCheckList(c echo.Context, operatingSystem str...
package internal import ( "fmt" "time" "github.com/caddyserver/caddy" "github.com/ajruckman/ContraCore/internal/cache" "github.com/ajruckman/ContraCore/internal/db/contradb" "github.com/ajruckman/ContraCore/internal/db/contralog" "github.com/ajruckman/ContraCore/internal/log" "github.com/ajruckman/ContraCore...
package data import ( "errors" "gorm.io/gorm" ) type Review struct { CoreModel Text string `json:"text" gorm:"not null"` UserID int64 `json:"-" gorm:"not null"` User *User `json:"user,omitempty"` ProductID int64 `json:"-" gorm:"not null"` } type ReviewModel struct { DB *gorm.DB } func (m Re...
package main import ( "fmt" "time" ) func funcA() { for i := 0; i < 10; i++ { fmt.Print("A") time.Sleep(10 * time.Millisecond) } } func main() { go funcA() for i := 0; i < 10; i++ { fmt.Print("M") time.Sleep(20 * time.Millisecond) } }
package model import ( "github.com/caos/zitadel/internal/crypto" es_models "github.com/caos/zitadel/internal/eventstore/models" ) type OTP struct { es_models.ObjectRoot Secret *crypto.CryptoValue SecretString string Url string State MfaState } type MfaState int32 const ( MfaStateUnspe...
package types import ( "bytes" "fmt" "text/scanner" "subc/ast" "subc/constant" "subc/scan" ) // operandMode is the type of operand it is. type operandMode byte // The types of operands. const ( invalid operandMode = iota novalue typexpr constant_ variable value ) var operandModeString = [...]string{ i...
package structs // Map represents the map being played in a Match type Map struct { Id int64 `json:"id"` Name string `json:"name,omitempty"` Official bool `json:"official"` Game Game `json:"game,omitempty"` }
package util import ( "bytes" "encoding/binary" "encoding/hex" "fmt" "html" "html/template" "math/big" "reflect" "strconv" "strings" ) func Inter2Int64(id interface{}) (data int64) { of := reflect.TypeOf(id) if of.String() == "int64" { data = id.(int64) return } else if of.String() == "string" { da...
package concurrency type WebsiteChecker func(string) bool type result struct { string bool } func CheckWebsites(wc WebsiteChecker, urls []string) map[string]bool { results := make(map[string]bool) resultChannel := make(chan result) for _, url := range urls { go func(u string) { ...
package pubstack import ( "net/http" "net/http/httptest" "sync" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestNewConfigUpdateHttpTask(t *testing.T) { // configure test config endpoint var isFirstQuery bool = true var isFirstQueryMutex sync.Mutex mux...
// 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 filesnapshot provides functions that store/restore the snapshot (i.e. the content) of important files during integration test. package filesnapshot import ( "io/...
//Copyright 2019 Chris Wojno // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribut...
package capability import ( "context" "fmt" kubedbv1 "github.com/kubedb/apimachinery/apis/kubedb/v1alpha1" "github.com/snowdrop/component-operator/pkg/apis/component/v1alpha2" ) func (r *ReconcileCapability) setErrorStatus(instance *v1alpha2.Capability, err error) { instance.Status.Phase = v1alpha2.CapabilityFai...
package main import ( "fmt" ) var print = fmt.Println; func main() { print(sameNecklace("nicole", "icolen")) print(sameNecklace("nicole", "lenico")) print(sameNecklace("nicole", "coneli")) print(sameNecklace("aabaaaaabaab", "aabaabaabaaa")) print(sameNecklace("abc", "cba")) print(sameNecklace("xxyyy", "xxx...
package testutil import ( "os" "testing" "github.com/joshuacrass/online-upgrade/util" "github.com/stretchr/testify/require" ) var ( memsqlVersion1 = os.Getenv("MEMSQL_VERSION_5_5_12") memsqlVersion2 = os.Getenv("MEMSQL_VERSION_5_7_2") ) func init() { if memsqlVersion1 == "" || memsqlVersion2 == "" { panic(...
package sink type Sink interface { Send(payload *Payload) error }
package com import ( "JsGo/JsHttp" "JsGo/JsLogger" "JsGo/JsStore/JsRedis" "JunSie/constant" "JunSie/util" "fmt" ) //消息推送 //推送草稿暂时存放。 //消息放一个切片数组中(放最近的三到五条)需要一个页面展示的 //历史消息(放需要保存的历史消息)其他的都放在历史 //添加推送消息 //用户推送的消息 type Message struct { MessTitle string //推送内容标题(不能为空) WordPicture []WordPic //图片文字 MessP...
// Copyright 2021 Dataptive SAS. // // 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 entrypoint import ( "fmt" "log" "os" "strings" "github.com/cyberark/secretless-broker/internal" "github.com/cyberark/secretless-broker/internal/configurationmanagers/configfile" "github.com/cyberark/secretless-broker/internal/configurationmanagers/kubernetes/crd" secretlessLog "github.com/cyberark/sec...
package server import ( "container/ring" ) type scher interface { sche() Server add(Server) del(Server) } type nilScher struct { ss map[Server]struct{} } func newNilScher() *nilScher { return &nilScher{ss: make(map[Server]struct{})} } func (ns *nilScher) sche() Server { for s := range ns.ss { return s } ...
package api import ( "Backend/cisco" "Backend/resources" "Backend/server" "fmt" "net/http" ) func CreateConnection(r *server.APIRequest) error { var c resources.ConnectionCredentials err := r.Decode(&c) if err != nil { http.Error(r.Request.W, "There was an error with the body", http.StatusNotAcceptable) }...
package person import ( "encoding/json" "fmt" "net/http/httptest" "strings" "testing" "github.com/jinzhu/copier" "github.com/lalvarezguillen/roomies/helpers" "github.com/labstack/echo" "github.com/stretchr/testify/assert" ) var testPerson = Person{ ID: "test-person", FirstName: "Test", LastName: ...
package protocol import ( "encoding/binary" "bytes" "bufio" ) // Encode : func Encode(msg string) ([]byte, error) { length := int32(len(msg)) // var pkg *bytes.Buffer = new(bytes.Buffer) pkg := new(bytes.Buffer) err := binary.Write(pkg, binary.LittleEndian, length) if err != nil { return nil, err } err ...
package util import ( "github.com/codegangsta/cli" ) func Die(c *cli.Context, msg string) { cli.ShowSubcommandHelp(c) Fatal(msg) }
package log const ( // ColorOff is a color coding literal ColorOff = "\x1b[0m" // ColorBlack is a color coding literal ColorBlack = "\x1b[30m" // ColorRed is a color coding literal ColorRed = "\x1b[31m" // ColorGreen is a color coding literal ColorGreen = "\x1b[32m" // ColorYellow is a color coding literal C...
// Copyright 2018 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 scheduler import "test-spider/engine" type QueueScheduler struct { //请求任务通道 requestChan chan engine.Request_q //处理通道 二维 workerChan chan chan engine.Request_q } //处理方法 func (s *QueueScheduler) WorkChan() chan engine.Request_q { return make(chan engine.Request_q) } //提交任务至请求任务通道 func (s *QueueS...
// +build linux,!appengine /* * * Copyright 2019 gRPC 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 require...
package twitchbot import ( "errors" "fmt" "gitlab.com/prestrafe/prestrafe-bot/globalapi" "gitlab.com/prestrafe/prestrafe-bot/gsiclient" ) func NewWRCommand(gsiClient gsiclient.Client, apiClient globalapi.Client) ChatCommandBuilder { return NewChatCommandBuilder("wr"). WithAlias("gr", "gwr", "top"). WithPara...
package expressions type Expression interface { Interpreter(vars map[string]int) int } //////////////////////////////////////////////////////////// type VarExpression struct { Key string } func NewVarExpression(key string) *VarExpression { return &VarExpression{Key: key} } func (v VarExpression) Interpreter(var...
package models import ( "ktmall/common/cache" "ktmall/common/utils" "strconv" "github.com/pkg/errors" "github.com/jinzhu/gorm" ) const ( UserInfoTableName = "user_info" UserModelCacheKey = "user_info_" ) // 用户表 type UserInfo struct { BaseModel Name string `sql:"comment:'用户名(登录名)'"` Pwd s...
// Copyright 2022 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package usbutils import ( "bufio" "context" "regexp" "strings" "chromiumos/tast/common/testexec" "chromiumos/tast/dut" "chromiumos/tast/errors" ) // USBDevice repre...
// Copyright 2020 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, ...
// Copyright (c) 2018 The MATRIX Authors // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php package params const PowBlockPeriod = 3 func IsPowBlock(number uint64, broadcastInterval uint64) bool { remainder := number % broadcastIn...
package validators type CartDTO struct { ID int } type CartRO struct { ID int `json:"id"` Items []CartItemRO `json:"items"` }
package main import "golang.org/x/net/html" func ElementsByTagName(doc *html.Node, name ...string) []*html.Node { var res []*html.Node if doc.Type == html.ElementNode { for _, tag := range name { if doc.Data == tag { res = append(res, doc) } } } if doc.FirstChild != nil { res = append(res, Element...
package backend import ( "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" "github.com/aws/aws-sdk-go/service/s3" "resources/types" ) // QueryS3 finds all S3 buckets func QueryS3(region string, dynamodbClient dynamodbiface.Dy...
// Copyright (C) 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 t...
package model import ( "encoding/json" "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/eventstore/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.co...
package http import ( "fmt" "math" "strconv" "strings" "time" ) type Method string type StatusCode int type Version string type MediaType string type Header string type ConnectionHeader string type TransferEncodingHeader string type ExpectHeader string const ( MethodGet Method = "GET" MethodHead Method...
// Publish Volume Events to Redis package events import ( "encoding/json" "strconv" "gopkg.in/redis.v3" ) // Play POST request expected JSON payload type publishVolumePayload struct { Event string `json:"event"` Level int `json:"volume"` } // Publish a Play Event from the Player to Redis. This sets the cur...
// Copyright (c) 2020 - for information on the respective copyright owner // see the NOTICE file and/or the repository at // https://github.com/hyperledger-labs/perun-node // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may...
/* Copyright 2020 DigitalOcean Copyright 2020 Flant 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...
/* @Time : 2019/8/30 18:17 @Author : zxr @File : index @Software: GoLand */ package Parser import ( "github.com/PuerkitoBio/goquery" "poetryAdmin/worker/app/config" "poetryAdmin/worker/app/tools" "poetryAdmin/worker/core/define" "strings" ) //解析古文首页数据格式 // https://so.gushiwen.org/guwen/ func ParseGuWenIndexCateg...
package main import ( "fmt" "os" "github.com/angletym2014/ecgoredis" ) func main() { //获取redis实例,GetRedisClien方法 myredis := ecgoredis.GetRedisClient("corp.slave.one") defer func() { if r := recover(); r != nil { fmt.Println(r) myredis.Close() os.Exit(3) } else { myredis.Close() } }() //批量设...