text
stringlengths
11
4.05M
package packed //func ArgumentsJS() []byte { // panic("not implemented") //} //
package core import ( "context" "log" "net/http" "time" "github.com/gorilla/websocket" ) /* total number of gorutine = 2n number of concurrency connections : n accept gorutine : 1 */ // Server represents a websocket server. type Server struct { server *http.Server path string addr string ...
/** * @description: 先定义后赋值 数组 * @author Administrator * @date 2020/7/11 0011 10:44 */ package main import "fmt" func main() { //定义方式1:预先定义 var arrnum [3]int //定义长度为3的数组 arrnum[0] = 0 arrnum[1] = 1 arrnum[2] = 2 //定时方式2:定义同时赋值 var arrnum2 [3]int = [3]int{1, 2, 3} //正规写法 var arrnum3 = [3]int{4, 5, 6} ...
package cmd import ( "fmt" "github.com/Caroline1997/Service-Agenda/cli/service" "github.com/spf13/cobra" ) var deleteCmd = &cobra.Command{ Use: "delete user", Short: "for user to delete the account", Long: `the usage is to delete his own acccount`, Run: func(cmd *cobra.Command, args []string) { name, _ :...
package service import ( "antalk-go/internal/auth/config" "antalk-go/internal/auth/dao" proto "antalk-go/internal/proto/pb" "context" _ "github.com/go-sql-driver/mysql" ) type AuthService struct { c *config.Config dao *dao.Dao } func New(c *config.Config) *AuthService { s := &AuthService{ c: c, dao: ...
package core import "encoding/json" type Team struct { Name string `json:"name"` //team name AccessGroup []int `json:"accessGroups"` } // ToJSON dump User struct func (u Team) ToJSON() (string, error) { inrec, err := json.Marshal(u) if err != nil { return "", err } return string(inrec[:]), err } //T...
// Package url2epub fetches http(s) URL and extracts ePub files from them. package url2epub
/* * Copyright IBM Corporation 2021 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law o...
package router import ( "github.com/gin-gonic/gin" "hd-mall-ed/packages/admin/controller/bannerController" ) func bannerRouter(router *gin.RouterGroup) { banner := router.Group("/banner") { banner.GET("/list", bannerController.GetBannerList) } }
package store import ( "github.com/angeldhakal/tv-tracker/models" ) func NewUserStore() UserTracker { return &userStore{ conn: models.Connect(), } } func NewTokenStore() TokenTracker { return &tokenStore{ conn: models.Connect(), } } func NewMovieStore() MovieTracker { return &movieStore{ conn: models.Co...
package module import ( "festival/app/model" "festival/app/model/system" ) // 点亮线路表 // power by 7be.cn type ModUserRoute struct { model.BaseModel UserId uint `form:"userId" json:"userId" gorm:"column:userId;type:int(11);comment:用户ID;"` RouteId uint `form:"routeId" json:"routeId" gorm:"column:routeId;type:int(11)...
package main import ( "github.com/go-martini/martini" "github.com/martini-contrib/render" ) func main() { m := martini.Classic() m.Use(render.Renderer()) m.Get("/", func(r render.Render) { r.JSON(200, map[string]interface{}{"Response": "OK"}) }) m.Run() }
package handlers import ( "github.com/ChristophBe/grud/types" "net/http" ) // NewGetOneHandler returns a http handler for handling requests one specific model. func NewGetOneHandler(service types.GetOneService, responseWriter types.ResponseWriter, errorWriter types.ErrorResponseWriter) http.HandlerFunc { return fu...
package config import ( "os" "strconv" "strings" "github.com/jinzhu/gorm" ) var GormDB *gorm.DB // DBConfig - holds the config needed to connect to a database. type DBConfig struct { DbHost string DbPort string DbName string DbUsername string DbPassword string } // ServerConfig - holds the conf...
package mesos_cli import "math" type Slave struct { Hostname string Used Resources Total Resources } func (s *Slave) AvailableCpu() float64 { return s.Total.Cpu - s.Used.Cpu } func (s *Slave) AvailableMem() float64 { return s.Total.Mem - s.Used.Mem } func (s *Slave) AllowedInstances(cpu float64, memory...
package lib import ( "cloud.google.com/go/datastore" "context" "fmt" "github.com/chidakiyo/benkyo/go-memleak-check/log" "github.com/gin-gonic/gin" "net/http" "os" ) func OfficialDatastore(g *gin.Context) { c := g.Request.Context() result := officialSearchDao(c) g.JSON(http.StatusOK, result) } func Official...
package examples // 以下注释中,多行注释表示对方法的描述,单行注释表示项目的使用方式 /* * 以 Get 开头的方法将默认只支持 get 请求 */ func GetUser(id int64) {} /* * 使用 `@HttpGet` 表示该方法支持 get 请求 */ // @HttpGet func User1() {} /* * 使用 `@HttpGet` 与使用 `@HttpPost` 等并不冲突,这样表示该方法支持 get 和 post, * 但其他方式(例如 delete 等)不予支持。 */ // @HttpGet // @HttpPost func User2() {}...
// 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 video import ( "fmt" "testing" "chromiumos/tast/common/genparams" ) // NB: If modifying any of the files or test specifications, be sure to // regenerate the te...
package main import ( "fmt" "log" "os" ) func main() { var modulename string rootmodfiles := []string{"main.tf", "variables.tf", "outputs.tf", "provider.tf"} childmodfiles := []string{"main.tf", "variables.tf", "outputs.tf", "README.md"} providersource := "hashicorp/aws" providerversion := ">= 3.37.0" tfawsp...
package mp import ( "WeChat-golang/mp/core" "WeChat-golang/mp/user" "fmt" "testing" ) func TestGetAccessToken(t *testing.T) { srv := &core.AccessTokenServer{ AppId: "wx5d769a50fe0a6589", AppSecret: "e87a13b7b2e4b39ac884eae60b004404", } srv.GetAccessToken() data, err := user.GetUserList(core.GetClient(...
package entity type Discount struct { Meta *Meta `json:"meta"` // Метаданные Id string `json:"id"` // Id контактного AccountId string `json:"accountId"` // Id учетной записи Name string `json:"name"` // Наименование скидки Active bool `json:"acti...
// 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, ...
package nebula import ( "fmt" "strings" "time" "github.com/sirupsen/logrus" "github.com/slackhq/nebula/config" ) func configLogger(l *logrus.Logger, c *config.C) error { // set up our logging level logLevel, err := logrus.ParseLevel(strings.ToLower(c.GetString("logging.level", "info"))) if err != nil { ret...
package constant_test import "testing" const ( Monday = iota + 1 // iota 是 golang 语言的常量计数器,只能在常量的表达式中使用。 Tuesday Wendesday ) const ( Readable = 1 << iota // 0001 Writable // 0010 Executable // 0100 ) func TestConstantTry(t *testing.T) { t.Log(Monday, Tuesday) } func TestConstantT...
package response const ( /** Datastore 1500~ **/ datastoreError = 1505 ) type Response struct { Code int Description string } func DatastoreError() interface{} { return Response{ Code : datastoreError, Description : "datastore error", } }
package assert import "testing" func TestNotImplementsMatcher(t *testing.T) { m := Not(NilValue()) var expected *Matcher err := AssertThat(m, Implements(expected)) if err != nil { t.Fatal(err) } } func TestNotMatches(t *testing.T) { err := AssertThat(t, Not(NilValue())) if err != nil { t.Fatal(err) } } ...
// 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 localfs_test import ( "fmt" "github.com/adamluzsi/frameless/ports/filesystem" "github.com/adamluzsi/testcase/assert" "io" "io/fs" "os" "path/filepath" "syscall" "testing" filesystemcontracts "github.com/adamluzsi/frameless/ports/filesystem/filesystemcontracts" "github.com/adamluzsi/frameless/adapt...
package main import "fmt" /* - && - || - ! - Qual o resultado de fmt.Println... - true && true - true && false - true || true - true || false - !true */ func main() { x := 9 if !(x%2 == 0) && x%3 == 0 { fmt.Println("é múltiplo de dois e tambem de treis") } // if x%2 == 0 || x%3 == 0 { //...
package Concurrency_Pattern import "fmt" // PlusOne returns a channel of num+1 for received from in. func PlusOne(in <-chan int) <-chan int { out := make(chan int) go func() { defer close(out) for num := range in { out <- num + 1 } }() return out } func ExamplePlusOne() { c := make(chan int) go func()...
package guile import ( "github.com/nlandolfi/set" "github.com/nlandolfi/set/relation" ) // --- Economic Interpretation {{{ type ( Alternative set.Element Alternatives set.Interface Preference relation.AbstractInterface PreferenceProfile []Preference SocialWelfareFunction func(PreferenceProfile) Preference...
// chaosTester project main.go package main import ( "configutil" "fmt" "os" "sync" "testkicker" "io/ioutil" "log" "strings" "webservices" "gopkg.in/yaml.v3" ) var wg sync.WaitGroup var args []string func startTest(ch chan string) { defer wg.Done() log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)...
package main import ( "flag" "log" "net/http" "regexp" "strconv" "sync" "time" "github.com/sevlyar/go-daemon" "github.com/golang/glog" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promhttp" "gi...
package main import ( "flag" "net/url" "github.com/gorilla/websocket" "fmt" "io/ioutil" ) var serveraddr = flag.String("s1","127.0.0.1:9630","http service address") var serverurl = url.URL{Scheme:"ws",Host:*serveraddr,Path:"/echo"} var data = []byte(`bad new`) func main(){ client,_,_ := websocket.DefaultDialer....
// Copyright 2019 the u-root Authors. All rights reserved // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // esxiboot executes ESXi kernel over the running kernel. // // Synopsis: // esxiboot --config <config> // // Description: // Loads and executes ESXi...
// 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 common import ( "io/ioutil" "log" ) func closelog() { log.SetFlags(0) log.SetOutput(ioutil.Discard) }
package roman_numerals import ( "testing" ) func verify(t *testing.T, in int, out string, solution string) { if solution != out { t.Error( "For", in, "expected", out, "got", solution, ) } } func TestConvertSingleDigitsToRoman(t *testing.T) { tests := []struct{ in int out string }{ {in: 1, out...
package gorequest import ( "math/rand" "time" ) // RandomUA will return a random user agent. // 随机请求头 func RandomUA() string { userAgent := [...]string{ "Mozilla/4.0 (compatible, MSIE 7.0, Windows NT 5.1, 360SE)", "Mozilla/4.0 (compatible, MSIE 8.0, Windows NT 6.0, Trident/4.0)", "Mozilla/5.0 (compatible, MS...
package model type UserDataRecord struct { Label string Value string IsValid bool IsOwner bool }
package main import ( "fmt" "github.com/itang/gotang" _ "github.com/lib/pq" "github.com/lunny/xorm" ) var ( driver = "postgres" spec = "dbname=yunshangdb user=dbuser password=dbuser sslmode=disable" ) func main() { Engine, err := xorm.NewEngine(driver, spec) gotang.AssertNoError(err, "") defer Engine.Clo...
package login import ( "net/source/msg/msgproc" ) type RepoMsg struct { msgproc.BaseMsg DevId int64 IsCharged byte Name string }
/* Copyright: PeerFintech. All Rights Reserved. */ package gohfc import ( "archive/tar" "bytes" "compress/gzip" "io" "os" "path" "path/filepath" "strings" "github.com/golang/protobuf/proto" cb "github.com/hyperledger/fabric-protos-go/common" pb "github.com/hyperledger/fabric-protos-go/peer" lb "github.co...
package smartling import ( "fmt" "net/url" ) // ProjectsListRequest is a request used in GetProjectsList method. type ProjectsListRequest struct { // Cursor specifies limit/offset pagination pair. Cursor LimitOffsetRequest // ProjectNameFilter specifies filter for project name. ProjectNameFilter string // In...
package main import ( "encoding/json" "fmt" "os" ) func JsonMarshal() { type ColorGroup struct { ID int Name string Colors []string } group := ColorGroup{ ID: 1, Name: "Reds", Colors: []string{"Crimson", "Red", "Ruby", "Maroon"}, } b, err := json.Marshal(group) if err != nil { fmt.P...
// SPDX-License-Identifier: ISC // Copyright (c) 2014-2020 Bitmark Inc. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package difficulty_test import ( "encoding/json" "fmt" "math" "testing" "github.com/stretchr/testify/assert" "github.com/bitmark-inc/bitmar...
package test import ( api_v1 "k8s.io/api/core/v1" extensions "k8s.io/api/extensions/v1beta1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/kubernetes/scheme" backendconfig "k8s.io/ingress-gce/pkg/apis/backendconfig/v1beta1"...
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. // package aws import ( "context" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ec2" ec2Types "github.com/aws/aws-sdk-go-v2/service/ec2/types" "github.com/aws/aws-sdk-go-v2/...
package tyTls import ( "bytes" "crypto/ecdsa" "crypto/rsa" "crypto/x509" "encoding/pem" "fmt" "strings" ) func DecodePemContentCallback(content []byte, cb func(obj interface{})) (errMsg string) { bw := bytes.Buffer{} for _, line := range strings.Split(string(content), "\n") { line = strings.TrimSpace(line)...
package test_select import ( "context" "github.com/jackc/pgx/v4/pgxpool" "log" "os" "testing" ) //go:generate true var pool *pgxpool.Pool func TestMain(m *testing.M) { var err error databaseUrl, ok := os.LookupEnv("DATABASE_URL") if !ok { log.Fatal("Environment variable DATABASE_URL is required to connect ...
// 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 final_prices_with_a_special_discount_in_a_shop type Stack struct { items []interface{} } func (s *Stack) Push(item interface{}) { s.items = append(s.items, item) } func (s *Stack) Pop() interface{} { n := s.Len() last := s.items[n-1] s.items = s.items[:n-1] return last } func (s Stack) Len() int { re...
package numrecipes import "testing" func TestQPow(t *testing.T) { t.Log(QPow(300, 300)) } func BenchmarkQPow(b *testing.B) { for i := 0; i < b.N; i++ { QPow(300, i) } }
package main import ( "context" "fmt" "os" "os/exec" "github.com/spf13/pflag" ) // Version identifies the version of rope. This can be modified by CI during // the release process. var Version = "dev" const defaultHelp = `Rope is a tool for managing Python dependencies 🧩 Usage: rope <command> [options] T...
package x86_64 import ( "github.com/lunixbochs/ghostrace/ghost/sys/num" uc "github.com/unicorn-engine/unicorn/bindings/go/unicorn" "../../models" "../../syscalls" ) var StaticUname = models.Uname{"Linux", "usercorn", "3.13.0-24-generic", "normal copy of Linux minding my business", "x86_64"} func LinuxInit(u mod...
package main import ( "fmt" "strconv" "./romannumerals" ) var appName = "The Romain Numerals Converter" func main() { var inputValue string var inputValueAsInt int fmt.Printf("Welcome to %v\n", appName) fmt.Printf("Enter a numeric value: ") fmt.Scanln(&inputValue) inputValueAsInt, _ = strconv.Atoi(inputVal...
package common import ( "encoding/json" "fmt" "io/ioutil" "os" ) // URLS - структура с urls type URLS struct { EtranURL string "json:\"urlEtran\"" } // ReadDataFromJSON - функция обработки json файла func ReadDataFromJSON(path string) URLS { jsonFile, err := os.Open(path) if err != nil { fmt.Println(err) }...
package stringUtil import ( "strings" "unicode" ) const period string ="." const space string ="" //判断字符串是否由数字组成 func IsNum(src string) (ok bool) { if strings.Contains(period, src) { if strings.Count(period, src) != 1 { return false } } else { for _, c := range src { if c != 46 { if !unicode.IsDigi...
package color import ( "testing" ) func Example() { Println( Green("Green"), " ", Red("Red").BgWhite(), " ", "Normal ", Yellow("Yellow"), " ", Blue("%s", "Blue")) } func TestForeAndBack(t *testing.T) { Println(Red("Red on White").BgWhite()) } func TestForeground(t *testing.T) { Println( None("None")...
package apilifecycle import godd "github.com/pagongamedev/go-dd" // ValidateQuery Type type ValidateQuery = func(context *godd.Context) (requestValidatedQuery interface{}, goddErr *godd.Error) // ValidateQuery Set func (api *APILifeCycle) ValidateQuery(handler ValidateQuery) { api.validateQuery = handler } // GetV...
// 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...
// 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 hps import ( "context" "time" "github.com/golang/protobuf/ptypes/empty" wrappers "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/grpc" "chrom...
package main import ( "fmt" "github.com/elentok/notes/node" "github.com/elentok/notes/parser" ) func main() { root, err := Read("/Users/elentok/projects/editor/closures.notes") if err != nil { panic(err) } for _, node := range root.Children() { printNode(node) } } func printNode(n node.Node) { if !n...
// This file has been created by "go generate" as initial code. go generate will never update it, EXCEPT if you remove it. // So, update it for your need. package main import ( "fmt" "github.com/forj-oss/goforjj" "log" "os" "path" ) // checkSourceExistence Return ok if the X instance exist func (r *UpdateReq) c...
package usersvc type ( getUsersUseCase interface { GetUsers() ([]User, error) } userInfoUseCase interface { UserInfo(id string) (*User, error) } // Service groups the usecases together. Service struct { getUsersUseCase userInfoUseCase } repository interface { WithID(id string) (User, error) Belon...
package disc import ( "fmt" "log" "time" "github.com/Karitham/WaifuBot/database" "github.com/Karitham/WaifuBot/query" "github.com/diamondburned/arikawa/v2/discord" "github.com/diamondburned/arikawa/v2/gateway" "go.mongodb.org/mongo-driver/mongo" ) // Roll drops a random character and adds it to the database ...
package problem1029 import "sort" func twoCitySchedCost(costs [][]int) int { N := len(costs) / 2 diff := []Diff{} for i := 0; i < len(costs); i++ { d := Diff{ costDiff: costs[i][1] - costs[i][0], idx: i, } diff = append(diff, d) } sort.Slice(diff, func(i, j int) bool { return diff[i].costDiff >...
package minisentinel import ( "errors" "testing" "time" "github.com/FZambia/sentinel" "github.com/alicebob/miniredis/v2" "github.com/gomodule/redigo/redis" "github.com/matryer/is" ) // TestSomething - shows how-to start up sentinel + redis in your unittest func TestSomething(t *testing.T) { is := is.New(t) ...
package raws // import "github.com/BenLubar/dfide/gui/raws" import ( "github.com/BenLubar/dfide/gui" "github.com/BenLubar/dfide/raws" "github.com/BenLubar/dfide/raws/language" ) type languageEditor struct { baseVisualEditor tags []language.Tag box gui.Box } func (e *languageEditor) control() gui.Control { e....
package main import ( "bufio" "fmt" "log" "math/rand" "os" "path" "strconv" "strings" "time" ) func measurePut(n int, c *client, seq int32, logFp *os.File) int32 { for i := 0; i < n; i++ { key := fmt.Sprintf("key%d", i) val := fmt.Sprintf("val%d", i) t := time.Now() c.MessagePut(0, key, val, seq) ...
// Copyright (c) 2016-2018, Jan Cajthaml <jan.cajthaml@gmail.com> // // 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 main import ( "flag" "fmt" "io/ioutil" "os/exec" "strings" "sync" "time" "github.com/freb/go-blink1" ) const ( fade = 250 * time.Millisecond dur = 2 * time.Second ) var white = blink1.State{Red: 255, Green: 255, Blue: 255, FadeTime: fade, Duration: dur} // #FFFFFF var black = blink1.State{Red: 0,...
package driver_location // DriverID represents a driver identifier. type DriverID int // Location represents geo information from cars. type Location struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Updated_at string `json:"updated_at,omitempty"` } // Locations represents recor...
package dao import ( "example.com/http_demo/model/dao/table" "example.com/http_demo/utils/zlog" "github.com/jinzhu/gorm" "go.uber.org/zap" "time" ) //-------- 单表查询开始 -----------// func GetAllOrders() (orders []*table.Order, err error) { orders = make([]*table.Order, 0) err = DB().Find(&orders).Error if err !...
// 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, ...
// 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 crostini import ( "context" "time" "chromiumos/tast/local/chrome/uiauto" "chromiumos/tast/local/chrome/uiauto/faillog" "chromiumos/tast/local/chrome/uiauto/nod...
package math import ( "jvm-go/instruction/base" "jvm-go/runtimedata" ) // todo 实现 type D2F struct{ base.NoOperandsInstruction } type D2I struct{ base.NoOperandsInstruction } func (self *D2I) Execute(frame *runtimedata.Frame) { stack := frame.OperandStack() d := stack.PopDouble() i := int32(d) stack.PushInt(i...
package middleware import ( "apiserver/handler" "apiserver/pkg/errno" "bytes" "encoding/json" "github.com/gin-gonic/gin" "github.com/lexkong/log" "github.com/willf/pad" "io/ioutil" "regexp" "time" ) //used for capture Response type bodyLogWriter struct { gin.ResponseWriter body *bytes.Buffer } func (w bo...
package db import ( "fmt" "time" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/postgres" "github.com/lucas-dev-it/62252aee-9d11-4149-a0ea-de587cbcd233/business/model" "github.com/lucas-dev-it/62252aee-9d11-4149-a0ea-de587cbcd233/internal" ) var ( host = internal.GetEnv("DB_HOST", "localho...
// SPDX-License-Identifier: ISC // Copyright (c) 2014-2020 Bitmark Inc. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package rpc_test import ( "fmt" "math/rand" "os" "path" "testing" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" an...
/* * Wire API * * Moov Wire implements an HTTP API for creating, parsing, and validating Fedwire messages. * * API version: v1 * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package openapi // MessageDisposition struct for MessageDisposition type MessageDisposition struct { // formatVer...
// Copyright 2014 Matthias Zenger. 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 appl...
package main // https://leetcode.com/problems/longest-substring-without-repeating-characters/#/description import ( "fmt" ) var hashTable = [26]int{} func lengthOfLongestSubstring(s string) int { strlen := len(s) maxCount := -1 for i := 0; i < strlen; i++ { hashTable = [26]int{} count := 0 for j := i; j <...
package main import ( "log" "net/http" "os" "github.com/elizar/w/routes" "github.com/gorilla/handlers" "github.com/gorilla/pat" ) func main() { r := pat.New() // register routes routes.RegisterRoutes(r) // Use gorilla logger if server is not mounted // through `up start` http.Handle("/", func() http.Ha...
// Copyright 2021 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 ( "log" "github.com/spf13/cobra" ) var ( // Version is set with a linker flag (see Makefile) Version string // Build is set with a linker flag (see Makefile) Build string ) func main() { log.Printf("ampctl (version: %s, build: %s)\n", Version, Build) rootCmd := &cobra.Command{ Use: ...
package saveddocrefs type DocInsertPrimaryKeyEntry struct { DocID string TableName string PrimaryKey string }
package task import ( "sync" "github.com/beego/beego/v2/core/logs" "github.com/mobilemindtec/go-utils/v2/ctx" "github.com/mobilemindtec/go-utils/v2/optional" "github.com/sirsean/go-pool" ) type TaskType int type TaskSource[T any] struct { Data T } func NewTaskSource[T any]() *TaskSource[T] { return &TaskSou...
package iso import ( "errors" "fmt" "testing" ) type handler struct{} func (h *handler) ExecuteTransaction(msg *Message) (string, error) { // fmt.Printf("Receiving iso message: [%s] \n", tool.AsJSON(msg)) if msg.ResponseCode == RcFail { msg.ResponseCode = RcSuccess msg.ResponseMessage = "Transaksi berhasi...
package main import "fmt" func main() { b := []byte("12345678") fmt.Println(b) b[0] = b[3] copy(b, b[3:]) b = b[:(8 - 3)] fmt.Println(b) }
package recursion import ( "AlgorizmiGo/collections/sequential" "fmt" ) func StackUnwind(n int) { // Exit condition if n < 0 { return } fmt.Printf("Before recursion - %v\n", n) StackUnwind(n - 1) fmt.Printf("After recursion - %v\n", n) } var preQueue sequential.Queue = sequential.CreateQueue() var postQue...
package customers import ( "net/http" "outlet/v1/app/middleware/auth" _request "outlet/v1/app/presenter/customers/request" _response "outlet/v1/app/presenter/customers/response" "outlet/v1/bussiness/customers" "outlet/v1/helpers" "strconv" "github.com/labstack/echo/v4" ) type Presenter struct { serviceCusto...
package tunnel import ( "encoding/base64" "encoding/json" "fmt" "os" "path/filepath" "strings" "github.com/google/uuid" "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/urfave/cli/v2" "github.com/cloudflare/cloudflared/cfapi" "github.com/cloudflare/cloudflared/connection" "github.com/cloudfla...
package strings import( "rediproxy/base" ) func (t *Strings) DEL(key string) (r int32, err error){ c := base.RedisClient.Get() defer c.Close() _, err = c.Do("DEL", key) return }
package dynamo import ( "fmt" "net/http" "strconv" "github.com/Sirupsen/logrus" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" "github.com/aws/aws-sdk-go/ser...
package datetime import ( "testing" "github.com/project-flogo/core/data/expression/function" "github.com/stretchr/testify/assert" ) func init() { function.ResolveAliases() } func TestCurrentDatetime_Eval(t *testing.T) { n := CurrentDatetime{} datetime, _ := n.Eval(nil) assert.NotNil(t, datetime) } func Test...
package main import ( "fmt" "io/ioutil" "log" "os" "runtime" "strings" "github.com/disintegration/imaging" ) func resize(src string, status chan int) { if strings.HasSuffix(src, ".jpg") || strings.HasSuffix(src, ".JPG") { f, err := imaging.Open(src) if err != nil { log.Println("Open file fail! ", src)...
package entities import ( "github.com/google/uuid" "time" ) type Account struct { ID uuid.UUID `json:"id"` Name string `json:"name"` CPF string `json:"cpf"` Secret string `json:"secret"` Balance int `json:"balance"` CreatedAt time.Time `json:"created_at"` }
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func parseInput(in string) []int { arrayStr := strings.SplitN(in, " ", -1) var array = []int{} for _, i := range arrayStr { j, err := strconv.Atoi(i) if err != nil { panic(err) } array = append(array, j) } return array } func toStrin...
//go:generate go run pkg/codegen/cleanup/main.go //go:generate go run pkg/codegen/main.go //go:generate go run main.go --write-crds ./charts/rancher-operator-crd/templates/crds.yaml package main import ( "context" "fmt" "os" "github.com/rancher/rancher-operator/pkg/controllers" "github.com/rancher/rancher-opera...