text
stringlengths
11
4.05M
package messenger const ( PersonasPath string = "personas" ) // Persona represents the object of persona. type Persona struct { Name string `json:"name"` ProfilePictureURL string `json:"profile_picture_url"` } // PersonaResponse represents the response for create. type PersonaResponse struct { ID st...
// Copyright 2015 PingCAP, 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 i...
package api import ( "errors" "fmt" "sync" "github.com/gholt/store" "github.com/pandemicsyn/ftls" pb "github.com/pandemicsyn/oort/api/groupproto" "github.com/pandemicsyn/oort/api/proto" "golang.org/x/net/context" "google.golang.org/grpc" ) type groupStore struct { lock sync.Mutex addr ...
package filters import ( "bytes" "fmt" "log" "net" "os" "strings" "github.com/bonjourmalware/melody/internal/logging" ) // IPRanges abstracts an array of IPRange type IPRanges []IPRange // IPRules groups the whitelisted and blacklisted ip rules type IPRules struct { WhitelistedIPs IPRanges BlacklistedIPs I...
package charge import ( "fmt" "sync" "testing" lua "github.com/yuin/gopher-lua" ) var ( s1 = ` function c1() return 1 end ` s2 = ` function c1() return 2 end ` ) func TestPrecompiled(t *testing.T) { p := &lStatePool{ script: s1, saved: make([]*lua.LState, 0, 4), } do(p, 1000) p.Reload...
package utils import ( "bytes" "crypto/aes" "crypto/cipher" "encoding/base64" ) //aec加密 func AesEncrypt(src string, key string) (string, error) { // 转成字节数组 origData := []byte(src) k := []byte(key) // 分组秘钥 block, err := aes.NewCipher(k) if err != nil { return "", err } // 获取秘钥块的长度 blockSize := block.B...
// Copyright © 2017 NAME HERE <EMAIL ADDRESS> // // 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 ...
// Copyright 2019 PingCAP, 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 i...
package main import ( ers "errors" // "log" "fmt" "net" //"strings" "time" "github.com/soniah/gosnmp" "strconv" ) func pduVal2str(pdu gosnmp.SnmpPDU) string { value := pdu.Value if pdu.Type == gosnmp.OctetString { return string(value.([]byte)) } else { return "" } } func pduVal2Int64(pdu gosnmp.Snmp...
package main import ( "image/png" "os" "image" "io/ioutil" "bytes" "fmt" "github.com/liyue201/goqr" "github.com/boombuler/barcode" "github.com/boombuler/barcode/qr" ) func qrCodeGen(t string, filename string) (error) { qrCode, _ := qr.Encode(t, qr.M, qr.Auto) qrCode, _ = barcode.Scale(qrCode, 2000, 2000...
package goil import ( "bytes" "errors" "fmt" "io" "mime/multipart" "net/http" "time" ) // TODO Check if when post with no group "official" field exists func CreatePublication(message string, category Category) *Publication { return &Publication{Message: message, Category: category, Group: NoGroup} } // Post ...
package main import "github.com/makishi00/go-vue-bbs/model" func main() { db := model.GetDBConn() db.DropTableIfExists(&model.User{}) db.DropTableIfExists(&model.Token{}) db.DropTableIfExists(&model.Article{}) db.AutoMigrate(&model.User{}) db.AutoMigrate(&model.Token{}) db.AutoMigrate(&model.Article{}) }
package chapter8 import ( "fmt" "testing" ) func TestBSTSortedOrder(t *testing.T) { tree := BST{19, &BST{7, &BST{Value: 3}, &BST{Value: 11}, }, &BST{43, &BST{Value: 23}, nil, }, } fmt.Println("TestBSTSortedOrder:") BSTSortedOrder(&tree) fmt.Println() }
package upstream_notify import ( "context" "encoding/json" "errors" "fmt" "strconv" "tpay_backend/model" "tpay_backend/payapi/internal/logic" "tpay_backend/upstream" "github.com/tal-tech/go-zero/core/logx" "tpay_backend/payapi/internal/svc" ) type ThreeSevenPayTransferLogic struct { logx.Logger ctx co...
package test2json import ( "context" "io" "testing" "github.com/stretchr/testify/require" "go.skia.org/infra/go/deepequal/assertdeep" "go.skia.org/infra/go/exec" "go.skia.org/infra/go/sklog" "go.skia.org/infra/go/sktest" "go.skia.org/infra/go/testutils" "go.skia.org/infra/go/testutils/unittest" "go.skia.or...
package main import ( "fmt" ) // https://leetcode-cn.com/problems/minimum-deletions-to-make-string-balanced/ // 1653. 使字符串平衡的最少删除次数 | Minimum Deletions to Make String Balanced //------------------------------------------------------------------------------ func minimumDeletions(s string) int { return minimumDeleti...
package hostsfile_test import ( "bytes" "fmt" "net/netip" "strings" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/hostsfile" "github.com/AdguardTeam/golibs/netutil" ) func ExampleFuncSet() { const content = "# comment\n" + "1.2.3.4 host1 host2\n" + "4.3.2.1 host3\n" + "1.2.3.4 h...
package easyorm_test //type Account struct { // Id int64 `easyorm:id,primary_key` // Name string `easyorm:name` // Passowrd string `easyorm:passowrd` // Status int8 `easyorm:status` //} // //func ExampleEasyORM() { // db, _ := easyorm.Open("root:123456@tcp(localhost:3306)/test") // tb, err := db.BindMod...
// Copyright 2014 The Sporting Exchange Limited. All rights reserved. // Use of this source code is governed by a free license that can be // found in the LICENSE file. // Package relay implements fan-out to remote relays. package relay import ( "bytes" "expvar" "fmt" "log" "net" "os" "sync" "opentsp.org/int...
package clientModel import ( "bytes" "encoding/json" "errors" ) // Client type Client struct { // Unique identifier for Client ClientID string `json:"clientID"` // Like password to matching with client id ClientSecret string `json:"clientSecret"` // The base domain url HomepageURI string `json:"homepageUR...
package api import ( "encoding/json" "github.com/gorilla/mux" "github.com/sirsean/packhunter/model" "github.com/sirsean/packhunter/mongo" "github.com/sirsean/packhunter/ph" "github.com/sirsean/packhunter/service" "github.com/sirsean/packhunter/web" "net/http" "strings" ) func ListMyUsers(w http.ResponseWrite...
package main import "fmt" // slice type taskList struct{ tasks []*task } func (t *taskList) add_task(ts *task){ t.tasks = append(t.tasks, ts) } func (t *taskList) delete_task(index int){ t.tasks = append(t.tasks[:index], t.tasks[index+1:]...) } func (t *taskList) print_list(){ for _, task := range t.tasks{ f...
package provisioner import ( "crypto/rand" "fmt" "io" "io/ioutil" "log" "net/http" "os" "regexp" "strconv" "github.com/resin-os/resin-provisioner/util" ) var apiKeyRegexp = regexp.MustCompile("[a-zA-Z0-9]+") func checkSocket(path string) error { // The socket file not existing means we can create it. if...
package main import "fmt" func main() { var line int = 10 for i := 0; i < line; i++ { for j := 0; j < line - i - 1; j++ { fmt.Printf(" ") } for k := 0; k < 2 * i + 1; k++ { fmt.Printf("*") } fmt.Println() } }
package tools import ( "github.com/astaxie/beego" "io/ioutil" "os" "golangapi/models" // "log" ) var ( filecache string = beego.AppConfig.String("filecache") ) type Filehelper struct{} // func checkDirectoryIsExist(directoryname string, iscreate bool) bool { // var exist = true // if _ err := os.Stat(...
package main import ( "fmt" //"strconv" "strings" "unicode/utf8" ) func main() { /*s := "Hello, 世界" fmt.Printf("len(s)=%d\n", len(s)) fmt.Println(s[7:])*/ //fmt.Println("HasSuffix(abcdef, ef)=" + strconv.FormatBool(HasSuffix("abcdef", "efg"))) //DecodeRuneToString(s) //fmt.Printf("CountCharInString(%s)=%...
package main // ----------------------------- 方法1: 暴力法 ----------------------------- func numMagicSquaresInside(grid [][]int) int { rows, cols := getRowsAndCols(grid) countOfMagicSquare := 0 for i := 2; i < rows; i++ { for t := 2; t < cols; t++ { if isMagicSquare(grid, i, t) { countOfMagicSquare++ } }...
package main import "fmt" func main() { //map和slice组合 //元素类型为map的切片 var s1 []map[int]string s1 = make([]map[int]string, 2, 5) s1[0] = make(map[int]string, 2) s1[0][2] = "test" s1[0][22] = "tt" fmt.Println(s1) //值为切片类型的map var testmap map[string][]int testmap = make(map[string][]int, 3) // testmap["武汉"] = ...
package main import ( "github.com/therecipe/qt/core" "github.com/therecipe/qt/gui" "github.com/therecipe/qt/quick" ) func init() { PieChart_QmlRegisterType2("Charts", 1, 0, "PieChart") } type PieChart struct { quick.QQuickPaintedItem _ func() `constructor:"init"` _ string `property:"na...
// DO NOT EDIT. This file was generated by "github.com/frk/gosql". package testdata import ( "github.com/frk/gosql" "github.com/frk/gosql/internal/testdata/common" ) func (q *SelectWithRecordNestedSingleQuery) Exec(c gosql.Conn) error { const queryString = `SELECT n."foo_bar_baz_val" , n."foo_baz_val" , n."foo...
package handlers import ( "github.com/go-chi/chi" ) func (s *Server) setupEndpoints(r *chi.Mux) { r.Route("/api/v1", func(r chi.Router) { r.Route("/users", func(r chi.Router) { r.Post("/register", s.registerUser()) r.Post("/login", s.loginUser()) }) r.Route("/todos", func(r chi.Router) { r.Use(s.wit...
/* dokugen is a simple command line utility that exposes many of the basic functions of the sudoku package. It's able to generate puzzles (with difficutly) and solve provided puzzles. Run with -h to see help on how to use it. */ package main import ( "bytes" "encoding/csv" "encoding/json" "flag" "fmt" "github.co...
package main import ( "fmt" ) func solution(s string) []int { round := 0 zero := 0 curZero := 0 for s != "1" { fmt.Printf("t1: %T\n", s) curZero, s = rounds(s) zero += curZero round++ } return []int{zero, round} } func rounds(s string) (int, string) { allCnt := len(s) zeroCnt := countZero(s) binary...
package oidc_test import ( "context" "database/sql" "encoding/json" "fmt" "testing" "time" "github.com/golang/mock/gomock" "github.com/ory/fosite" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/authelia/authelia/v4/internal/autho...
/* Tencent is pleased to support the open source community by making Basic Service Configuration Platform available. Copyright (C) 2019 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...
package chessboard // Rank stores if a square is occupied by a piece type Rank []bool // Chessboard contains eight Ranks, accessed with values from 'A' to 'H' type Chessboard map[byte]Rank // CountInRank returns how many squares are occupied in the chessboard, // within the given rank func (cb Chessboard) CountInRan...
package server import ( "FPproject/Backend/log" "FPproject/Backend/models" "net/http" "github.com/gin-gonic/gin" ) func (h *Handler) InsertUH(c *gin.Context) { var body models.UserHealth err := c.BindJSON(&body) if err != nil { log.Info.Println(err) c.JSON(http.StatusBadRequest, gin.H{ "status": "bad r...
package main import "fmt" func main() { // 数组的长度是类型的一部分 var arr1 [3]int var arr2 [4]string fmt.Printf("%T, %T \n", arr1, arr2) // 数组的初始化 第一种方法 var arr3 [3]int arr3[0] = 1 arr3[1] = 2 arr3[2] = 3 fmt.Println(arr3) // 第二种初始化数组的犯法 var arr4 = [4]int {10, 20, 30, 40} fmt.Println(arr4) // 第三种数组初始化方法,自动推断数组...
package models import ( "gopkg.in/mgo.v2" "net/http" "strings" ) const ( MONGO_ADDRESS = "127.0.0.1:27017" MONGO_DB_NAME = "InventorDB" MONGO_COL_MO_NAME = "monitors" MONGO_COL_SU_NAME = "systemUnit" MONGO_COL_NB_NAME = "n...
package parcels import "sort" type Ref struct { Doc int64 // Document identifier Pos int16 // Position index Weight float64 // Weight of the ngram } // Check for include item func refsContains(rs []Ref, r Ref) bool { l := len(rs) if l == 0 { return false } i := sort.Search(l, func(i int) bool { r...
package defines import ( "fmt" "net/http" ) //const( // CODE_IS_MISSING = 1 // CODE_IS_INVALID = 2 // CLINET_ID_MISSING = 3 //) var INTERNAL_ERROR *ErrCode = NewErrCodeWithHttpStatus("1000", "internal error", http.StatusInternalServerError) var SAVE_DATA_ERROR *ErrCode = NewErrCodeWithHttpStatus("10...
package main import ( "log" "os" "github.com/square/p2/pkg/hooks" "github.com/square/p2/pkg/logging" "github.com/square/p2/pkg/manifest" "github.com/square/p2/pkg/pods" "github.com/square/p2/pkg/types" "github.com/square/p2/pkg/version" "gopkg.in/alecthomas/kingpin.v2" ) var ( podDir = kingpin.Arg("p...
package gui import ( "math" "math/rand" "github.com/gopherjs/gopherjs/js" "github.com/nequilich/gocto" ) type CanvasBody struct { body *gocto.Body canvasMap map[string]*gocto.Canvas contextMap map[string]*js.Object } func (this CanvasBody) resizeAllCanvas() { for _, canvas := range this.canvasMap { ...
package main import ( "fmt" "io/ioutil" "log" "os" "sort" "strings" "github.com/BurntSushi/toml" "github.com/codegangsta/cli" "github.com/natefinch/atomic" "github.com/pborman/getopt" ) var Version = "No Version Provided" // Config holds the emoji configuration type Config struct { Words map[string]strin...
// Copyright 2021 Akamai 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 law or agreed...
package order import ( "time" ) //Order is the definition of purchase table in database type Order struct { ID uint `gorm:"primary_key" json:"id" valid:"-"` NumberSold int `gorm:"not null" json:"number_sold" valid:"numeric,required"` SellPrice int `gorm:"not null" json:"se...
// // Copyright 2020 The AVFS 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 storage import ( "context" "errors" "fmt" "strconv" "time" "github.com/jmoiron/sqlx" "github.com/authelia/authelia/v4/internal/model" "github.com/authelia/authelia/v4/internal/utils" ) // SchemaTables returns a list of tables. func (p *SQLProvider) SchemaTables(ctx context.Context) (tables []string,...
package auth import ( "fmt" "managIncident/controllers/admin" "managIncident/models" "time" "github.com/astaxie/beego" "github.com/astaxie/beego/orm" "github.com/astaxie/beego/validation" ) type RegisterController struct { beego.Controller } func (this *RegisterController) Register() { o := orm.NewOrm() ...
// Copyright 2019 PingCAP, 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 i...
package main import ( "fmt" "io" "log" "net" ) func SetRequestHeader() string { msg := "GET / HTTP/1.1\r\n" msg += "Host:www.baidu.com\r\n" msg += "Connection:close\r\n" msg += "\r\n" return msg } func main() { conn, err := net.Dial("tcp", "www.baidu.com:80") if err != nil { log.Fatalf("Dial error:%v\n...
package dbstore import ( "testing" "github.com/driftprogramming/pgxpoolmock" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var constraintColumns = []string{"id", "namespace", "name", "selector", "allowed_processes", "allowed_files"} func TestGetAll...
///////////////////////////////////////////////////////////////////// // arataca89@gmail.com // 20210420 // // Implementação uma pilha de strings usando o tipo slice // // Referência: // (DONOVAM e KERNIGHAN, 2017) // package main import ( "fmt" "os" ) var stack = make([]string, 1) func push(it...
package router import ( "encoding/json" "github.com/golang/glog" "qipai/dao" "qipai/domain" "qipai/enum" "qipai/game" "qipai/model" "qipai/srv" "qipai/utils" "zero" ) func init() { game.AddAuthHandler(game.ReqCreateRoom, createRoom) game.AddAuthHandler(game.ReqRoomList, roomList) game.AddAuthHandler(game...
package main import ( "flag" "log" "net" "os" "os/signal" "time" "github.com/valyala/fasthttp" ) // guard is a high performance circuit breaker written in Go. var ( proxyAddr = flag.String("proxyAddr", ":80", "proxy server listen at") configAddr = flag.String("configAddr", ":8080", "config server listen a...
package kubemq_queue import ( "context" "encoding/json" "time" queuesStream "github.com/kubemq-io/kubemq-go/queues_stream" "github.com/pkg/errors" uuid "github.com/satori/go.uuid" "github.com/batchcorp/plumber-schemas/build/go/protos/opts" "github.com/batchcorp/plumber-schemas/build/go/protos/records" "git...
package main import "fmt" func foo() string { return "hello world" } func main() { fmt.Println("hello world") }
package api import ( "bufio" "encoding/json" "fmt" "io/ioutil" "log" "net" "os" "runtime" "strings" "sync" "time" ) func CheckSSH() { //check from image filePath := fmt.Sprintf("imagesTemp/%s/layer/etc/rc.local", TopLayerID) fmt.Println(filePath) if _, err := os.Stat(filePath); os.IsNotExist(err) { l...
package main import ( "reflect" validator "github.com/syssam/go-validator" ) func CustomValidator(v reflect.Value, o reflect.Value, validTag *validator.ValidTag) bool { return false } func main() { validator.CustomTypeRuleMap.Set("customValidator", CustomValidator) validator.CustomTypeRuleMap.Set("customValida...
package dockertestspike_test import ( "database/sql" "fmt" "io/ioutil" "log" "os" "testing" "time" "github.com/google/uuid" _ "github.com/lib/pq" "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" dts "github.com/ayubmalik/dockertestspike" ) var pool *dockertest.Pool func TestMain(m ...
package mongodb_test import ( "context" "fmt" "reflect" "testing" "go.mongodb.org/mongo-driver/mongo/options" "tagallery.com/api/config" "tagallery.com/api/logger" "tagallery.com/api/model" "tagallery.com/api/mongodb" "tagallery.com/api/testutil" "tagallery.com/api/util" ) func init() { logger.Setup(true...
package antlr import "sort" type DFA struct { atnStartState DecisionState decision int states map[string]*DFAState s0 *DFAState precedenceDfa bool } func NewDFA(atnStartState DecisionState, decision int) *DFA { d := new(DFA) // From which ATN state did we create d DFA? d.atnStartStat...
package mcservice import ( "log" ) func (s *MCService) publish(req *JSONRequest) (*JSONResponse, error) { if len(req.Params) < 3 { return nil, errNumParameter } _, ok := req.Params[0].(string) if ok != true { return nil, errParameter } _, ok = req.Params[1].(string) if ok != true { return nil, errParame...
package context import ( "context" "testing" "time" "github.com/stretchr/testify/assert" ) func TestContext(t *testing.T) { ctx1 := context.WithValue(context.Background(), "go-kratos", "https://github.com/go-kratos/") ctx2 := context.WithValue(context.Background(), "kratos", "https://go-kratos.dev/") ctx, ca...
package receiver import ( "github.com/luno/moonbeam/address" ) // Directory provides access to the set of targets. // For example, a hosted wallet will have a list of targets corresponding to // user accounts. type Directory struct { domain string } func NewDirectory(domain string) *Directory { return &Directory{...
package ds /*** * * Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). Example 1: Input: nums = [4,2,3] Output: true ...
package api import ( "github.com/jackc/pgtype" "time" ) type Game struct { ID pgtype.UUID `json:"-"` Location string `json:"location"` TeamAID pgtype.UUID `json:"-"` TeamBID pgtype.UUID `json:"-"` TeamA Team `json:"teamA"` TeamB Team `...
package main import ( "encoding/binary" "flag" "fmt" "net" "os" "strconv" "time" ) func main() { // Check for command-line flags logfileFlag := flag.String("IP", "127.0.0.1", "Server IP to dial (default:127.0.0.1)") flag.Parse() fmt.Println("Writing output to latencyMeasurements.txt") f, _ := os.Create(...
package main import ( "mygolang/zhaoyu-json-rest/rest/trie" ) func main() { trie := trie.New() // trie.AddRoute("GET", "/r/:id/property.*format", "property_format") // trie.AddRoute("GET", "/user/#username/property", "user_property") trie.AddRoute("GET", "/user/", "property_format") trie.AddRoute("GET", "/a/", ...
package main import ( "bytes" "flag" "fmt" "io/ioutil" "os" "github.com/contiamo/oku" ) type Config struct { Detect bool Encoding string Output string } var config Config func init() { flag.BoolVar(&config.Detect, "d", false, "detect encoding and exit") flag.StringVar(&config.Encoding, "f", "", "fro...
package app import ( "fmt" "os" "github.com/gin-gonic/gin" "github.com/google/wire" swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" "github.com/thoohv5/template/api/docs" "github.com/thoohv5/template/internal/pkg/config" "github.com/thoohv5/template/pkg/app" "github.com/...
// Copyright © 2020 Attestant Limited. // 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 ...
// Copyright 2023 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 applica...
package lcd import ( "net/http" "github.com/gorilla/mux" "github.com/irisnet/irishub/client/context" "github.com/irisnet/irishub/codec" ) func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) { // Query liquidity r.HandleFunc( "/coinswap/liquidities/{id}", queryLiquidityHandl...
package kala // A Minter provides methods for minting unique IDs type Minter interface { Mint() (string, error) }
package wire import ( "bytes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "gx/ipfs/QmU44KWVkSHno7sNDTeUcL4FBgxgoidkFuTUyTXWJPXXFJ/quic-go/internal/protocol" "gx/ipfs/QmU44KWVkSHno7sNDTeUcL4FBgxgoidkFuTUyTXWJPXXFJ/quic-go/internal/utils" ) var _ = Describe("MAX_STREAM_ID frame", func() { Context("pars...
package logon import ( "github.com/quickfixgo/quickfix" "github.com/quickfixgo/quickfix/enum" "github.com/quickfixgo/quickfix/field" "github.com/quickfixgo/quickfix/fix41" "github.com/quickfixgo/quickfix/tag" ) //Logon is the fix41 Logon type, MsgType = A type Logon struct { fix41.Header *quickfix.Body fix41....
package gosnowth import ( "bytes" "encoding/json" "fmt" "math" "strconv" ) // DF4Response values represent time series data in the DF4 format. type DF4Response struct { Ver string `json:"version,omitempty"` Head DF4Head `json:"head"` Meta []DF4Meta `json:"meta"` Data []DF4Data `json:"data"` Query ...
package xattrsyscall import ( "syscall" "unsafe" ) var _zero uintptr func Getxattr(path string, attr string, dest []byte) (int, error) { var destPtr *byte var size int if dest != nil { destPtr = &dest[0] size = len(dest) } r0, _, e1 := syscall.Syscall6(syscall.SYS_GETXAT...
package util import ( "context" k8scontrollerclient "sigs.k8s.io/controller-runtime/pkg/client" . "github.com/onsi/gomega" ) // DeterminedE2EClient wraps E2eClient calls in an Eventually assertion to keep trying // or bail after some time if unsuccessful type DeterminedE2EClient struct { *E2EKubeClient } func ...
package apis import ( "net/http" "log" "fmt" "github.com/gin-gonic/gin" . "farmer/autocs/models" "strconv" "github.com/mssola/user_agent" ) type Reback struct { Status int `json:"status"` Msg string `json:"msg"` Data interface{} `json:"data"` } func IndexApi(c *gin.Context) { ua := user_agent.New(c.Requ...
// Copyright 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 applicable la...
/* Implement PKCS#7 padding A block cipher transforms a fixed-sized block (usually 8 or 16 bytes) of plaintext into ciphertext. But we almost never want to transform a single block; we encrypt irregularly-sized messages. One way we account for irregularly-sized messages is by padding, creating a plaintext that is an ...
// Copyright 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 applicable...
package field_test import ( "bytes" "encoding/hex" "io" "testing" "github.com/tombell/go-serato/serato/field" ) // XXX: Location field appears to always be empty in session files. func TestNewLocationField(t *testing.T) { data, _ := hex.DecodeString("0000000300000072002F00550073006500720073002F0074006F006D006...
package metrics import "github.com/prometheus/client_golang/prometheus" const ( // Controller names operatorController = "operator" adoptionCSVController = "adoption_csv" adoptionSubscriptionController = "adoption_subscription" operatorConditionController = "operat...
package filesystem import ( "fmt" "github.com/pkg/errors" "got/internal/objects" ) func (g *Got) Commit(message string) error { headType, err := g.HeadType() if err != nil { return errors.Wrap(err, "couldn't perform commit") } if headType == HeadTypeRef { return g.commitAtRef(message) } return g.firstC...
package db import ( "core" "encoding/json" "entity" ) type Replica struct { GroupMembers []string PdaConf entity.PDAConf } type InMemoryStore struct { PdaProcessors map[string]core.PdaProcessor ReplicaMembers map[int]Replica } func (inMemoryStore *InMemoryStore) InitStore() { inMemoryStore.PdaProcesso...
package main import "fmt" func breakcase1() { /* local variable definition */ var a int = 10 /* for loop execution */ for a < 20 { fmt.Printf("value of a: %d\n", a) a++ if a > 15 { /* terminate the loop using break statement */ break } } } func breakCase2() { for outer := 0; outer < 5; outer++ {...
package backends import "errors" var ( ErrAuthorizationFailed = errors.New("Authorization failed.") )
package websockets import ( "encoding/json" "github.com/janwiemers/up/database" ) var HubInstance *Hub // Hub maintains the set of active clients and broadcasts messages to the // clients. type Hub struct { // Registered clients. clients map[*Client]bool // Inbound messages from the clients. Broadcast chan [...
package main import "fmt" func main() { var names[3]string names[0] = "Nabil" names[1] = "Fawwaz" names[2] = "Elqayyim" fmt.Println(names[0]) fmt.Println(names[1]) fmt.Println(names[2]) var values = [4]int{ 1, 2, 3, } fmt.Println(values) fmt.Println(len(values)) }
package models type User struct { ID uint `json:"id" gorm:"primary_key"` Name string `json:"name"` Email string `json:"email"` } type CreateUser struct { Name string `json:"name" binding:"required"` Email string `json:"email" binding:"required"` } type UpdateUser struct { Name string `json:"name"` Ema...
package main import ( "context" "encoding/json" "fmt" "github.com/scjalliance/drivestream" "github.com/scjalliance/drivestream/collection" "github.com/scjalliance/drivestream/commit" kingpin "gopkg.in/alecthomas/kingpin.v2" ) func dump(ctx context.Context, app *kingpin.Application, repo drivestream.Repository...
package main import ( "complie/src/craft" "strconv" "strings" ) func main() { simpleScript := craft.NewSimpleScript() simpleScript.Strat() } func decode(code string) string { ret := make([]string, 3) for havaEncode(code) { leftClose := 0 length := len(code) for i := 0; i < length; i++ { if code[i] =...
package main import ( "github.com/severedsea/go-web-boilerplate/cmd/serverd/banner" "github.com/severedsea/go-web-boilerplate/cmd/serverd/server" ) func main() { // Print banner banner.Print() // Start server server.New().Start() }
package cluster type Role int const ( JoinElection Role = iota AsLeader AsFollower AsWatcher )
package popgun import ( "fmt" "strconv" "strings" ) type Executable interface { Run(c *Client, args []string) (int, error) } type QuitCommand struct{} func (cmd QuitCommand) Run(c *Client, args []string) (int, error) { newState := c.currentState if c.currentState == STATE_TRANSACTION { err := c.backend.Upda...
package qiwi import ( "context" "encoding/base64" "encoding/json" "fmt" ) type ApplePayToken struct { // Type string `json:"type"` PaymentData ApplePayTokenData `json:"paymentData"` } type ApplePayTokenData struct { Version string `json:"version"` Data string `json:"data"` Header ...
package cmd import ( "fmt" "io/ioutil" "github.com/jpillora/opts" antlr "github.com/wxio/goantlr" "github.com/wxio/tron-go/adl" ) func BuildAdlAst() opts.Opts { return opts.New(&buildAdlAst{}).Name("build_ast") } type buildAdlAst struct { File string `type:"arg" help:"adl file" predict:"files"` } func (cm *...