text
stringlengths
11
4.05M
package particion import ( "strings" ) // Particion modelo de la estructura type Particion struct { Estado byte Tipo byte Fit byte Inicio int64 Tamanio int64 Nombre [16]byte } // Inicializar Recibe un puntero Particion para ser modificado. func (p *Particion) Inicializar(estado byte, tipo byte, fit ...
package config import ( "bytes" "encoding/json" "io/ioutil" "os" "reflect" "strconv" "strings" logUtils "github.com/bossjones/go-chatbot-lab/shared/log-utils" ) // Config - type Config struct { ConfigFile string `json:"configFile"` // "name": "chatbot", Name string `json:"name"` // "commands": ["how are ...
package test import "testing" func TestGitPush(t *testing.T) { }
package engine import ( "github.com/stretchr/testify/assert" "github.com/zhenghaoz/gorse/base" "github.com/zhenghaoz/gorse/core" "github.com/zhenghaoz/gorse/model" "path" "reflect" "testing" ) func TestLoadConfig(t *testing.T) { config, _ := LoadConfig("../example/file_config/config_test.toml") /* Check con...
package osbuild1 import ( "testing" "github.com/stretchr/testify/assert" ) func TestNewSELinuxStageOptions(t *testing.T) { expectedOptions := &SELinuxStageOptions{ FileContexts: "etc/selinux/targeted/contexts/files/file_contexts", } actualOptions := NewSELinuxStageOptions("etc/selinux/targeted/contexts/files/...
package config import ( "github.com/bemobi/envconfig" ) // Data contains parameters that controls the execution of the server. // The struct is filled from environment variables. var Data struct { Server struct { Addr string `envconfig:"default=0.0.0.0:8080"` } Redis struct { Addr string `envconfig:"optio...
package service import ( "errors" "fmt" "strconv" "strings" "time" "github.com/rs/zerolog/log" "github.com/shantanuchalla/awesomeProject/pkg/client" "github.com/shantanuchalla/awesomeProject/pkg/contracts" ) var poll = make(chan contracts.SlotRequest) type CowinSlotChecker struct { Locations []*contracts.L...
package controllers //type VideoController struct { // beego.Controller; //} //// @router /list [get] //func (this *VideoController) List(){ // //qb, _ := com.NewOrm(); // query :=make(map[string]string) // query["type.isnull"]="false"; // //fields :=[]string{"Id","Name","Type","Actors","description","ImagePath","IsRe...
package main import "fmt" func writeMessageToChannel(message chan string) { message <- "Hello Gopher!" } func main() { fmt.Println("Channel Demo") message := make(chan string) go writeMessageToChannel(message) fmt.Println("Greeting from the message channel: ", <-message) close(message) }
package usecase import ( "TechnoParkDBProject/internal/app/thread" threadModels "TechnoParkDBProject/internal/app/thread/models" "TechnoParkDBProject/internal/app/vote" "TechnoParkDBProject/internal/app/vote/models" "github.com/jackc/pgconn" "strconv" ) type VoteUsecase struct { voteRep vote.Repository thre...
package sso import ( "context" "fmt" "net/http" "github.com/argoproj/argo/server/auth/jws" ) var NullSSO Interface = nullService{} type nullService struct{} func (n nullService) Authorize(context.Context, string) (*jws.ClaimSet, error) { return nil, fmt.Errorf("not implemented") } func (n nullService) Handle...
package mt type MinimapType uint16 const ( NoMinimap MinimapType = iota // none SurfaceMinimap // surface RadarMinimap // radar TextureMinimap // texture ) //go:generate stringer -linecomment -type MinimapType type MinimapMode struct { Type Minim...
package models import ( "github.com/astaxie/beego/orm" "github.com/astaxie/beego" _ "github.com/go-sql-driver/mysql" "database/sql" "github.com/go-redis/redis" ) func init() { orm.RegisterDriver("mysql", orm.DRMySQL) user := beego.AppConfig.String("sqluser") password := beego.AppConfig.String("sqlpass") db...
package controller import ( "gonum.org/v1/gonum/mat" "../basic" "math" ) type square struct { particles [][]*particle verticalSprings [][]*spring horizontalSprings [][]*spring tilt1Springs [][]*spring tilt2Springs [][]*spring } type particle struct { pos *mat.VecDense prev *mat.VecDense force *mat.VecDens...
package sonarqube import ( "fmt" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" sonargo "github.com/labd/sonargo/sonar" ) func dataSourceUser() *schema.Resource { return &schema.Resource{ Read: dataSourceUserRead, Schema: map[string]*schema.Schema{ "email": { Type: schema.TypeString, ...
/* # -*- coding: utf-8 -*- # @Author : joker # @Time : 2020-08-10 20:46 # @File : server.go # @Description : # @Attention : */ package server
// DO NOT EDIT. This file was generated by "github.com/frk/gosql". package testdata import ( "github.com/frk/gosql" "github.com/frk/gosql/internal/testdata/common" ) func (q *SelectWithWhereBlockInPredicate2Query) Exec(c gosql.Conn) error { var ( nstatic = 3 // number of static parameters le...
package logic import ( "fmt" ) const ( ERROR_UNKNOWN = 400 ERROR_INPUT = 401 ) type Error struct { Errno int Errmsg string } func (E *Error) Error() string { return fmt.Sprintf("[%d] %s", E.Errno, E.Errmsg) } func NewError(errno int, errmsg string) *Error { return &Error{errno, errmsg} } func GetError(e...
package launcher type AlertSender interface { Send(msg string) }
/* Copyright (C) 2016 Red Hat, 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 in writing, softwa...
/* # -*- coding: utf-8 -*- # @Author : joker # @Time : 2020-08-16 14:07 # @File : shell_sort.go # @Description : # @Attention : */ package sort import ( "fmt" "testing" ) func TestShellSort(t *testing.T) { ShellSort(array) fmt.Println(array) }
// Copyright 2015-2018 trivago N.V. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
package cockroachdb import ( "context" "database/sql" "errors" "github.com/go-kit/kit/log" "github.com/shijuvar/gokit-examples/services/account" ) var ( ErrRepository = errors.New("unable to handle request") ) type repository struct { db *sql.DB logger log.Logger } // New returns a concrete repository...
package main import ( "fmt" "html/template" "log" "net/http" "strconv" "time" "github.com/gorilla/mux" ) type SinBlog struct { ID int `db:"id"` UserID int `db:"userid"` Title string `db:"title"` Message string `db:"message"` Category_id int `db:"category_id"` CreateTime time.Time `db:"created_at"` Up...
package main import ( "fmt" "sort" ) func main() { a := []Interval{Interval{1, 3}, Interval{2, 6}, Interval{8, 10}, Interval{9, 18}} // fmt.Println(merge(a)) a = []Interval{Interval{1, 4}, Interval{0, 2}, Interval{3, 5}} fmt.Println(merge(a)) } // Interval Definition for an interval. type Interval struct { S...
/** * Created by GoLand. * User: link1st * Date: 2019-08-01 * Time: 10:40 */ package models import "gowebsocket/common" const ( MessageTypeText = "text" MessageTypeImage = "image" MessageTypeVoice = "voice" MessageCmdMsg = "msg" MessageCmdEnter = "enter" MessageCmdExit = "exit" SystemNoticeType = "0...
package main import ( "encoding/json" "fmt" ) func main() { // Arrays var arr = [5]int{1, 2, 3} println(arr[2]) var arr1 = []string{"Hola", "mundo"} println(arr1[1]) var arr3 = []bool{true, false, false} println(arr3[2]) // Slices var mySlice = make([]int, 20) println(mySlice[1]) mySlice = append(mySl...
package AdminControllers import ( "strings" "github.com/astaxie/beego/orm" "lazybug.me/conv" "github.com/TruthHun/DocHub/models" ) type CrawlController struct { BaseController } //采集管理 func (this *CrawlController) Get() { Type := this.GetString("type", "gitbook") //默认是gitbook p, _ := this.GetInt("p", 1) ...
package builtin import ( "github.com/kumahq/kuma/pkg/core/resources/manager" "github.com/kumahq/kuma/pkg/tokens/builtin/issuer" "github.com/kumahq/kuma/pkg/tokens/builtin/zoneingress" ) func NewDataplaneTokenIssuer(resManager manager.ReadOnlyResourceManager) (issuer.DataplaneTokenIssuer, error) { return issuer.Ne...
package main import ( "context" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/policyutil" "github.com/hashicorp/vault/sdk/logical" ) const REPO_PATH_PREFIX = "repositories" func (b *backend) pathRepositoriesList() *framework.Path { return &framework.Path{ Pattern: REPO_PAT...
// Copyright 2023 Google LLC. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applica...
/** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ var ret []int func rightSideView(root *TreeNode) []int { ret = make([]int, 0) if root == nil{ return ret } helper(root, 0) return ret } func helper(nd *Tr...
// Copyright 2023 Google LLC. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applica...
package domain const ( MaterialTypeSeedCode = "SEED" MaterialTypePlantCode = "PLANT" MaterialTypeGrowingMediumCode = "GROWING_MEDIUM" MaterialTypeAgrochemicalCode = "AGROCHEMICAL" MaterialTypeLabelAndCropSupportCode = "LABEL_AND_CROP_SUPPORT" MaterialTypeSeedingContainer...
package main import ( "github.com/adamveld12/goadventure/game" "github.com/adamveld12/goadventure/persistence" "github.com/adamveld12/goadventure/routes" "github.com/adamveld12/sessionauth" "github.com/go-martini/martini" "github.com/martini-contrib/render" "github.com/martini-contrib/sessions" "net/http" "os...
package configuration import polochon "github.com/odwrtw/polochon/lib" // ModuleFetcher is an interface which allows to get torrenters and detailers ... type ModuleFetcher interface { GetDetailers() []polochon.Detailer GetTorrenters() []polochon.Torrenter GetSearchers() []polochon.Searcher GetExplorers() []poloch...
package main import ( "context" "fmt" "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kinesis" ) // arn:aws:kinesis:eu-central-1:627211582084:stream/productevents var ( strea...
package main import ( "fmt" "math/rand" ) func main() { piggyBank := 0 for piggyBank < 2000 { switch rand.Intn(3) { case 0: piggyBank += 5 case 1: piggyBank += 10 case 2: piggyBank += 15 } dollar := piggyBank /100 cents := piggyBank % 100 fmt.Printf("$%d.%02d\n",dollar,cents) } }
// Copyright 2023 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 reverse can reverse things, particularly strings. package reverse // String returns its argument string reversed rune-wise left to right. func Strin...
/* * Copyright 2017 StreamSets Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
// Package rangeset has set operations on ranges: Union, Intersect and Difference package rangeset import ( "fmt" "github.com/biogo/store/step" ) func max(a, b int) int { if a > b { return a } return b } type _bool bool const ( _true = _bool(true) _false = _bool(false) ) func (b _bool) Equal(e step.Equa...
// Package mustcheck defines an Analyzer that reports .MustVerb usages package mustcheck import ( "bytes" "go/ast" "go/printer" "go/token" "strings" "github.com/fatih/camelcase" "golang.org/x/tools/go/analysis" "golang.org/x/tools/go/analysis/passes/inspect" "golang.org/x/tools/go/ast/inspector" ) var Analy...
package contentService import ( "github.com/rossifedericoe/bootcamp/clase2/domain" ) func IsValidContent(content domain.IContent) (bool, string) { if !content.ValidTitle() { return false, "title" } if !content.ValidLanguage() { return false, "lang" } return true, "" }
package main import ( "fmt" "github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition/chapter10/waitgroup" ) func main() { sites := []string{ "https://golang.org", "https://godoc.org", "https://www.google.com/search?q=golang", } resps, err := waitgroup.Crawl(sites) if err != nil { panic(err) ...
// Package example is usage example for httpexpect. package example
// feet_to_meter.go // converte pés em metros // arataca89@gmail.com // 20210409 package main import "fmt" func main() { var feet float64 fmt.Print("Entre com a medida em pés:") fmt.Scanf("%f", &feet) meters := feet * 0.3048 fmt.Println("A medida em metros é", meters) }
package controllers import ( "net/http" "part2/lib/databases" "part2/models" "strconv" "github.com/labstack/echo" ) func GetBooksControllers(c echo.Context) error { books, err := databases.GetBooks() if err != nil { return echo.NewHTTPError(http.StatusBadRequest, err.Error()) } return c.JSON(http.StatusOK...
package caaa import ( "encoding/xml" "github.com/thought-machine/finance-messaging/iso20022" ) type Document01400104 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:caaa.014.001.04 Document"` Message *AcceptorDiagnosticResponseV04 `xml:"AccptrDgnstcRspn"` } func (d *Document...
package main func main() { //Please go through readME }
package main import ( "gopkg.in/yaml.v2" "io/ioutil" "os" "fmt" ) type Config struct { FileName string } //全局变量怎么表示 var config Config func SetConfig(filePath string) string{ configFile := "conf.yaml" //os.Args[1] source, err := ioutil.ReadFile(configFile) if err != nil { panic(err) } err = yaml.Unmars...
package ch05 // Give a list of 1's and 0's, write a program to separate 0's and 1's. // Hint: QuickSelect, counting func Separate_0_1(in []int) (zeros, ones int) { for _, val := range in { if val == 0 { zeros++ } else { ones++ } } return zeros, ones }
package main import "errors" func div(x, y int) (int, error) { if y == 0 { return 0, errors.New("division by zero") } return x / y, nil } func main() { r, e := div(100, 0) if e != nil { println("error!") } else { println(r) } }
// Copyright 2020-2021 Buf Technologies, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law...
package test import ( "fmt" "pencil/api/bind" "pencil/api/query" "testing" "time" ) /* any请求方式,支持如下几种:GET \ POST \ PUT \ PATCH \ HEAD \ OPTIONS \ DELETE \ CONNECT \ TRACE xml格式数据和json格式数据传递的时候,可以通过 Content-Type 检查,xml格式的时候,结构体必须有xml标识,json必须有form标识 */ /** * @desc 绑定json \ xml 测试 验证器测试 * @author Ipenci...
package leetcode func minStartValue(nums []int) int { startValue := 0 sum := 0 for i, l := 0, len(nums); i < l; i++ { sum += nums[i] if sum <= 0 { startValue += 1 - sum sum = 1 } } if startValue == 0 { return 1 } return startValue }
package utils import ( "Golang-Echo-MVC-Pattern/constant" "Golang-Echo-MVC-Pattern/entity" "github.com/dgrijalva/jwt-go" "github.com/labstack/echo" "net/http" "os" ) func GetDataToken(c echo.Context) *entity.MyCustomClaims { tokenID := getAuthorizationToken(c) tokenKey := os.Getenv(constant.JWTKey) token, _ ...
package 链表 // sortList 排序链表。 // 空间复杂度: O(1)。 // 时间复杂度: O(nlogn) func sortList(head *ListNode) *ListNode { // 1. 初始化。 dummyHead := &ListNode{ Next: head, } // 2. 获取链表长度。 length := getLength(head) // 3. 由下到上归并排序。 for size := 1; size <= length; size <<= 1 { tail := dummyHead cur := tail.Next for cur != n...
/* Copyright 2020 SUSE 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, s...
package mt import ( "fmt" "io" ) type PointedThing interface { pt() } func (*PointedNode) pt() {} func (*PointedAO) pt() {} type PointedNode struct { Under, Above [3]int16 } func PointedSameNode(pos [3]int16) PointedThing { return &PointedNode{pos, pos} } type PointedAO struct { ID AOID } func writePoint...
package main /** * 文件名: logcenter.go * 创建时间: 2018年3月9日-下午4:47:10 * 简介: * 详情: 游戏日志服 */ import ( "base/common" l4g "base/log4go" "flag" "fmt" "math/rand" "net/http" _ "net/http/pprof" "runtime" "time" ) var ( g_config = new(XmlConfig) g_handler_chan = make(chan *HttpRequestInfo, 102400) g_kafka_...
package repository import ( "context" "fmt" "github.com/TodoApp2021/gorestreact/pkg/models" "github.com/jackc/pgx/v4/pgxpool" ) type AuthPostgres struct { pool *pgxpool.Pool } func NewAuthPostgres(pool *pgxpool.Pool) *AuthPostgres { return &AuthPostgres{pool: pool} } func (ap *AuthPostgres) CreateUser(user m...
package main import ( "flag" "fmt" "os" "os/user" "text/tabwriter" ) const ( cliName = "conair" cliDescription = "conair is a command-line interface to systemd-nspawn containers. much like docker." bridge = "nspawn0" destination = "192.168.13.0/24" home = "/var/lib/machines" hub ...
package sqls // SelResult is SQL. const SelResult = ` SELECT r.file_path FROM results r WHERE r.competition_id = ? AND r.user_id = ? ORDER BY r.created_at DESC LIMIT 1 `
package main import "fmt" func setRoute() { fmt.Printf("Hello, World!!") }
package feed import ( "encoding/xml" "strings" "github.com/azzzak/fakecast/fs" "github.com/azzzak/fakecast/store" ) // RSS entity type RSS struct { XMLName xml.Name `xml:"rss"` Version string `xml:"version,attr"` Itunes string `xml:"xmlns:itunes,attr"` Content string `xml:"xmlns:content,attr"` Chann...
package http_metric import ( "time" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" "github.com/SDkie/metric_collector/db" "github.com/SDkie/metric_collector/logger" "github.com/gin-gonic/gin" ) //go:generate easytags http_metric.go bson type HttpMetric struct { Id string `bson:"_id"` Count ...
package internal import ( "bytes" "github.com/stretchr/testify/assert" "testing" ) func TestVersion(t *testing.T) { buf := new(bytes.Buffer) WriteVersionInfo("foobar", buf) s := buf.String() assert.Contains(t, s, "foobar version") }
package main import ( "sort" "fmt" ) func main() { // 就地排序,改变原有序列,无返回值 strs := []string{"e", "a", "g", "k"} sort.Strings(strs) fmt.Println(strs) ints := []int{98, 1, 33, 5, 76} sort.Ints(ints) fmt.Println(ints) }
package models type Node_lookup struct { RemoteAddress string `json:"remote_address"` Hostname string `json:"hostname"` BroadcastAddress string `json:"broadcast_address"` TCPPort int `json:"tcp_port"` HTTPPort int `json:"http_port"` Version string `json:"ver...
package tpl const ModelTpl = `package {{model}} ` type A struct { Test string `json:"test"` }
package utils import ( "log" ) const ( Error = iota + 31 Debug Warn Info Fatal ) func LogPrint(msg interface{}, level int) { log.Printf("%c[%d;%d;%dm%s%c[0m\n", 0x1B, 0, 0, level, msg, 0x1B) }
package main import ( "io/ioutil" "strconv" ) func check(e error) { if e != nil { panic(e) } } func readContentFile(contentPath string) string { data, err := ioutil.ReadFile(contentPath) check(err) return BytesToStr(data) } func prependContentHeaders(contentType string, content string) string { header := ...
package hw05_parallel_execution //nolint:golint,stylecheck import ( "fmt" "math/rand" "sync/atomic" "testing" "time" "github.com/stretchr/testify/require" ) func TestRun(t *testing.T) { t.Run("if were errors in first M tasks, than finished not more N+M tasks", func(t *testing.T) { tasksCount := 50 tasks :...
/* * @lc app=leetcode.cn id=235 lang=golang * * [235] 二叉搜索树的最近公共祖先 */ package main type TreeNode struct { Val int Left *TreeNode Right *TreeNode } /* func lowestCommonAncestorCore(root, p, q *TreeNode, ancestor **TreeNode) { if root == nil { return } if p.Val < root.Val && q.Val < root.Val { lowestCo...
package issue // NotFoundError represents account not found error type NotFoundError struct{} func (inf NotFoundError) Error() string { return "Issue Not Found" }
package action import ( "github.com/guilhermesteves/aclow" ) type UpdateTodo struct { app *aclow.App } func (n *UpdateTodo) Address() []string { return []string{"update_todo"} } func (n *UpdateTodo) Start(app *aclow.App) { n.app = app } func (n *UpdateTodo) Execute(msg aclow.Message, call aclow.Caller) (aclow....
package ora2uml import ( "testing" ) func TestModelTableFullName(t *testing.T) { var table = ModelTable{TableName: "tableName"} if table.FullName() != "tableName" { t.Errorf("table.FullName() should be 'tableName', but was '%v'", table.FullName()) } table.Owner = "sys" if table.FullName() != "sys.tableName...
package commit import ( "github.com/scjalliance/drivestream/collection" "github.com/scjalliance/drivestream/page" ) // Source identifies the source of a commit within a collection. type Source struct { Collection collection.SeqNum `json:"collection"` Page page.SeqNum `json:"page,omitempty"` Index ...
package main import ( "fmt" "go.uber.org/zap" ) func main() { fmt.Printf("*** Using the Example logger\n\n") logger := zap.NewExample() logger.Debug("This is a DEBUG message") logger.Info("This is an INFO message") logger.Info("This is an INFO message with fields", zap.String("region", "us-west"), zap.Int("id...
//合约的部署工具 //author:caige package deploy import ( "context" "fmt" "io/ioutil" "os" "strings" "comment/token" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethe...
package hashmap_shards type sliceInterfaceData struct { data []interface{} err error } func (impl implementation) HMGet(key string, fields ...string) ([]interface{}, error) { var response = make([]interface{}, 0) var err error = nil var keys = impl.constructMapKey(key, fields...) var dataChannel = make(chan sl...
package NFA type NFADesign struct { CurrentStates []int32 AcceptStates []int32 Rulebook DFARulebook } func (n NFADesign) Accepts(sequence string) bool { nfa := n.ToNFA(n.CurrentStates, n.AcceptStates, n.Rulebook) nfa.ReadString(sequence) return nfa.Accepting() } func (n NFADesign) ToNFA(currentStates []in...
// Contains the model of the application data package models import ( "glsamaker/pkg/config" "glsamaker/pkg/database/connection" "time" ) type ApplicationSetting struct { Key string `pg:",pk"` Value string LastUpdate time.Time //LastBugUpdate time.Time //LastCVEUpdate time.Time } type GlobalSett...
package sms import ( "crypto/subtle" "encoding/json" "fmt" "log" "net/http" "net/url" "strings" "github.com/pkg/errors" ) // Twilio represents an account with the communications provider // Twilio. type Twilio struct { accountSid string keySid string keySecret string // where to listen for incoming...
package models import ( "github.com/astaxie/beego/orm" "time" "tokensky_bg_admin/utils" ) //理财分类表 /* CREATE TABLE `financial_category` ( `id` int(11) NOT NULL, `avatar` varchar(255) NOT NULL, `symbol` varchar(255) NOT NULL, `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ...
package main /* * @lc app=leetcode id=113 lang=golang * * [113] Path Sum II */ /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ func pathSum(root *TreeNode, sum int) [][]int { var res [][]int traverse(root, sum, []int{}, &re...
package router import ( "github.com/astaxie/beego" "github.com/astaxie/beego/context" "github.com/astaxie/beego/logs" "github.com/initlove/ocihub/controllers" ) const ( ociV1Prefix = "/oci/v1" ) func init() { if err := RegisterRouter(ociV1Prefix, OCIV1NameSpace()); err != nil { logs.Error("Failed to registe...
package tsmt import ( "encoding/xml" "github.com/thought-machine/finance-messaging/iso20022" ) type Document01700103 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:tsmt.017.001.03 Document"` Message *ForwardDataSetSubmissionReportV03 `xml:"FwdDataSetSubmissnRpt"` } func...
package models import ( "github.com/libvirt/libvirt-go" ) var libvirtConn *libvirt.Connect func InitLibvirt(uri string) (*libvirt.Connect, error) { conn, err := libvirt.NewConnect(uri) if err != nil { return nil, err } libvirtConn = conn return conn, nil }
package main import ( "flag" "fmt" "log" "net/http" "gophercises/url_shortener/urlshort" "github.com/boltdb/bolt" ) func defaultMux() *http.ServeMux { mux := http.NewServeMux() mux.HandleFunc("/", hello) return mux } func hello(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello, world!") } ...
package jarvisbot_test import "testing" func TestParseArgs(t *testing.T) { // TODO: Need to figure out how to mock the bot object //j := &jarvisbot.JarvisBot{keys: map[string]string{"open_exchange_api_key": ""}} //res, err := j.RetrieveExchangeRates() //ok(t, err) //assert(t, res.UnixTimestamp != 0, "Exchange r...
package presenters import ( "fmt" "net/url" "time" "github.com/messagedb/messagedb/meta/schema" ) // Organization is a presenter for the schema.Organization model type Organization struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` URL ...
// Copyright 2020 Torben Schinke // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
package data type SMSResult struct { Result uint `json:"result"` Errmsg string `json:"errmsg"` Ext string `json:"ext"` Sid string `json:"sid,omitempty"` Fee uint `json:"fee,omitempty"` }
/* * Go Library (C) 2017 Inc. * * @project Project Globo / avaliacao.com * @author @jeffotoni * @size 01/03/2018 */ package handler var ( CTYPE_ACCEPT = "application/json" msgJson string )
package chart type ChartDataOutput struct { Title string Items []*ChartDataOutputItem } type ChartDataOutputItem struct { Name string Data [][2]float64 } type ChartDataOutputItemsSorter [][2]float64 func (c ChartDataOutputItemsSorter) Len() int { return len(c) } func (c ChartDataOutputItemsSorter) Swap(i, j in...
package main import ( "fmt" "log" "github.com/saylorsolutions/passlock" ) // GenericDataStructure is an example data structure that holds an encrypted payload with a string identifier to allow // application code to reference the encrypted data. // The data structure can be safely transferred over an insecure net...
package types import "github.com/babyboy/common" type HashArray struct { Hashes []common.Hash } func NewHashArray() HashArray { return HashArray{} }
package util import ( "context" "database/sql" "fmt" "strings" "github.com/elgris/sqrl" "github.com/alewgbl/fdwctl/internal/database" "github.com/alewgbl/fdwctl/internal/logger" "github.com/alewgbl/fdwctl/internal/model" ) const ( // usermapSQLPrefix is the WITH clause used as a prefix on the SQL statement...
package config import ( "database/sql" "fmt" "log" "os" "github.com/joho/godotenv" _ "github.com/lib/pq" ) func CreateConnection() *sql.DB { //load .env file err := godotenv.Load(".env") if err != nil { log.Fatalf("Error loading .env file") } // buka koneksi ke db db, err := sql.Open("postgres", os...