blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
60f92af38c8b9d682b6ac4b07f7f5933d37b0915 | a641413940e53c43196dd132c53939f79cf5f7d0 | aromanovich/temporal | /common/persistence/serialization/serializer.go | Go | go | 23,002 | permissive | // The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// 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 Soft... |
9d5cc418981b10c63f77e49d8d6113e48048e69b | 1aa6df9ba8393565068305e0071c38dec4dac3a6 | aojea/cluster-api-provider-aws | /pkg/cloud/services/ec2/routetables_test.go | Go | go | 5,913 | permissive | /*
Copyright 2018 The Kubernetes 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, ... |
4f6c646121e28f76cf7bbbffff7a6ea75cec35e6 | 09b8592da6784ec4abf7f0284142b2a666c1f3ea | odinlinkorg/odin | /tests/transaction_test_util.go | Go | go | 3,825 | no_license | // Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
08f7efeef56ea4fcd481402f41d23c10619d9fb1 | abc65781df60b3163313189894920f2cd58a78fb | asenlog/data-structures-and-algorithms | /algorithms/examples/binarySearch.go | Go | go | 1,211 | no_license | /**
Given an integer array nums sorted in ascending order, and an integer target.
Suppose that nums is rotated at some pivot unknown to you beforehand (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You should search for target in nums and if you found return its index, otherwise return -1.
Example 1:
Input: ... |
0dfd8fe916bdc1d55e832e6c6dbd16fd0b687dca | f6e27e1d229c5dfe082d493e82fc0afcaf373423 | xanderflood/scrapedumper | /pkg/dumper/dump.go | Go | go | 968 | no_license | package dumper
import (
"context"
"io"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"go.uber.org/zap"
)
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Dumper
type Dumper interface {
Dump(ctx context.Context, r io.Reader, path string) error
}
//go:generate g... |
9e06d042d971a46f32f35e1c6bba57db671b97d2 | 837b20436c536587172c708fb5e05d4d2a3e7a33 | cortexproject/cortex | /vendor/github.com/rs/xid/hostid_linux.go | Go | go | 264 | permissive | // +build linux
package xid
import "io/ioutil"
func readPlatformMachineID() (string, error) {
b, err := ioutil.ReadFile("/etc/machine-id")
if err != nil || len(b) == 0 {
b, err = ioutil.ReadFile("/sys/class/dmi/id/product_uuid")
}
return string(b), err
}
|
318f9fe405c5eaa7f522f7bae60d24c1dc5077fa | 743853d805c3ef83d15e01ea11d154b241f7403d | jturolla/kubernetes | /contrib/mesos/pkg/scheduler/resources/types.go | Go | go | 1,702 | permissive | /*
Copyright 2015 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... |
74ec169393c9743de9a577581307d7ed8f07e685 | 07961de21d158d0e0bbb45bcdc407f86cb2cf23d | sunshinewithmoonlight/fuchsia-2003 | /src/connectivity/network/netstack/fuchsia_net_dhcp.go | Go | go | 1,315 | permissive | // Copyright 2019 The Fuchsia 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 netstack
import (
"fmt"
"fidl/fuchsia/net/dhcp"
"gvisor.dev/gvisor/pkg/tcpip"
)
type clientImpl struct {
ns *Netstack
nicid tcpip.NICID... |
6ceff09c675546336be04a3dbb4c167e77175b17 | ac34285f68dd8fc934e053351aad4ebea7a48d61 | rbenites/ProgrammingWithGo | /ToddMcLeod_Course/types/int_float/main.go | Go | go | 230 | no_license | package main
import "fmt"
//int = whole number
//float = real numbers (has deimals)
var x int
var y float64
func main() {
x = 42
y = 42.34534
fmt.Println(x)
fmt.Println(y)
fmt.Printf("%T\n", x)
fmt.Printf("%T\n", y)
}
|
bfa5863e040ecbd1f55f1a89d83c95a810d1da1a | 74242761e32c91ec28deb89439a53a7a935f4e7a | monpro/go-microservices | /blog-service/internal/service/article.go | Go | go | 1,427 | no_license | package service
type ArticleRequest struct {
ID uint32 `form:id binding:"required,gte=1"`
State uint8 `form:"state,default=1" binding:"oneof=0 1"`
}
type ArticleListRequest struct {
TagID uint32 `form:"tag_id" binding:"gte=1"`
State uint8 `form:"state,default=1" binding:"oneof= 0 1"`
}
type CreateArticleReque... |
341375c9a9cba81ba1a26158aad656c9bf2bf7f8 | 5487aba2e3439382bcd61d015e1a1c609efb1d74 | u2takey/junit2html | /main.go | Go | go | 3,178 | no_license | package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"sync/atomic"
"time"
"github.com/spf13/pflag"
)
var (
// todo implement textMatrix/htmlMatrix/mergeOuput
// textMatrix = pflag.Bool("summary-matrix", false, "Render multiple result files to the console")
// htmlMatrix = pflag.String(... |
ba8d67f27b25d361ea6214009a9b9fa4252b2434 | 55559b95a8a1ffbffec61f3b80ac5bddbbc58031 | msau42/test-infra | /prow/plugins/milestonestatus/milestonestatus.go | Go | go | 2,998 | permissive | /*
Copyright 2017 The Kubernetes 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, ... |
cc0e485cfde64fbd8ad558cdbecf16aae0c4c312 | e4f18ba34e30b51a0166918dfe68949d57321b29 | GEO-Protocol/Observer | /core/common/types/hash/hash.go | Go | go | 1,019 | no_license | package hash
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"geo-observers-blockchain/core/common/errors"
)
const (
BytesSize = 32
)
// todo: replace by sha256 by blake2b 512
// todo: add project specific salt
// todo: think about custom round-specific salt,
// to prevent usage or pre generated hash tabl... |
3a0d59c7257775f6c5feff05b48a281790d88d3f | 435c72f5235213186cfe384ffb5cd6572ca2641f | xuchongfeng/practice | /golang/sort.go | Go | go | 206 | no_license | package main
import "fmt"
import "sort"
func main() {
str := []string{"a", "c", "b"}
sort.Strings(str)
fmt.Println(str)
ints := []int{1,5,3,2}
sort.Ints(ints)
fmt.Println(ints)
}
|
3149f63de9a5f399a96db928b670bb59564ce0f4 | c37a998d3019819d7087b787f7278e0bbaad1783 | CooperXJ/go | /src/file/main.go | Go | go | 1,325 | no_license | package main
import (
"fmt"
"os"
"io"
"io/ioutil"
"bufio"
)
func copyFile(srcFile string,destFile string) (written int64,err error) {
file1,_:=os.OpenFile(srcFile,os.O_RDONLY,1)
reader:=bufio.NewReader(file1)
defer file1.Close()
file2,_:=os.OpenFile(destFile,os.O_WRONLY|os.O_CREATE,777)
writer:=bufio.NewWr... |
c361b77d0bc440d9b39968396d2eeaf6d1ea6c30 | 688a314b50c98515ba1e2c60b8c273552c042875 | puppetlabs/relay-core | /pkg/manager/specadapter/parameter.go | Go | go | 1,005 | permissive | package specadapter
import (
"context"
"github.com/puppetlabs/relay-core/pkg/model"
"github.com/puppetlabs/relay-core/pkg/spec"
)
type ParameterTypeResolver struct {
m model.ParameterGetterManager
}
var _ spec.ParameterTypeResolver = &ParameterTypeResolver{}
func (ptr *ParameterTypeResolver) ResolveAllParamete... |
f7901704b755451573b0169230fe8b2dbb451c0a | f01f8f237291eb47d523111a7b8f14f88b3576c1 | liuxuc63/k3s | /vendor/k8s.io/kubernetes/pkg/kubelet/apis/config/types.go | Go | go | 21,016 | permissive | /*
Copyright 2015 The Kubernetes 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, ... |
0fcf39b17947a6c8bbb87283653763e222635a1d | c295bc0257520948ffffb38212dadd89d33ae9f9 | boshuzhang/goweb | /src/runtime/defs_linux_arm64.go | Go | go | 3,262 | permissive | // Created by cgo -cdefs and converted (by hand) to Go
// ../cmd/cgo/cgo -cdefs defs_linux.go defs1_linux.go defs2_linux.go
package runtime
const (
_EINTR = 0x4
_EAGAIN = 0xb
_ENOMEM = 0xc
_PROT_NONE = 0x0
_PROT_READ = 0x1
_PROT_WRITE = 0x2
_PROT_EXEC = 0x4
_MAP_ANON = 0x20
_MAP_PRIVATE = 0x2
_MAP_... |
d03edeeacd962dd791bb132196ae0fcf8d8b139e | ab6d7bc6debe8e5ba1ece909a29070c055fb67e2 | mibes/redisearch-go | /redisearch/client.go | Go | go | 12,196 | permissive | package redisearch
import (
"errors"
"fmt"
"reflect"
"strconv"
"strings"
"log"
"github.com/garyburd/redigo/redis"
)
// Options are flags passed to the the abstract Index call, which receives them as interface{}, allowing
// for implementation specific options
type Options struct {
// If set, we will not sa... |
bbc8dfcb960907b55ed3d542dc064b825775f406 | 316f1f9b5e1c42bb59a52e5b892623c1dde00958 | caos/orbos | /cmd/chore/e2e/run/downscale.go | Go | go | 750 | permissive | package main
import (
"context"
"fmt"
"time"
)
var _ testFunc = downscale
func downscale(_ *testSpecs, settings programSettings, conditions *conditions) interactFunc {
// assignments must be done also when test is skipped
conditions.kubernetes.ControlPlane.Nodes = 1
conditions.kubernetes.Workers[0].Nodes = 1
... |
2d95b73371f4e0a3a31107c9cf9f1c8947b4a7ba | b42ffd686906e251c5f8fc5ee649e60fc47968c7 | awagelight/sqlboiler | /drivers/sqlboiler-mysql/driver/mysql.go | Go | go | 15,041 | permissive | package driver
import (
"database/sql"
"encoding/base64"
"fmt"
"strconv"
"strings"
"github.com/go-sql-driver/mysql"
"github.com/pkg/errors"
"github.com/thrasher-corp/sqlboiler/drivers"
"github.com/thrasher-corp/sqlboiler/importers"
)
func init() {
drivers.RegisterFromInit("mysql", &MySQLDriver{})
}
//go:g... |
7990b38d55af439650a59be1effa8ed4639bfb2c | 784ffb93c3969ad961bd0d70a3c1d75bda71b548 | jerry-enebeli/evans | /fill/silent_filler.go | Go | go | 897 | permissive | package fill
import (
"encoding/json"
"io"
"github.com/pkg/errors"
)
// SilentFilter is a Filler implementation that doesn't behave interactive actions.
type SilentFiller struct {
dec *json.Decoder
}
// NewSilentFiller receives input as io.Reader and returns an instance of SilentFiller.
func NewSilentFiller(in ... |
ff50c5d32f6bc701d8e417152393f1a5b3cc7efd | 4bec907af856c840547768bf9924d8f9c358bf5b | irwinai/xweb | /examples/logger.go | Go | go | 448 | permissive | package main
import (
"log"
"os"
"github.com/lunny/xweb"
)
type MainAction struct {
*xweb.Action
hello xweb.Mapper `xweb:"/(.*)"`
}
func (c *MainAction) Hello(world string) {
c.Write("hello %v", world)
}
func main() {
f, err := os.Create("server.log")
if err != nil {
println(err.Error())
return
}
lo... |
22eedb01c0bd732e8c8f9f60a524d7f28f644c7a | d189daa5ca08dfcac2a999f8b6594a0ed1f9481b | j-s-volkova/tasks-for-rbs | /Задание 2 Этап 1/application.go | Go | go | 2,545 | no_license | package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"time"
)
func main() {
// чтение аргументов
var datafile *string
datafile = flag.String("datafile", "./indications.json", `Path to datafile. Default: "./indications.json"`)
flag.Parse()
log.Printf("Datafile: %s\n", *datafile)
/... |
bc3a843224e18a32df10dc0bc9778b195e8c4bad | 2dac1bec719b8dacc791d8261fdb6e1205b37ee9 | carloscarcamo/go-algocasts | /algo/largest_number.go | Go | go | 698 | permissive | package algo
import "sort"
import "strconv"
import "strings"
// https://leetcode.com/problems/largest-number/
func compareNumber(a int, b int) bool {
// number to string
str1 := strconv.Itoa(a)
str2 := strconv.Itoa(b)
c1 := str1[0]
c2 := str2[0]
if c1 == c2 {
s1 := str1 + str2
s2 := str2 + str1
return ... |
2d7df6fadabd34a06ab5121fb51b1e9d68adf10c | ae05144fee21548d931b08e61a0038eec942e9f5 | sueannioanis/google-api-go-client | /datastore/v1beta3/datastore-gen.go | Go | go | 128,530 | permissive | // Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package datastore provides access to the Cloud Datastore API.
//
// This package is DEPRECATED. Use package cloud.google.com/go/datastore instea... |
8fb4c6da04e967f7d1bca9dc414dc8065dbec6b2 | 81f6dc04b403014262475ac7a46a7c41647b7d85 | elliotforbes/go-face-recognition | /main.go | Go | go | 1,010 | no_license | package main
import (
"fmt"
"github.com/elliotforbes/go-face-recognition/pkg/histogram"
"github.com/elliotforbes/go-face-recognition/pkg/utils"
)
const testdir = "testdata"
func getHistogram(pathname string) (histogram.Histogram, error) {
myImage, err := utils.LoadImage(pathname)
if err != nil {
fmt.Println(... |
acace3377582e153bca38398601ebaf307d2e6fc | c54be3e4b7a1a000f679f2984966142cfc7bb8ea | cuijxin/minikube | /pkg/minikube/config/types.go | Go | go | 5,246 | permissive | /*
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... |
6bb02e3e37c8add7ab9bf766b38babb869bd5820 | ca8f781eec8b675b2dbbc246ba70327dc9b50e74 | erwiese/go-common | /fileutils/misc.go | Go | go | 3,150 | permissive | package fileutils
import (
"bufio"
"bytes"
"crypto/md5"
"encoding/hex"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
)
// Exists returns true if the file or directory exists, otherwise false.
func Exists(path string) bool {
if _, err := os.Stat(path); os.IsNotExist(err) {
return false
}
return true
//inf... |
8d8c154174975b84a6d3112d8ad18346549de49d | 67a00d21454dc5e2643a2d625aac832f18641205 | ch629/mage | /internal/project/module.go | Go | go | 532 | no_license | package project
import (
"bufio"
"os"
"strings"
"sync"
)
var (
modInit sync.Once
modName string
)
const (
modulePrefix = "module "
)
// ModuleName gets the name of the module based on go.mod
func ModuleName() (string, error) {
var err error
modInit.Do(func() {
var modFile *os.File
if modFile, err = os.... |
2b4f9585a3393a6b20346a26599650b1e34210af | 39cbc9465e4f6da719310114ddf6b16474db60f0 | gutrse3321/aki-gateway | /route/EntryRoute.go | Go | go | 825 | permissive | package route
import (
"akigate/reverseProxy"
"akigate/util"
"github.com/gin-gonic/gin"
"net/http"
)
/**
* @Author: Tomonori
* @Date: 2020/6/18 17:21
* @Title:
* --- --- ---
* @Desc:
*/
type Entry struct {
rp *reverseProxy.ReverseProxy
rm *RoutesMap
}
func NewEntry(rp *reverseProxy.ReverseProxy, rm *Rout... |
68b9319aebb8c61bf58ffb3314e36954bdb1669e | 6a4c02d85fef956c4fffb1281b19eb6efdafe0ca | devopsmi/gcd | /gcdapi/indexeddb.go | Go | go | 11,090 | permissive | // AUTO-GENERATED Chrome Remote Debugger Protocol API Client
// This file contains IndexedDB functionality.
// API Version: 1.2
package gcdapi
import (
"encoding/json"
"github.com/wirepair/gcd/gcdmessage"
)
// Database with an array of object stores.
type IndexedDBDatabaseWithObjectStores struct {
Name st... |
5d903eac77cb70fd3ec7ada141c4b4b8e135c010 | 6e02b54205070f9a067846b08d62107cdbca1138 | morrell/pulumi-azure-native | /sdk/go/azure/documentdb/v20151106/databaseAccountGremlinGraph.go | Go | go | 11,081 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20151106
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// An Azure Cosmos DB Gremlin graph.
typ... |
8b02adc7ee82c20d27289ef8d1dc65bf8cdf795e | 1d7cc42da011a510112d41e2fbc974f972c314ea | AnupamKSingh/GolangPractice | /Practice/netlink.go | Go | go | 2,107 | no_license | // +build linux,386 darwin,amd64 ,!cgo
package main
import (
"fmt"
"syscall"
)
func main() {
l, _ := ListenNetlink()
for {
msgs, err := l.ReadMsgs()
if err != nil {
fmt.Println("Could not read netlink: %s", err)
}
for _, m := range msgs {
if Is... |
f0841e51204104c8bcdca64f46121dad71588b04 | d1ffada9569bd0065a267ba3ce79cce8999c4c93 | aukbit/twilio-go | /vendor/github.com/paulormart/assert/assert.go | Go | go | 1,145 | permissive | // Assert
// ideas borrowed from https://github.com/stretchr/testify
package assert
import (
"fmt"
"reflect"
"runtime"
"strings"
"testing"
)
// getTestFile identifies the test file that has been called highlighting the line
// Note: we assume a go test file always ends as _test.go
func getTestFile() string {
fo... |
6869be4a7f7034095c995d97e7acfbf4721fb37e | 4712a20185fdca3626432e6f75b1cce4939254bf | qyzxcswbll/cosmos-sdk | /x/auth/types/amino_signing.go | Go | go | 1,480 | permissive | package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
)
// stdTxSignModeHandler is a SignModeHandler that handles SIGN_MODE_LEGACY_AMINO_JSON
type stdTxSignModeHandler struct{}
func NewStdT... |
c1e6aed71557a4ea852fb644f83bbad8208e67d8 | d48b0352397ce056606e3e7b70c0d3d9bfbb2edf | yang304316187/demogo | /routers/api/auth.go | Go | go | 1,026 | no_license | package api
import (
"demogo/models"
"demogo/pkg/e"
"demogo/pkg/util"
"github.com/astaxie/beego/validation"
"github.com/gin-gonic/gin"
"log"
"net/http"
)
type auth struct {
Username string `valid:"Required; MaxSize(50)"`
Password string `valid:"Required; MaxSize(50)"`
}
func GetAuth(c *gin.Context) {
usern... |
bf9dd582fe02e5d0d59c5275b33f62c626c4afb1 | 57c61fd332b3d7a75ba3925ff06d0a3f18b8e879 | grammes-go/grammes | /query/traversal/aggregate.go | Go | go | 1,652 | permissive | // Copyright (c) 2018 Northwestern Mutual.
//
// 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, p... |
65f1aa1b5e6ff3755dcc8a80078a1affe06b8411 | b12e9eedc9081e0d7de4a271bcc8b4048564615c | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/customerinsights/v20170101/pulumiEnums.go | Go | go | 13,105 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20170101
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The calculation window.
type CalculationWindowTypes pulumi.Str... |
2a7adae673c04d4a0734c528035cba46d04755e7 | e35846b12861bbfc933ef18016ef16c97906b00f | openshift/installer | /vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/agentclusterinstall_types.go | Go | go | 20,234 | permissive | package v1beta1
import (
"github.com/openshift/assisted-service/api/common"
hivev1 "github.com/openshift/hive/apis/hive/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
ClusterSpecSyncedCondition string = "SpecSynced"
ClusterCompletedCondition string = hivev1.ClusterInsta... |
70799a07f05e9d903dc33e8e1877b8badb2ca38b | d41abfb85367030ffcd4dfc628c9e0a50968b8de | eacevedof/prj_go | /curso-udemy/26/main.go | Go | go | 390 | no_license | //tipo string parte 2
package main
import "fmt"
func main() {
s1 := "hola mundo"
s2 := `Esta es una
linea partida`
fmt.Println(s1)
fmt.Printf("T de s1:%T\n",s1)
fmt.Println(s2)
fmt.Printf("T de s2:%T\n",s2)
fmt.Println()
bs := []byte(s1)
fmt.Println(bs)
fmt.Printf("T de byte: %T\n", bs)
fmt.Println(""... |
d8f1fa3b34770a4908345cf5c52823dd0dffbee8 | 59fcdc999e26e73aa27d0703b9ba0036bda97257 | thanhnguyen2187/amber | /backend-golang/data/bikemodel/find_one.go | Go | go | 670 | no_license | package bikemodel
import (
"amber-backend/core/db"
"amber-backend/model"
"github.com/doug-martin/goqu/v9"
)
func generateGetDataQuery(
id int,
) (
string,
error,
) {
dialect := goqu.Dialect("mysql")
d := dialect.
Select("model_data").
From("bike_model").
Where(
goqu.C("id").Eq(id),
)
query, _, err... |
724628cc31bd2489b9711a682991c10e0b80a05f | f165993092965e884c88b285fe507c4f8a02e992 | cisordeng/beego | /xenon/context.go | Go | go | 474 | permissive | package xenon
import (
"context"
"github.com/cisordeng/beego"
"github.com/cisordeng/beego/orm"
)
func newContextWithOrm() context.Context {
dbUsed, _ := beego.AppConfig.Bool("db::DB_USED")
if !dbUsed {
return nil
}
bContext := context.Background()
bContext = context.WithValue(bContext, "orm", orm.NewOrm())... |
bd1de6cc039e651bfad7e69f2dc9369a047fb9e6 | 08c202c9774acce87586bf099b5cfe9f45e858dc | bpkgoud/pulumi-azure-native | /sdk/go/azure/sql/getInstancePool.go | Go | go | 1,008 | permissive |
package sql
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupInstancePool(ctx *pulumi.Context, args *LookupInstancePoolArgs, opts ...pulumi.InvokeOption) (*LookupInstancePoolResult, error) {
var rv LookupInstancePoolResult
err := ctx.Invoke("azure-native:sql:getInstancePool", args, &rv, opts...... |
7cfedc37ddf90515f2a91ea8bbc9c9300c3c399a | 4abb15f5d774995b97c116c0a6268bca0abe81d4 | bron10/parking-lot | /packages/constants.go | Go | go | 792 | no_license | package packages
//Commands
const CREATE_LOTS string = "Create_parking_lot"
const PARK string = "Park"
const GET_SLOT_NUM_DRIVER_AGE string = "Slot_numbers_for_driver_of_age"
const GET_SLOT_NUM_CAR_NUM string = "Slot_number_for_car_with_number"
const LEAVE_LOT string = "Leave"
const GET_VEHICLE_REG_NUM_DRIVER_AGE stri... |
73cf844efd2398e74a432bc83c2bbc4b6701ce2a | e60e441c7ab679afbf7f2f2120d61d6ce8b2ad99 | Codeberg-org/gitea | /models/repo_language_stats.go | Go | go | 5,415 | permissive | // Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package models
import (
"math"
"strings"
"code.gitea.io/gitea/modules/timeutil"
"github.com/go-enry/go-enry/v2"
)
// LanguageStat describes language ... |
a1b141cc5e5cad0cc44e840b44d10a7a9eda1537 | 14991edf65105c979ca1cf80b7d9acd75377a292 | JackDanger/p2 | /pkg/rc/fields/fields.go | Go | go | 3,730 | permissive | package fields
import (
"encoding/json"
"sort"
"k8s.io/kubernetes/pkg/labels"
"github.com/square/p2/pkg/manifest"
)
// ID is a named type alias for Resource Controller IDs. This is preferred to the raw
// string format so that Go will typecheck its uses.
type ID string
// String implements fmt.Stringer
func (i... |
efe957ede3cc08b1c1a7fd245927084498527a36 | d113708b2dbc670cae63185fa4ce23f21774d1fd | ManchersterByTheSea/openBilibili | /go-common/app/interface/main/activity/service/like/subject_test.go | Go | go | 1,880 | no_license | package like
import (
"context"
"testing"
"time"
"go-common/app/interface/main/activity/model/like"
. "github.com/smartystreets/goconvey/convey"
)
func TestService_SubjectInitialize(t *testing.T) {
Convey("should return without err", t, WithService(func(svf *Service) {
err := svf.SubjectInitialize(context.B... |
c44bc81d918bc7886905754659925d3e3f3de907 | b0bcffb1625376f78aa24899c4bee031b49efbdb | slider2007/plancoin-test | /7-august-2020/plan-master/x/structure/handler.go | Go | go | 562 | no_license | package structure
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// NewHandler creates an sdk.Handler for all the structure type messages
func NewHandler(k Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
ctx... |
205bcc141f9b61a10034ca705562d9fdcf16c425 | 60ccf9e7346504fd902ef815bf3aa39b371f3ee8 | huzichunjohn/goinaction | /demo-grpc/api/handler.go | Go | go | 359 | no_license | package api
import (
"log"
context "golang.org/x/net/context"
)
// Server represents the gRPC server
type Server struct {
}
// SayHello generates response to a Ping request
func (s *Server) SayHello(ctx context.Context, in *PingMessage) (*PingMessage, error) {
log.Printf("Receive message %s", in.Greeting)
retur... |
9bfc7ba3fc690b13e3e7aa398a356c1dd93aeb17 | f68cd7481a615a0b0d0c2197bd93ba5ac0bd5655 | jcw123/design-pattern | /docs/other/language/go/实践/web框架搭建/jcw/router_test.go | Go | go | 1,754 | permissive | package jcw
import (
"fmt"
"reflect"
"testing"
)
func newTestRouter() *router {
r := newRouter()
r.addRoute("GET", "/", nil)
r.addRoute("GET", "/hello/:name", nil)
r.addRoute("GET", "/hello/b/c", nil)
r.addRoute("GET", "/hi/:name", nil)
r.addRoute("GET", "/assets/*filepath", nil)
return r
}
func TestParseP... |
d870a79a7ee68532c3ccbf4014c32ee6f5fdfafe | 03b0dabc41a3a9641245b21c8047737ec4f728c1 | jhontea/go-kbs | /problem2/handlers/rest/team_rest.go | Go | go | 1,465 | no_license | package rest
import (
"context"
"encoding/json"
"net/http"
"strings"
"go-kbs-soccer/entities/models"
"go-kbs-soccer/entities/responses"
"go-kbs-soccer/services"
)
type TeamRestHandler struct {
service services.TeamService
}
func NewTeamRestHandler(service services.TeamService) *TeamRestHandler {
return &Te... |
9871c878385966b57b5d816b456a1ab2fb4738a2 | f609e0b653e86945ac5a8717b792dd482fffcc25 | lwl-soft-go/g | /cli/cli.go | Go | go | 3,291 | permissive | package cli
import (
"fmt"
"io"
"os"
"path/filepath"
"sort"
"strings"
"github.com/Masterminds/semver"
"github.com/fatih/color"
"github.com/urfave/cli"
"github.com/voidint/g/build"
)
var (
ghomeDir string
downloadsDir string
versionsDir string
goroot string
)
// Run 运行g命令行
func Run() {
app ... |
e629e138ce01109eeec4f02cd5d48576bb736aff | e1f2a9ab632768657dac96260bf73bf0c6bcf6db | GaoHuijian/tidb | /expression/aggregation.go | Go | go | 15,699 | permissive | // Copyright 2016 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... |
1603ccee467f07454de0f939bf8b82d2657fe03e | 4bc739c965dd0223b7cf2de1b8a2a7a4d153e8a2 | pabloluceroschneider/golang-quickstart | /hello/hello.go | Go | go | 613 | no_license | package main
import (
"fmt"
"log"
"example.com/greetings"
)
func main() {
// Set properties of the predefined Logger, including
// the log entry prefix and a flag to disable printing
// the time, source file, and line number.
log.SetPrefix("greetings: ")
log.SetFlags(0)
names := []string{"Pablo", "Daniel"}... |
69be5fcdf32cdd7e279901acfc3951f6b166577d | a8cee5c4aab7ee92e1577344e4a6eae2d9d82a31 | smartems/smartems | /pkg/models/user.go | Go | go | 5,362 | permissive | package models
import (
"errors"
"time"
)
// Typed errors
var (
ErrUserNotFound = errors.New("User not found")
ErrLastGrafanaAdmin = errors.New("Cannot remove last smartems admin")
)
type Password string
func (p Password) IsWeak() bool {
return len(p) <= 4
}
type User struct {
Id int64
Versio... |
921267896acc84bef8336de43f497ca6bd071c3d | 26a0c7b9c1e5db445e1c8c77fb7fea5310a015d7 | tvtu2105/demo | /app.go | Go | go | 3,016 | no_license | package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"demo/model"
"github.com/go-redis/redis"
"github.com/gorilla/mux"
)
func indexHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Welcome! Hello VTTC. direc to '/quote' get g... |
0cfc039c99f89cf846859bad307159bd8ad1476c | 5dc7d7374edd934a4c1200eeeaae1fd8288207b3 | ciscomancer/slappd | /internal/untappd/info.go | Go | go | 1,290 | permissive | package untappd
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"github.com/pkg/errors"
)
// InfoResponse defines the shape of the response from the UntappdAPI /v4/beer/info/:beerID endpoint
type InfoResponse struct {
Response struct {
Beer *Beer `json:"beer"`
} `json:"response"`
}
// Title produces a ... |
170fd7abf75c0765f22855d738c52a137d512ef5 | 52915cf11c382f9cc448cf2b6ce40ef14e008a27 | sql-machine-learning/sqlflow | /go/modelzooserver/add_default_model_defs.go | Go | go | 2,430 | permissive | // Copyright 2020 The SQLFlow 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 applicab... |
7f84e2a48a21ab672d42858272f6deebc657a3f3 | 5043f6bcb7248ff9622a8399a51238a7e1ceea64 | riyadennis/goophercises | /form/main.go | Go | go | 376 | no_license | package main
import (
"fmt"
"github.com/gorilla/schema"
)
type Person struct {
fname string
lname string
email string
mobile string
}
func main() {
var decoder = schema.NewDecoder()
persons := make(map[string][]string)
var p = make(map[string][]*Person)
persons["employees"] = []string{
"22",
"eee",... |
24e2dac0f89c08c3dc79cf266cae226ab43a1672 | 3f493ee0a04f0ca830332359f59abe3c790181e8 | nmpacheco/tact | /types.go | Go | go | 1,746 | permissive | package tact
import "context"
// Session carries the configuration and logging context
type Session interface {
Name() string // Return this session name
Node() *Node // Return this session node config
Context() context.Context //... |
38a58fa94f0a37b32aec32e55d3d3141a3a84f6e | 6bb93c9a52b86e5fc06991e7380a5cacf81d5be9 | sjanulonoks/daos | /src/control/server/ctl_storage_rpc_test.go | Go | go | 25,725 | permissive | //
// (C) Copyright 2019-2020 Intel Corporation.
//
// 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... |
76306a0e7311922b88522a555fdfd348e1f094fe | 80b4c527ced3545569dce07631c3f9a77f9098dd | maxperrimond/kensho | /constraint.go | Go | go | 1,168 | permissive | package kensho
type (
ConstraintArgs struct {
Root interface{}
Subject interface{}
Value interface{}
Arg interface{}
}
Constraint func(ctx *ValidationContext) error
CustomConstraint struct {
Name string
Constraint Constraint
}
)
var defaultConstraints = map[string]Constraint{
"valid... |
1d6e8c3ec912e216b815025ac2bb071c1e0cee8f | 82ab022a708cbd9e4afcd52c25c33af78631fc9e | stensonb/fraterdocker | /vendor/github.com/docker/docker/vendor/golang.org/x/net/trace/trace.go | Go | go | 27,200 | permissive | // Copyright 2015 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 trace implements tracing of requests and long-lived objects.
It exports HTTP interfaces on /debug/requests and /debug/events.
A trace.Trace provides... |
62782e11a7e78a4af668d67d7fe69610f1ade4c0 | 12067224fed85b1fed7e2098932751043f607569 | im-kulikov/potter | /vendor/github.com/im-kulikov/helium/web/format.go | Go | go | 3,668 | permissive | package web
import (
"fmt"
"net/http"
"reflect"
"strings"
"github.com/labstack/echo"
"gopkg.in/go-playground/validator.v9"
)
type tagParser = func(tag reflect.StructTag) string
var _ = AddTagParsers
var options = []tagParser{
// Parse json-tag
func(tag reflect.StructTag) string {
val := tag.Get("json")
... |
870189bc14ae803f239a9409d39dc7a8bd6e89a5 | f178f8447a9fbfb571a0fe01cdfa2b742da4e563 | Cagrosso/OauthPlayground | /server/server.go | Go | go | 292 | no_license | package server
import (
"github.com/gorilla/mux"
)
// CreateRouter creates the routes for the server
func CreateRouter() {
router := mux.NewRouter()
router.HandleFunc("/", indexHandler)
router.HandleFunc("/welcome.html", welcomeHandler)
router.HandleFunc("/headers", headersHandler)
}
|
b9f63828571cd0518d63468ea6d931073fd47d7a | e2260e89b4ced3fc3732e26ee19677fa23eaee61 | xa-Amour/local_go | /algorithm/simple/tencent.go | Go | go | 4,945 | no_license | package simple
import (
"fmt"
"math/rand"
"time"
)
//https://leetcode-cn.com/problems/reverse-linked-list/
func (*Ref)RLL() {
head := &ListNode{Val:1,Next:&ListNode{Val:2,Next:&ListNode{Val:3}}}
var prev *ListNode
curr := head
for curr != nil {
next := curr.Next
curr.Next = prev
prev = curr... |
bbecd5832dec6e386cd26654834ec362a4873ade | fa72570c65fc1ad5cd1bcbd20630bbce819f766c | lparth/vanilla | /httpx/tree_test.go | Go | go | 15,699 | permissive | // Copyright 2013 Julien Schmidt. All rights reserved.
// Based on the path package, Copyright 2009 The Go Authors.
// Use of this source code is governed by a BSD-style license.
//
// Modifications by Kevin Stenerson for Reflexion Health Inc. Copyright 2016
package httpx
import (
"fmt"
"net/http"
"reflect"
"stri... |
d9229db6f1ebeb6d4e1c6d29d0e1f1835fbb6539 | 9884d997c5f2b2ffdb366f745394bfa0ae7f1348 | cryptoinhero/watchmarket | /docs/docs.go | Go | go | 20,917 | no_license | // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"descripti... |
a7965f9f480c300174afc5907a77742449f110af | 30723ded90e448fc3d0da507a7036340f029cdfb | shrikar007/api-github | /app/jobscheduler/schedule.go | Go | go | 725 | no_license | package jobscheduler
import (
"github.com/spf13/viper"
"gopkg.in/robfig/cron.v2"
"net/http"
)
func Curlresquest1() {
url := viper.GetString("app.schedule_url")
req, _ := http.NewRequest("GET", url, nil)
_, _ = http.DefaultClient.Do(req)
}
func Curlresquest2() {
url := viper.GetString("app.schedule_url")
req, ... |
10feba524273bb0694322b848738e72389dea643 | 6c5bc0d99b43f7020fd0f41b00ca7f548db18ddc | sheigel/acs-engine | /cmd/deploy.go | Go | go | 10,439 | permissive | package cmd
import (
"fmt"
"io/ioutil"
"math/rand"
"os"
"path"
"strconv"
"time"
"github.com/leonelquinteros/gotext"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"encoding/json"
"github.com/Azure/acs-engine/pkg/acsengine"
"github.com/Azure/acs-engine/pkg/acsengine/transform"
"github.com/Az... |
8517d783a1615de2cfad9c103cd76c4415504fb5 | 868b675eec011cffe292252c44ab4f684ba58c30 | Gibby/parsec-ec2 | /cmd/stop.go | Go | go | 2,390 | permissive | // Copyright © 2017 Jade Iqbal <jadeiqbal@fastmail.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 required by appli... |
5e92c3b2aae0bff6367d766b6fb66079f47324ef | d752f130ee4437b8741de12090eacc34f5974939 | phpyandong/opentaobao | /model/fenxiao/ProductSkuDo.go | Go | go | 1,551 | permissive | package fenxiao
// ProductSkuDo
type ProductSkuDo struct {
// 关联的前端宝贝skuid
AuctionSkuId int64 `json:"auction_sku_id,omitempty" xml:"auction_sku_id,omitempty"`
// sku的销售属性组合字符串。格式:pid:vid;pid:vid,如:1627207:3232483;1630696:3284570,表示:机身颜色:军绿色;手机套餐:一电一充。
Properties string `json:"prop... |
b84c0be712411abf03f99442804bdad57ed8fd75 | ae72f1b29e6a190be5e8ef60295793e2d4d896be | boxtown/verto | /mux/group_test.go | Go | go | 5,620 | permissive | package mux
import (
"net/http"
"testing"
)
func TestGroupAdd(t *testing.T) {
defer func() {
err := recover()
if err != nil {
t.Errorf(err.(error).Error())
}
}()
err := "Failed group add"
tVal := ""
h1 := http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
tVal = "A"
},
)
h2 :=... |
ed56e6b813480c036e843cd6fa4dc11037ffaf1f | 02ecb2ae3b9f9742b6d02d0b4711f770949c594c | scholzj/kubernetes | /pkg/kubectl/cmd/resource/get_test.go | Go | go | 40,728 | permissive | /*
Copyright 2014 The Kubernetes 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, ... |
961f05281b324779e174a30f348853a3072c2704 | ee8078b9252f61dcfe8ea67c2ff6d2b28a53d4fd | goradd/goradd | /pkg/bootstrap/control/navbar.go | Go | go | 7,396 | permissive | package control
import (
"context"
"github.com/goradd/goradd/pkg/bootstrap/config"
"github.com/goradd/goradd/pkg/javascript"
"github.com/goradd/goradd/pkg/page"
"github.com/goradd/goradd/pkg/page/action"
"github.com/goradd/goradd/pkg/page/event"
"github.com/goradd/html5tag"
)
const (
NavTabs = "nav-tabs"... |
626799a2dc324a376ba046549d078b5203530bfb | c99891dae6d6545074d8e6e2d57139b3744cb5c5 | wchh/plugin | /plugin/dapp/evm/executor/vm/state/interface.go | Go | go | 3,269 | permissive | // Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package state
import (
"github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common"
"github.com/33cn/plugin/plugin/dapp/evm/exe... |
c6184c237565e1b9af821d399a0bfced2846e3bc | 97705e2c8d62887dd45dfcfa88ac54e8bb6e4558 | andrewsomething/doctl | /integration/droplet_neighbors_test.go | Go | go | 4,034 | permissive | package integration
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/http/httputil"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"github.com/sclevine/spec"
"github.com/stretchr/testify/require"
)
var _ = suite("compute/droplet/neighbors", func(t *testing.T, when spec.G, it spec.S) {
... |
5cde89f8719bda2bf192652dd860ee96a03ea294 | f97111970d90af362904c22919e93234d6c5441d | tomdee/plugins | /plugins/main/bridge/bridge_test.go | Go | go | 23,226 | permissive | // Copyright 2015 CNI 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 ... |
216a3584468e76c5447e41d53eb9a10f0a0a76ca | f4c2d19a36c1d48514910831910c68385758dada | aneeshkp/sriov-network-operator | /pkg/apis/sriovnetwork/v1/sriovnetworknodepolicy_types.go | Go | go | 3,436 | permissive | package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// SriovNetworkNodePolicySpec defines the desired state of SriovNetworkNodePolicy
... |
24c09c0dbab2eac28f8af779bc445bcfa46890e6 | 695d1caadfde1e7f69d1c21ca561e88a6f7a7158 | rgraphql/nion | /cmd/nion/nion.go | Go | go | 405 | no_license | package main
import (
"os"
"github.com/urfave/cli"
)
// Commands contains the top-level commands.
var Commands []cli.Command
func main() {
app := cli.NewApp()
app.Name = "nion"
app.Usage = "tools and compiler for nion"
app.HideVersion = true
app.Commands = Commands
if err := app.Run(os.Args); err != nil {
... |
9f5682ea834d76c75c5a1864c74bd6045b71083a | 543a2d44d2e310b170e7907ec3fbf521cadef508 | paulxuca/copilot-cli | /cmd/copilot/template/template.go | Go | go | 2,120 | permissive | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package template
import (
"fmt"
"github.com/spf13/cobra"
"github.com/aws/copilot-cli/internal/pkg/cli/group"
)
// RootUsage is the text template for the root command.
var RootUsage = fmt.Sprintf("{{h1 \"... |
6f6b2173e4297449a04eb25c0378acebb23ca35b | a72a5554900580b3ec1b77db6e0d5e09e019456e | iMerica/rio | /modules/gloo/pkg/vsfactory/ingress.go | Go | go | 1,278 | permissive | package vsfactory
import (
gloov1 "github.com/solo-io/gloo/projects/gateway/pkg/api/v1"
v1 "github.com/solo-io/gloo/projects/gloo/pkg/api/v1"
"k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
)
func (f *VirtualServiceFactory) ForIngress(ingress *v1beta1.Ingress) ([]runtime.Object, error) {
vs := ... |
6a645dede49aa3311fccb4c5b8f05313ecf27135 | bd50ea3011677035ed0fdd8bc20c8a1e643e74bd | adrianwit/toolbox | /service_router.go | Go | go | 15,136 | permissive | package toolbox
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"reflect"
"strings"
"time"
)
const (
jsonContentType = "application/json"
textPlainContentType = "text/plain"
contentTypeHeader = "Content-Type"
)
const (
MethodGet = "GET"
MethodHead = "HEAD"
MethodPost = "... |
a2df109c4a26326ba858d5b0df70bc172d691c6d | 437a47ec5522468ee0d30ad48b5291a27c7650a9 | collinglass/hopitalMS | /server/models/ward_test.go | Go | go | 2,639 | no_license | package models_test
import (
"github.com/collinglass/moustacheMS/server/models"
"reflect"
"testing"
)
func Test_Ward_CanCreateAndDelete(t *testing.T) {
ward := models.NewWard(1, "Ward East", 1, 2)
err := ward.Create()
if err != nil {
t.Errorf("ward shouldn't exist, %v", err)
}
err = ward.Delete()
if err... |
0a2e0cd74a91b95f677ed7c06db782d731c9f02c | 7daf207dc2568449d72c09debac68342eaba4e40 | kevinchapron/golearn | /filters/float.go | Go | go | 4,668 | permissive | package filters
import (
"fmt"
"github.com/kevinchapron/golearn/base"
)
// FloatConvertFilters convert a given DataGrid into one which
// only contains BinaryAttributes.
//
// FloatAttributes are discretised into either 0 (if the value is 0)
// or 1 (if the value is not 0).
//
// CategoricalAttributes are discretis... |
9d2547db4384069b2f5094e116531322f42b5407 | b18a3d770ea4c4082bd33f9ad862dcd97d72af3a | hunzo/go-jwt | /services/call-function.go | Go | go | 2,284 | no_license | package services
import (
"fmt"
"os"
"time"
"github.com/dgrijalva/jwt-go"
"github.com/google/uuid"
"github.com/hunzo/go-jwt/entity"
)
func CreateToken(userID string) (*entity.TokenDetails, error) {
tokenData := &entity.TokenDetails{}
tokenData.AtExpires = time.Now().Add(time.Minute * 15).Unix()
// tokenDat... |
e7ee68949ea0945a5195ad0b6c7d1499774a8c16 | 781ddb2238bb1775c15860bb47d077cda2664898 | mewbak/go-astits | /descriptor.go | Go | go | 24,073 | permissive | package astits
import (
"time"
"github.com/asticode/go-astilog"
)
// Audio types
// Page: 683 | https://books.google.fr/books?id=6dgWB3-rChYC&printsec=frontcover&hl=fr
const (
AudioTypeCleanEffects = 0x1
AudioTypeHearingImpaired = 0x2
AudioTypeVisualImpairedCommentary = 0x3
)
// Descriptor... |
5b2baf7b5f355ebd2ccaac5dbbbe97dc8b972f92 | f8c6ad9637674fdade02d2779e9c6c339a8d5ffa | flant/addon-operator | /pkg/module_manager/values_layered.go | Go | go | 845 | permissive | package module_manager
import "github.com/flant/addon-operator/pkg/utils"
type ValuesTransform func(values utils.Values) utils.Values
type ValuesTransformer interface {
Transform(values utils.Values) utils.Values
}
func MergeLayers(initial utils.Values, layers ...interface{}) utils.Values {
res := utils.MergeValu... |
e5bb93aac1278364c65b3ac659f4719ec4d266d0 | fec060e121aef8f936299a1ac025ecd047f48db5 | Karolyna84/go | /src/cmd/trace/trace_unix_test.go | Go | go | 2,546 | permissive | // Copyright 2017 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.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package main
import (
"bytes"
traceparser "internal/trace"
"io/ioutil"
"runtime"
"runtime... |
8cb074a72b836617030c498a1747f1be57a8d7c3 | 02d947dac9dd163c12156a8bb7e9ee38b3f304b0 | F5Networks/cf-bigip-ctlr | /common/health/health_suite_test.go | Go | go | 254 | permissive | /*
* Portions Copyright (c) 2017,2018, F5 Networks, Inc.
*/
package health_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestHealth(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Health Suite")
}
|
1aa1fac2d58e95eb07ffad0d4c7f58b191d77a5f | 47c633324d560e93ae0e1787a272597330123126 | GolangFamily/yoyogo | /web/webhostbuilderdecorator.go | Go | go | 1,925 | permissive | package web
import (
"github.com/yoyofx/yoyogo/abstractions"
"github.com/yoyofxteam/dependencyinjection"
)
const (
// DefaultAddress is used if no other is specified.
DefaultAddress = ":8080"
)
type WebHostBuilderDecorator struct {
}
// OverrideConfigure is configure function by web application builder.
func (d... |
2579f1870a6753d58164ef8f29b1ca269733a491 | 13398dca487045abbbba34bfbf7c50efc77094d5 | agamigo/vecty-material | /demos/button/button_demo.go | Go | go | 4,768 | permissive | package main
import (
"agamigo.io/vecty-material/button"
"agamigo.io/vecty-material/checkbox"
"agamigo.io/vecty-material/demos/common"
"agamigo.io/vecty-material/formfield"
"agamigo.io/vecty-material/icon"
"agamigo.io/vecty-material/ripple"
"github.com/gopherjs/vecty"
"github.com/gopherjs/vecty/elem"
"github.... |
5ff290c55e05067577deb4fb09592169a260b302 | 58d68b3dc16c9b4fa8b1c065c359b51ad7dacd47 | MattAllen1992/Data-Science | /Go/Web_App/birdpedia/bird_handlers.go | Go | go | 1,632 | no_license | package main
import (
"encoding/json"
"fmt"
"net/http"
)
// create Bird struct with species and description attributes
type Bird struct {
Species string `json:"species"`
Description string `json:"description"`
}
// create array of Bird objects
// we'll use this throughout for handling birds
var birds []Bird... |
bb59a52131620a60f32e1ab2637f70e16abc28fd | 4ce4749244380d514f423a57913250f1e7fcb935 | AccelByte/accelbyte-go-sdk | /samples/cli/cmd/iam/oAuth20Extension/requestGameTokenCodeResponseV3.go | Go | go | 1,870 | permissive | // Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated. DO NOT EDIT.
package oAuth20Extension
import (
"github.com/AccelByte/accelbyte-go-sdk/iam-sdk/pkg/iamclient/o_auth2... |
50f6e95b3062bf275746a04507c47bb750c7ae5c | 114ae6525b5a8de9a2847dbd9e9cb87aa6aa8001 | open-telemetry/opentelemetry-collector | /consumer/traces_test.go | Go | go | 1,562 | permissive | // Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package consumer
import (
"context"
"errors"
"testing"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/pdata/ptrace"
)
func TestDefaultTraces(t *testing.T) {
cp, err := NewTraces(func(context.Context, ptrace.Tra... |
6e1f1eaf0dee3c99737113c8ad09545d281a65c5 | 7df1f0ed2132fde50f05a8cdda85facfec37ae47 | maraino/gossie | /src/gossie/query.go | Go | go | 8,763 | permissive | package gossie
import (
"errors"
"reflect"
. "github.com/wadey/gossie/src/cassandra"
)
/*
todo:
autopaging?
Search() and interface(s) for indexed get
*/
var (
Done = errors.New("No more results found")
)
const (
DEFAULT_COLUMN_LIMIT = 10000
DEFAULT_ROW_LIMIT = 500
)
// Query is a high level inter... |
3589572f81e72613028091ce1fbde5abb2066e34 | 6056e2135822ba0aecec91a286c9ff9dcd230db3 | 1ambs/learnwebdev | /12_hands-on/01_create-template/main.go | Go | go | 1,599 | no_license | package main
import (
"log"
"os"
"text/template"
)
type course struct {
Number string
Name string
Units string
}
type semester struct {
Term string
Courses []course
}
type year struct {
AcaYear string
Fall semester
Spring semester
Summer semester
}
var tpl *template.Template
func init() {
... |
d2fef12ec65c612ba0b905762d4e0e5ea2aab437 | 94f65fcc970c20b62733d9f8d6581213a0a428c4 | null-channel/examples | /community/user-service/models/user.go | Go | go | 600 | permissive | package models
import real "github.com/brianvoe/gofakeit/v6"
type User struct {
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
Email string `json:"email"`
Phone string `json:"phone"`
Gender string `json:"gender"`
}
func (u *User) NewUser() *User{
return &User{
FirstName: r... |
386d45d9e6c28b0e095858aca866b6d57fd0fae5 | 864c9535de743b977c402504eb2a8e984490da69 | azraelrabbit/wireguard-ui | /emailer/sendgrid.go | Go | go | 1,435 | permissive | package emailer
import (
"encoding/base64"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
)
type SendgridApiMail struct {
apiKey string
fromName string
from string
}
func NewSendgridApiMail(apiKey, fromName, from string) *SendgridApiMail {
ans := SendgridApiMail{apiKey... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.