text
stringlengths
11
4.05M
package mysqldb import "context" // Datastore 定义数据访问接口 type Datastore interface { // FindUserIDByToken 根据 token 返回 userID,如果token失效返回 error // TODO 以后重写,删除这个方法 FindUserIDByToken(token string) (int32, error) // FindAnalysisParams 查找分析的参数,c0-c7,gender,age,weight,height,heart_rate FindAnalysisParams(recordID int32)...
package utils import ( "net/http" "github.com/gin-gonic/gin" ) // 处理跨域请求,支持options访问 func Cors() gin.HandlerFunc { return func(c *gin.Context) { c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type,Authorization") c.Header("Access-C...
package azure_test import ( "errors" "io/ioutil" "path/filepath" "github.com/cloudfoundry/bosh-bootloader/cloudconfig/azure" "github.com/cloudfoundry/bosh-bootloader/fakes" "github.com/cloudfoundry/bosh-bootloader/storage" "github.com/cloudfoundry/bosh-bootloader/terraform" . "github.com/onsi/ginkgo" . "gith...
package main import ( "fmt" ) type Peg struct { enum int vals []int } func printTowers (A []int, B []int, C []int) { for i := cap(A) - 1; i >= 0; i-- { fmt.Printf("%v \t%v \t%v \n", A[i], B[i], C[i]) } } func isFree(towerN int, nextPeg []int) bool { /* Determines if you can move towerN to nextPeg. ...
package schema // DuoAPI represents the configuration related to Duo API. type DuoAPI struct { Disable bool `koanf:"disable" json:"disable" jsonschema:"default=false,title=Disable" jsonschema_description:"Disable the Duo API integration"` Hostname string `koanf:"hostname" json:"hostname" j...
package models import ( "github.com/gophergala2016/source/core/foundation" ) type UserFavoriteItemRepository struct { RootRepository } func NewUserFavoriteItemRepository(ctx foundation.Context) *UserFavoriteItemRepository { return &UserFavoriteItemRepository{ RootRepository: NewRootRepository(ctx), } } func (...
// Package boilingcore has types and methods useful for generating code that // acts as a fully dynamic ORM might. package boilingcore import ( "encoding/json" "fmt" "io/fs" "os" "path/filepath" "regexp" "sort" "strings" "github.com/friendsofgo/errors" "github.com/volatiletech/strmangle" "github.com/volat...
package users // User contains user accound data type User struct { ID string `json:"id,omitempty"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` Email string `json:"email"` Password string `json:"password"` }
package main import ( "fmt" "log" "strings" "github.com/s1as3r/gospotdl/download" "github.com/s1as3r/gospotdl/search" "github.com/zmb3/spotify" ) func parseArg(arg string) (string, string) { if strings.Contains(arg, "spotify.com") { url := strings.ReplaceAll(arg, "\\", "/") url = strings.TrimSuffix(url, "...
package car import ( "bytes" "context" "testing" cid "github.com/ipfs/go-cid" format "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" dstest "github.com/ipfs/go-merkledag/test" ) func assertAddNodes(t *testing.T, ds format.DAGService, nds ...format.Node) { for _, nd := range nds { if err...
package problem0628 import "sort" func maximumProduct(nums []int) int { sort.Ints(nums) n := len(nums) if nums[0] > 0 { return nums[n-1] * nums[n-2] * nums[n-3] } return max(nums[0]*nums[1]*nums[n-1], nums[n-1]*nums[n-2]*nums[n-3]) } func max(a, b int) int { if a > b { return a } return b }
package library import ( "context" "encoding/json" "errors" "fmt" goRedis "github.com/go-redis/redis" "github.com/lifenglin/micro-library/connect" "github.com/lifenglin/micro-library/helper" "github.com/sirupsen/logrus" "path/filepath" "reflect" "strconv" "time" ) type ZaddItem struct { Score float64 M...
package objects import ( "os" ) type Objects interface { // Retrieves a Blob from a given ID GetBlob(id ID) (Blob, error) // Retrieves a Tree from a given ID GetTree(id ID) (Tree, error) // Retrieves a Commit from a given ID GetCommit(id ID) (Commit, error) // Stores the given Object Store(object Object) ...
/* * Copyright (c) 2020. Ant Group. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 */ package snapshotter import ( "context" "net" "os" "path/filepath" snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1" "github.com/containerd/containerd/contrib/snapshotservice" "github...
package system import ( "ehelp/cache" "ehelp/common" "ehelp/o/order" "ehelp/o/order_hst" "ehelp/o/push_token" oAuth "ehelp/o/user/auth" "ehelp/x/fcm" "fmt" ) func canceled(ord *order.Order) { CreateOrderHst(ord.CusID, ord.ID, ord.ServiceWorks, common.ORDER_STATUS_CANCELED) } func accepted(ord *order.Order) {...
package dushengchen /** Submission: https://leetcode.com/submissions/detail/370152730/ */ func spiralOrder(matrix [][]int) []int { if len(matrix) == 0 { return []int{} } is, ie, js, je := 0, len(matrix)-1, 0, len(matrix[0])-1 istep, jstep := 0, 1 i, j := is, js ret := make([]int, len(matrix[0])*len(matrix)...
/* Copyright 2017 The Rook Authors. 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 law or agreed to ...
/* Copyright 2021. The KubeVela 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 writ...
//go:generate mockgen -package status -source=channelsolution.go -destination channelsolution_mock.go package status import ( "log" "time" ) const ( Empty = iota Joining Leaving Waving //for connectionless transports Check Remove ) var OnlineTTL = time.Duration(30) * time.Second type Responder interface { ...
package main import ( "fmt" "time" ) type Work struct { Job string Do func() } const ( CTRL_OK = 0 CTLR_QUIT = 99 ) func makeWorkQ(size int) chan Work { return make(chan Work, size) } func doWork(workQ chan Work, ctrl chan int) { for { select { case w := <-workQ: fmt.Println("Executing job ", w.J...
package 二叉树 func pathSum(root *TreeNode, targetSum int) [][]int { return getPaths(root, targetSum, nil) } // getPaths 获取根节点到叶子节点,和为 targetSum 的路径。 func getPaths(root *TreeNode, targetSum int, curPath []int) [][]int { // 1. 空树。 if root == nil { return nil } // 2. 叶子节点。 if root.Left == nil && root.Right == nil...
package main import "time" // HolderStruct holds a string value in a concurrency-safe manner // type HolderStruct interface { // Get() string // Set(string, []byte) // } type item struct { key string value interface{} } type ChanHolderStruct struct { // value *item chFlag chan *item // identify whether t...
package apitest import ( "encoding/json" "io/ioutil" "testing" gk "github.com/onsi/ginkgo" gm "github.com/onsi/gomega" ) func TestCacheAPI(t *testing.T) { gm.RegisterFailHandler(gk.Fail) gk.RunSpecs(t, "Single Key API TEST Suite") } var _ = gk.Describe("Single Key", func() { gk.Describe("Set A Key", func(...
/* Description A flow layout manager takes rectangular objects and places them in a rectangular window from left to right. If there isn't enough room in one row for an object, it is placed completely below all the objects in the first row at the left edge, where the order continues from left to right again. Given a s...
package pnet import ( "bytes" "io/ioutil" "testing" ) func TestGeneratedPSKCanBeUsed(t *testing.T) { psk, err := GenerateV1PSK() if err != nil { t.Fatal(err) } _, err = NewProtector(psk) if err != nil { t.Fatal(err) } } func TestGeneratedKeysAreDifferent(t *testing.T) { psk1, err := GenerateV1PSK() i...
package main import ( "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" "testing" ) func TestPatchHelperVolumeAdd(t *testing.T) { p := patches{} p.addVolumes(&corev1.Pod{}, []corev1.Volume{{Name: "Test"}}) assert.Equal(t, 1, len(p)) }
package gostomp import "io" type Connection struct { ssl bool sslConfig SSLConfig protocol string addr string login string password string conn io.ReadWriteCloser options ConnectionOptions server string version []string...
package fetcher import ( "fmt" "math/rand" "net/http" "bufio" "log" "io/ioutil" "crypto/sha1" "time" "strings" "golang.org/x/net/html/charset" "golang.org/x/text/encoding" "golang.org/x/text/encoding/unicode" "golang.org/x/text/transform" ) func Fetch(url string) ([]byte, error) { var t = time.Tic...
// Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // // or in the "license"...
// Copyright (c) 2020 Xiaozhe Yao & AICAMP.CO.,LTD // // This software is released under the MIT License. // https://opensource.org/licenses/MIT package utilities import "testing" func TestUncompress(t *testing.T) { type args struct { compressedFile string folderPath string } tests := []struct { name ...
package boltrepo import ( "github.com/boltdb/bolt" "github.com/scjalliance/drivestream" "github.com/scjalliance/drivestream/binpath" "github.com/scjalliance/drivestream/collection" "github.com/scjalliance/drivestream/commit" "github.com/scjalliance/drivestream/driveversion" "github.com/scjalliance/drivestream/d...
package disk import ( "os" cfg "github.com/sherifabdlnaby/prism/pkg/config" ) //config struct type config struct { Permission os.FileMode `mapstructure:"permission"` FilePath string `mapstructure:"filepath"` filepath cfg.Selector } //defaultConfig returns the default configs func defaultConfig() *conf...
// Copyright 2018 by festinalente-software. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "github.com/fsnotify/fsnotify" "github.com/spf13/viper" "golang.org/x/sys/windows/svc/debug" "os" "time" ) const s...
package endpoints // import ( // "encoding/json" // "fmt" // "github.com/roblburris/auth-login/auth" // "io/ioutil" // "log" // "net/http" // ) // func SignupEndpoint() RequestHandler { // return func(w http.ResponseWriter, r *http.Request) { // if r.Method != http.MethodPost { // ...
package basecamp import ( "encoding/json" "fmt" ) type Person struct { Id int `json:"id"` Name string `json:"name"` Email string `json:"email_address"` Admin bool `json:"admin"` Client *Client AccountId int } func (p *Person) Events() ([]*Event, error) { url := fmt.Sprintf(baseUR...
package netease import ( "log" "testing" ) func TestPlayListIntergrate(t *testing.T) { var id int64 = 22914865 pl := NewPlayList(id) err := pl.Parse() if err != nil { t.Fatal(err) } log.Println(pl) }
package fb import ( "github.com/gotang/godefs" "unsafe" ) /* #include <linux/fb.h> */ import "C" /* Definitions of frame buffers */ var( FBIO_CURSOR int FBIOGET_VBLANK int FBIO_WAITFORVSYNC int ) func init() { FBIO_CURSOR = godefs.IOWR('F', 0x08, int(unsafe.Sizeof(Fb_cursor{}))) FBIOGET_VBLAN...
package suites import ( "testing" "github.com/stretchr/testify/suite" ) type MariaDBSuite struct { *RodSuite } func NewMariaDBSuite() *MariaDBSuite { return &MariaDBSuite{ RodSuite: NewRodSuite(mariadbSuiteName), } } func (s *MariaDBSuite) Test1FAScenario() { suite.Run(s.T(), New1FAScenario()) } func (s *...
package main import "fmt" func main() { // dynamic array var fruit = []string{"Apple", "Durian", "Melon"} fruit = append(fruit, "Manggo") fmt.Println("Total Length Array : ", len(fruit)) fmt.Println("List Array : ", fruit) }
package node import ( "github.com/btcsuite/goleveldb/leveldb" "github.com/btcsuite/goleveldb/leveldb/filter" "github.com/btcsuite/goleveldb/leveldb/opt" "github.com/ethereum/go-ethereum/log" basc "github.com/hyperorchidlab/BAS/client" com "github.com/hyperorchidlab/go-miner-pool/common" "github.com/hyperorchidl...
package log_test import ( "bytes" "errors" "io" "strings" "testing" "time" "github.com/r3code/go-useful-snippets/log" ) func fakeNow() time.Time { timeNow, _ := time.Parse(time.RFC3339, "2014-11-12T11:45:26.371Z") return timeNow } func Test_Logger_Log(t *testing.T) { var buf bytes.Buffer logger := log.Ne...
package main /** 771. 宝石与石头 给定字符串 J 代表石头中宝石的类型,和字符串 S 代表你拥有的石头。 S 中每个字符代表了一种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝石。 J 中的字母不重复,J 和 S中的所有字符都是字母。字母区分大小写,因此"a"和"A"是不同类型的石头。 示例1: ``` 输入: J = "aA", S = "aAAbbbb" 输出: 3 ``` 示例2: ``` 输入: J = "z", S = "ZZ" 输出: 0 ``` 注意: - S 和 J 最多含有50个字母。 - J 中的字符不重复。 */ /** ... */ func NumJewelsInSt...
package teampasswordmanager import ( "net/http" ) // ClientConfig stores the config for the team password manager http client type ClientConfig struct { BaseURL string AuthToken string } // Client is the http client, api and auth token for team password manager type Client struct { httpClient *http.Client api...
package intf //for snippet用于标准返回值的微服务接口 import ( "context" "encoding/json" "fmt" "net/http" "github.com/davecgh/go-spew/spew" "github.com/go-kit/kit/endpoint" tran "github.com/go-kit/kit/transport/http" "github.com/vhaoran/vchat/lib/ykit" ) const ( GoodBye_HANDLER_PATH = "/GoodBye" ) type ( GoodByeServic...
package main import ( "fmt" "time" ) func sayGreetingManyTimes(s string, count int) { for i := 0; i < count; i++ { time.Sleep(1 * time.Millisecond) fmt.Println(s) } } func main() { go sayGreetingManyTimes("Hello", 10) sayGreetingManyTimes(" World ", 1) }
package helper import ( "encoding/json" "net/http" ) type Response struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` } func ResponseWithJson(w http.ResponseWriter, code int, payload interface{}) { response, _ := json.Marshal(payload) w.Header().Set("Content-T...
package dcode import ( "encoding/json" ) func String() Decoder { return func(val JSONValue) (interface{}, error) { var ret string if err := json.Unmarshal(val.data, &ret); err != nil { return nil, err } return ret, nil } }
package main import ( "errors" "fmt" ) func main() { err :=errors.New("fsdf fs ") fmt.Println(err) }
package v1alpha2 import ( "github.com/devspace-cloud/devspace/pkg/devspace/config/versions/config" "github.com/devspace-cloud/devspace/pkg/devspace/config/versions/util" next "github.com/devspace-cloud/devspace/pkg/devspace/config/versions/v1alpha3" "github.com/devspace-cloud/devspace/pkg/util/log" ) // Upgrade u...
package sqlite import ( "database/sql" "fmt" _ "github.com/mattn/go-sqlite3" "log" "github.com/Paradiesstaub/ods2sqlite/xml" "os" "strings" ) const ( dbfile = "ods2sqlite.db" // db fallback file name COLUMN_PREFIX = "c" TABLE_PREFIX = "t" ) func Write(tables []xml.Table, p string, textOnly bool) error { ...
package main import ( "fmt" ) type danton int var x danton func main() { fmt.Println(x) fmt.Printf("%T\n", x) // %T is like type() function in python x = 42 fmt.Println(x) }
package bucket import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestTokenBucket(t *testing.T) { assert := assert.New(t) t.Run("Should init the bucket with full available tokens", func(t *testing.T) { var cap int64 = 100 b := New(time.Minute, cap) defer b.Destory() assert.Equal(ca...
package build import ( "context" "github.com/devspace-cloud/devspace/pkg/devspace/build/builder" "github.com/devspace-cloud/devspace/pkg/devspace/build/builder/custom" "github.com/devspace-cloud/devspace/pkg/devspace/build/builder/docker" "github.com/devspace-cloud/devspace/pkg/devspace/build/builder/kaniko" "g...
package main import ( "fmt" "github.com/go-pg/migrations/v7" "github.com/ventuary-lab/cache-updater/src/entities" ) func init () { const TABLE_NAME = entities.BLOCKS_MAP_NAME migrations.MustRegisterTx( func(db migrations.DB) error { fmt.Printf("creating %v table...\n", TABLE_NAME) _, err := db.Exec(fm...
package models import ( "meuprojeto/db" _ "github.com/marcofilho2504/models.git" ) type produto struct { ID int Nome string Descricao string Preco float64 Quantidade int } func BuscaTodosOsProdutos() []produto { db := db.ConectaComBancoDeDados() defer db.Close() se...
package model import ( "gopkg.in/mgo.v2/bson" ) /** 用户信息 */ type User struct { UserId bson.ObjectId `json:"user_id" bson:"_id,omitempty"` // 用户唯一ID UserName string `json:"user_name" bson:"user_name"` // 用户名(不可重复) Password string `json:"-"` ...
package instruction import ( "bufio" "bytes" "io/ioutil" "strconv" "testing" "github.com/stretchr/testify/require" ) var input = []struct { data []int count int }{ {[]int{0, 3, 0, 1, -3}, 5}, } func TestCountSteps(t *testing.T) { assert := require.New(t) for _, in := range input { assert.Equal(in.coun...
package controllers import ( "encoding/json" "github.com/kataras/iris/context" "gocherry-api-gateway/admin/admin_enum" "gocherry-api-gateway/admin/models" "gocherry-api-gateway/components/common_enum" "gocherry-api-gateway/components/etcd_client" "gocherry-api-gateway/components/redis_client" "gocherry-api-gat...
package charts import ( "github.com/go-echarts/go-echarts/v2/opts" ) type Overlaper interface { overlap() MultiSeries } // XYAxis represent the X and Y axis in the rectangular coordinates. type XYAxis struct { XAxisList []opts.XAxis `json:"xaxis"` YAxisList []opts.YAxis `json:"yaxis"` } func (xy *XYAxis) initXY...
package bootiso import ( "fmt" "log" "os" "testing" ) var isoPath string = "testdata/TinyCorePure64.iso" func TestParseConfigFromISO(t *testing.T) { configOpts, err := ParseConfigFromISO(isoPath, "syslinux") if err != nil { t.Error(err) } expectedLabels := [4]string{ "Boot TinyCorePure64", "Boot TinyC...
package errors const ( Internal = "500" BadRequest = "400" NotFound = "404" ) const ( BCCSP = "CSP" MSP = "MSP" )
package main import ( "bytes" "fmt" ) /* Write a method to replace all spaces in a string with '%20. You may assume that the string has sufficient space at the end to hold the additional characters, and that you are given the "true" length of the string. */ func urlify(input string, truelength int) string { var b...
package data import ( "io" "github.com/root-gg/plik/server/common" ) // Backend interface describes methods that data backend // must implements to be compatible with Plik. type Backend interface { AddFile(file *common.File, reader io.Reader) (err error) GetFile(file *common.File) (reader io.ReadCloser, err erro...
package main import ( "context" "fmt" "os" "time" "github.com/argoproj/pkg/cli" "github.com/argoproj/pkg/errors" kubecli "github.com/argoproj/pkg/kube/cli" "github.com/argoproj/pkg/stats" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "k8s.io/client-go/kubernetes" _ "k8s.io/client-go/plugin/pkg...
package main import ( "context" "fmt" "os" "strings" "github.com/icco/cron" ) var ( log = cron.InitLogging() ) func main() { cmd := os.Args[1:] if len(cmd) < 2 || cmd[0] != "send" { fmt.Printf("Usage: $ %s send message", os.Args[0]) return } err := cron.Act(context.Background(), strings.Join(cmd[1:],...
package main import ( "log" "os" "os/signal" "syscall" ) func main() { signalChan := make(chan os.Signal) signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM) <-signalChan log.Println("Interrupt...") }
/* Copyright 2021 The KubeVela 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, so...
package reflect_db import ( "github.com/ElPeque/reflect-db/conv" "github.com/ElPeque/reflect-db/types" "fmt" "strings" ) func leafPrintPath() types.WalkCallback { return func(path []string, obj interface{}) bool { fmt.Println(strings.Join(append(path, fmt.Sprint(obj)), ".")) return true } } func leafSum(s...
// Package module provides built-in modules package module import ( "fmt" "io" "strconv" "strings" "sync/atomic" "buddin.us/eolian/dsp" "buddin.us/musictheory" ) var moduleSequence uint64 // Patcher is the patching behavior of a module type Patcher interface { Identifier PortLister Resetter io.Closer P...
package dfm_test import ( "testing" "github.com/gonutz/check" "github.com/gonutz/dfm" ) func TestBinaryDFMfilesAreNotImplemented(t *testing.T) { // Binary DFM files start with byte 0xFF. Parsing should stop right there. _, err := dfm.ParseBytes([]byte{0xFF}) check.Eq(t, err.Error(), "dfm.Parse: binary DFM file...
package util import ( "context" "database/sql" "fmt" "github.com/elgris/sqrl" "github.com/alewgbl/fdwctl/internal/database" "github.com/alewgbl/fdwctl/internal/logger" "github.com/alewgbl/fdwctl/internal/model" ) // GetExtensions returns a list of installed extensions func GetExtensions(ctx context.Context, ...
package practices import ( "github.com/stretchr/testify/assert" "testing" ) func Test_solution(t *testing.T) { tcs := []struct { N int Left int64 Right int64 Result []int }{ {3, 2, 5, []int{3, 2, 2, 3}}, {4, 7, 14, []int{4, 3, 3, 3, 4, 4, 4, 4}}, } for _, tc := range tcs { t.Run("ok", fun...
// Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in complian...
package main import ( "bufio" "fmt" "os" ) func main() { r := bufio.NewReader(os.Stdin) var T int fmt.Fscan(r, &T) for ; T > 0; T-- { var n int fmt.Fscan(r, &n) var a = make([]int, n) for i := 0; i < n; i++ { fmt.Fscan(r, &a[i]) } fmt.Println(Solve(a)) } } type Cell struct { profit int ma...
package main import "fmt" //for 是 Go 中唯一的循环结构。这里有 for 循环的三个基本使用方式。 func main() { //最常用的方式,带单个循环条件。 i := 1 for i <= 3 { fmt.Println(i) i = i + 1 } //经典的初始化/条件/后续形式 for 循环。 for j := 7; j <= 9; j++ { fmt.Println(j) } //不带条件的 for 循环将一直执行,直到在循环体内使用了 break 或者 return 来跳出循环。 for { fmt.Println("loop") break...
package manager import ( "bytes" "fmt" "image/png" "log" rice "github.com/GeertJohan/go.rice" ) func (m *Server) startUI() { m.setupTrayIcon() } func (m *Server) setupTrayIcon() { // We need either a walk.MainWindow or a walk.Dialog for their message loop. // We will not make it visible in this example, tho...
package Block import ( "fmt" "github.com/mkilic91/goBreaker/Ball" "github.com/mkilic91/goBreaker/Print" "github.com/veandco/go-sdl2/img" "github.com/veandco/go-sdl2/sdl" "math/rand" "strconv" ) const w = 50 const h = 25 type Blocks struct { blocks []*Block textures []*sdl.Texture size size } type Bl...
/* RZFeeser | Alta3 Research Sending an Email (SMTP) message */ package main import ( "log" "net/smtp" ) func main() { // Configuration from := "ilmka3spam@gmail.com" // update this to reflect your value password := "optum021" // update this to reflect your value to :=...
package main import ( "log" "os" "time" "github.com/HarryBird/cdp" "github.com/HarryBird/lantouzi-export/download" "github.com/HarryBird/lantouzi-export/export" "github.com/spf13/cobra" "github.com/spf13/viper" ) var ( logger *log.Logger ) type target struct { Url string Name string Screen bool Pa...
package quacktors import ( "errors" "fmt" "github.com/Azer0s/quacktors/typeregister" "reflect" ) func encodeValue(messageType string, value interface{}) (ret map[string]interface{}, err error) { defer func() { if r := recover(); r != nil { err = fmt.Errorf("panic while encoding value %x", r) } }() ret ...
/* Copyright 2016 The Kubernetes Authors 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 law or ag...
package models import ( "database/sql" "git.hoogi.eu/snafu/go-blog/logger" "time" ) // SQLiteUserInviteDatasource type SQLiteUserInviteDatasource struct { SQLConn *sql.DB } func (rdb *SQLiteUserInviteDatasource) List() ([]UserInvite, error) { var invites []UserInvite var ui UserInvite var u User rows, err :...
//go:generate go run ../../../hack/swagger -o swagger.json package v20191231preview
package semt import ( "encoding/xml" "github.com/thought-machine/finance-messaging/iso20022" ) type Document00500102 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:semt.005.001.02 Document"` Message *AccountingStatementOfHoldingsCancellationV02 `xml:"AcctgStmt...
package main import "fmt" func main() { a := [][]int{{2, 3}} fmt.Println(spiralOrder(a)) } func spiralOrder(matrix [][]int) []int { if len(matrix) == 0 { return []int{} } res := []int{} rowBegin := 0 rowEnd := len(matrix) - 1 colBegin := 0 colEnd := len(matrix[0]) - 1 fmt.Print(rowBegin, rowEnd, colBegin...
package remento import ( //"fmt" "github.com/fncodr/godbase" "time" ) type Rc struct { BasicRec } func NewRc(cx *Cx) *Rc { return new(Rc).Init(cx) } func (self *Rc) AvailCapac(cx *Cx, start, end time.Time) (int64, error) { capacs, err := self.Capacs(cx, start, end) if err != nil { return 0, err } retur...
package main import ( "fmt" "reflect" ) type S struct{} type T struct { S } func (S) sVal() {} func (*S) sPtr() {} func (T) tVal() {} func (*T) tPtr() {} func methodSet(I interface{}) { t := reflect.TypeOf(I) fmt.Println(t) for i, n := 0, t.NumMethod(); i < n; i++ { m := t.Method(i) fmt.Println(m.Name,...
package index import ( "net/http" "github.com/bborbe/server/renderer/body" "github.com/bborbe/server/renderer/content" "github.com/bborbe/server/renderer/html" "github.com/bborbe/server/renderer/link" "github.com/bborbe/server/renderer/list" ) type indexView struct { renderer html.HtmlRenderer } func NewInde...
package main import ( "fmt" ) type mobile struct { model string brand string release int rating int } type SEmobile struct { mobile Sfunction bool price []string } func main() { p1 := mobile{ model: "iPhone5", brand: "Apple", release: 2012, rating: 9, } p2 := SEmobile{ mobile: mobi...
package cmd import ( "bytes" "fmt" "github.com/spf13/cobra" ) var shippingClimateCmd = &cobra.Command{ Use: "shipping", Short: "Draft and create Shipping Carbon Offsets", Long: "Climate Shipping CLI enables you to draft or create carbon offsets using the Change API.", } var draftShippingTransportMethod str...
package dcmdata /** class handling one entry of the Private Tag Cache List */ type DcmPrivateTagCacheEntry struct { tagKey DcmTagKey privateCreator string } /** constructor * @param tk tag key for private creator element * @param pc private creator name, must not be NULL or empty string */ func NewDcm...
package template import ( "net/http" arthundler "github.com/firefirestyle/engine-v01/article/handler" miniprop "github.com/firefirestyle/engine-v01/prop" minisession "github.com/firefirestyle/engine-v01/session" userHandler "github.com/firefirestyle/engine-v01/user/handler" "golang.org/x/net/context" "google....
// Using the code from the previous exercise, // At the package level scope, assign the following values to the three variables // 1. for x assign 42 // 2. for y assign “James Bond” // 3. for z assign true // in func main // 1. use fmt.Sprintf to print all of the VALUES to one single string. // ASSIGN the...
/* Copyright 2019 Google LLC. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
package main import ( "fmt" "strconv" ) type ( byte int8 ByteSize int64 ) const g int = 1 const h = 'A' const ( B float64 = 1 << (iota * 10) KB MB GB ) func main() { H(1, 2, 3, 4) A() //fmt.Println(math.MinInt8) fmt.Println(b) _, _, c, d := 1, 2, 3, 4 fmt.Println(c) fmt.Println(d) var a float32 ...
package http import ( "TechnoParkDBProject/internal/app/middlware" "TechnoParkDBProject/internal/app/posts" "TechnoParkDBProject/internal/app/posts/models" "TechnoParkDBProject/internal/pkg/responses" "encoding/json" "fmt" "github.com/fasthttp/router" "github.com/valyala/fasthttp" "net/http" "strconv" "stri...
/* MIT License Copyright (c) 2021 Martin Stuckenbröker 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, pu...
// DO NOT EDIT. This file was generated by "github.com/frk/gosql". package testdata import ( "github.com/frk/gosql" ) func (q *SelectNotExistsWithWhereBlockQuery) Exec(c gosql.Conn) error { const queryString = `SELECT NOT EXISTS(SELECT 1 FROM "test_user" AS u WHERE lower(u."email") = lower($1) LIMIT 1)` // ` r...
package main import ( "fmt" "github.com/gin-gonic/gin" "net/http" ) func main() { router := gin.Default() router.GET("/", func(c *gin.Context) { query := c.Request.URL.Query() fmt.Println(query.Get("args1")) c.String(http.StatusOK, "Hello World") }) router.POST("/test", func(c *gin.Context){ var ...
package pool import ( "sync" "time" "github.com/rs/xid" ) // New Pool Server func New(size int) Pool { return &Impl{ size: size, chDone: make(chan *WorkerInfo), chQuit: make(chan struct{}), chShutdown: make(chan struct{}), chInfo: make(chan *WorkerInfo), queue: &queueImpl{}, }...