text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *MediaClient) UpdateOneID(id int) *MediaUpdateOne {
mutation := newMediaMutation(c.config, OpUpdateOne, withMediaID(id))
return &MediaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
} | [
-1.0702639818191528,
-0.8614891171455383,
0.5834286212921143,
-0.010053164325654507,
-1.0467559099197388,
-0.6198579668998718,
-0.04171130806207657,
0.3099629878997803,
1.9201363325119019,
0.5505232810974121,
-0.45927679538726807,
0.19475193321704865,
-1.6658453941345215,
0.465761035680770... |
func (c *MediaClient) Delete() *MediaDelete {
mutation := newMediaMutation(c.config, OpDelete)
return &MediaDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
} | [
0.621385395526886,
-0.394679456949234,
0.4782339036464691,
0.48188623785972595,
0.26969608664512634,
-0.5263385772705078,
0.20868727564811707,
0.3158060908317566,
1.2128623723983765,
0.14554041624069214,
0.19628463685512543,
0.5961768627166748,
-1.0001251697540283,
-0.130984365940094,
0.... |
func (c *MediaClient) DeleteOne(m *Media) *MediaDeleteOne {
return c.DeleteOneID(m.ID)
} | [
0.014083920046687126,
0.013016464188694954,
0.430300772190094,
0.7590450644493103,
0.6866660118103027,
-0.2527945637702942,
0.646953821182251,
-0.15436622500419617,
0.3945072591304779,
-0.6569839119911194,
-0.04891655594110489,
0.3066836893558502,
-1.577075481414795,
0.8965256214141846,
... |
func (c *MediaClient) DeleteOneID(id int) *MediaDeleteOne {
builder := c.Delete().Where(media.ID(id))
builder.mutation.id = &id
builder.mutation.op = OpDeleteOne
return &MediaDeleteOne{builder}
} | [
-0.3218342959880829,
-0.3027385175228119,
0.49260690808296204,
0.06687164306640625,
-0.016310686245560646,
-0.48227277398109436,
0.295204222202301,
0.08180782943964005,
1.616610050201416,
0.0868120864033699,
-0.270763635635376,
0.07116130739450455,
-1.2009687423706055,
0.9599807858467102,
... |
func (c *MediaClient) Query() *MediaQuery {
return &MediaQuery{
config: c.config,
}
} | [
0.6924651861190796,
-0.7629968523979187,
0.1017061173915863,
0.07441560924053192,
-0.9126255512237549,
-0.6787197589874268,
-0.42774343490600586,
0.285118043422699,
0.7044004201889038,
-0.674680233001709,
0.6701042056083679,
1.1809566020965576,
-0.8247578144073486,
0.6572736501693726,
-0... |
func (c *MediaClient) Get(ctx context.Context, id int) (*Media, error) {
return c.Query().Where(media.ID(id)).Only(ctx)
} | [
-0.26055485010147095,
-0.2639925181865692,
0.11243341118097305,
-0.22360530495643616,
0.5061304569244385,
-0.672604501247406,
-0.6738734245300293,
-0.7359687685966492,
0.2068154513835907,
-0.384143203496933,
-0.008176150731742382,
1.238429069519043,
-1.1270794868469238,
0.10345811396837234... |
func (c *MediaClient) GetX(ctx context.Context, id int) *Media {
obj, err := c.Get(ctx, id)
if err != nil {
panic(err)
}
return obj
} | [
-0.4009034037590027,
0.5308243036270142,
0.2954152822494507,
0.18740518391132355,
-0.26007622480392456,
-0.058926936239004135,
-1.006397008895874,
-0.8691498041152954,
1.0812897682189941,
-0.3669908046722412,
-0.6020914316177368,
1.6068006753921509,
-0.5259200930595398,
-0.3364690840244293... |
func (c *MediaClient) Hooks() []Hook {
return c.hooks.Media
} | [
-0.24862955510616302,
-0.796251118183136,
0.029098205268383026,
0.42623960971832275,
0.4848601520061493,
0.7027244567871094,
0.2368757426738739,
-0.357643723487854,
0.33365923166275024,
-0.35750246047973633,
0.4857715964317322,
1.272627353668213,
-1.4528125524520874,
0.18618732690811157,
... |
func (qh *QuickHull) ConvexHull(pointCloud []r3.Vector, ccw bool, useOriginalIndices bool, epsilon float64) ConvexHull {
qh.buildMesh(pointCloud, epsilon)
return newConvexHull(qh.mesh, qh.vertexData, ccw, useOriginalIndices)
} | [
1.4227460622787476,
-0.18909792602062225,
0.39349114894866943,
1.0680906772613525,
0.4391343593597412,
0.6037290096282959,
0.055488646030426025,
-0.013650505803525448,
0.5656182765960693,
-0.48072099685668945,
0.06969431787729263,
0.3088829517364502,
-0.3754259943962097,
-0.430625677108764... |
func (qh *QuickHull) ConvexHullAsMesh(pointCloud []r3.Vector, epsilon float64) HalfEdgeMesh {
qh.buildMesh(pointCloud, epsilon)
return newHalfEdgeMesh(qh.mesh, qh.vertexData)
} | [
1.272419810295105,
-0.1179036945104599,
0.3874965012073517,
0.6897293329238892,
0.8155004978179932,
0.5457462072372437,
-0.23462992906570435,
-0.13341505825519562,
0.2167557328939438,
-0.8403688669204712,
-0.42055246233940125,
0.19288243353366852,
-0.13265308737754822,
0.37802496552467346,... |
func (qh *QuickHull) createConvexHalfEdgeMesh() {
var visibleFaces []int
var horizontalEdges []int
type faceData struct {
faceIndex int
enteredFromHalfEdge int // If the Face turns out not to be visible, this half edge will be marked as horizon edge
}
var possiblyVisibleFaces []faceData
// Comput... | [
0.560980498790741,
-0.060300931334495544,
0.7867441177368164,
0.1539364606142044,
-0.43444785475730896,
0.410084992647171,
0.9673667550086975,
0.05959157273173332,
-0.1851295679807663,
0.18422870337963104,
-0.6293352246284485,
-0.31740760803222656,
-0.48689478635787964,
0.4128381013870239,... |
func (qh *QuickHull) initialTetrahedron() meshBuilder {
nVertices := len(qh.vertexData)
// If we have at most 3 points, just return p1 degenerate tetrahedron:
if nVertices <= 3 {
v := [4]int{
0,
int(math.Min(1, float64(nVertices-1))),
int(math.Min(2, float64(nVertices-1))),
nVertices - 1,
}
n := ... | [
0.49002113938331604,
-0.16518962383270264,
0.8862999081611633,
-0.10312388837337494,
0.1246056854724884,
0.6403354406356812,
-0.3602127730846405,
0.02814442291855812,
-0.017369749024510384,
-0.7076510787010193,
-0.5120283365249634,
0.19914786517620087,
-0.217680424451828,
0.222260996699333... |
func (qh *QuickHull) addPointToFace(face *meshBuilderFace, pointIndex int) bool {
d := signedDistanceToPlane(qh.vertexData[pointIndex], face.plane)
if d > 0 && d*d > qh.epsilonSquared*face.plane.sqrNLength {
/* TODO: optimize
if Face.pointsOnPositiveSide == nil {
f.m_pointsOnPositiveSide = std::move(getIndexVe... | [
-0.35134828090667725,
-0.24623504281044006,
0.6765052080154419,
0.26085570454597473,
0.14759884774684906,
1.3952889442443848,
-0.08479446172714233,
-0.45254966616630554,
0.8483067750930786,
-0.12239235639572144,
-0.21290990710258484,
-0.5351594686508179,
-0.36760038137435913,
0.28097298741... |
func (qh QuickHull) reorderHorizontalEdges(horizontalEdges []int) bool {
nEdges := len(horizontalEdges)
for i := 0; i < nEdges-1; i++ {
endVertex := qh.mesh.halfEdges[horizontalEdges[i]].EndVertex
var foundNext bool
for j := i + 1; j < nEdges; j++ {
beginVertex := qh.mesh.halfEdges[qh.mesh.halfEdges[horizont... | [
-0.08552364259958267,
0.08638116717338562,
1.1616058349609375,
0.3135870397090912,
-0.2183135747909546,
0.2779028117656708,
0.12339773774147034,
-0.19944755733013153,
0.11170903593301773,
0.2497633695602417,
-0.6853765845298767,
-0.22277912497520447,
-1.1414436101913452,
-0.030691225081682... |
func LoginSessionPath() string {
return fmt.Sprintf("/api/token")
} | [
-1.0641496181488037,
-1.1564728021621704,
0.3305903375148773,
-0.34216949343681335,
-0.2684081196784973,
0.47291266918182373,
-0.23582828044891357,
-0.40804168581962585,
1.005180835723877,
0.3277967870235443,
-0.5060672163963318,
0.4121152460575104,
-0.6463594436645508,
-1.4675004482269287... |
func (c *Client) LoginSession(ctx context.Context, path string) (*http.Response, error) {
req, err := c.NewLoginSessionRequest(ctx, path)
if err != nil {
return nil, err
}
return c.Client.Do(ctx, req)
} | [
-1.5925159454345703,
-0.4737359583377838,
0.6096847057342529,
-0.007468314841389656,
-0.35741913318634033,
-0.38238441944122314,
-0.19969747960567474,
-1.563055396080017,
1.1828655004501343,
-0.22495335340499878,
-1.0576937198638916,
1.1506292819976807,
-0.9678050875663757,
-0.609339475631... |
func (c *Client) NewLoginSessionRequest(ctx context.Context, path string) (*http.Request, error) {
scheme := c.Scheme
if scheme == "" {
scheme = "http"
}
u := url.URL{Host: c.Host, Scheme: scheme, Path: path}
req, err := http.NewRequest("GET", u.String(), nil)
if err != nil {
return nil, err
}
if c.BasicAut... | [
-1.5323550701141357,
-0.9181024432182312,
0.4848305284976959,
-0.0473761223256588,
-1.0182926654815674,
-0.30035167932510376,
-0.6927416920661926,
-0.8733370304107666,
0.5273676514625549,
-0.022322608157992363,
-0.15012097358703613,
1.14640212059021,
-0.3538172245025635,
-0.363992661237716... |
func New(dest io.Writer) func(http.HandlerFunc) http.HandlerFunc {
if dest == nil {
dest = os.Stdout
}
colorEnabled := false
if v, ok := dest.(*os.File); ok {
if isatty.IsTerminal(v.Fd()) {
dest = colorable.NewColorable(v)
colorEnabled = true
}
}
return func(next http.HandlerFunc) http.HandlerFunc {... | [
-0.4824485182762146,
-0.9378052353858948,
0.8389236330986023,
-0.27298086881637573,
-0.8214696049690247,
-0.5994392037391663,
-0.18038801848888397,
-0.63691246509552,
-0.7311970591545105,
-0.17158405482769012,
0.4750429689884186,
0.2798675000667572,
1.1573567390441895,
0.643256425857544,
... |
func (s *server) handleUpdateTransactions(w http.ResponseWriter, r *http.Request) {
var ctx = r.Context()
var message = new(ledger.WebhookMessage)
err := json.NewDecoder(r.Body).Decode(message)
if err != nil {
s.logger.WithError(err).Error()
s.writeError(ctx, w, http.StatusBadRequest, errors.New("failed to de... | [
0.0372900664806366,
-0.3336200714111328,
0.7670734524726868,
0.3060837984085083,
0.10426291078329086,
-0.38865146040916443,
0.8895912170410156,
-0.6779559850692749,
0.4026743769645691,
1.0229018926620483,
-0.18688106536865234,
0.33283594250679016,
-0.531288206577301,
0.509847104549408,
-... |
func KNCAddressFromContext(c *cli.Context) ethereum.Address {
deploymentMode := deployment.MustGetDeploymentFromContext(c)
switch deploymentMode {
case deployment.Ropsten:
return ethereum.HexToAddress("0x4e470dc7321e84ca96fcaedd0c8abcebbaeb68c6")
default:
return ethereum.HexToAddress("0xdd974d5c2e2928dea5f71b98... | [
-0.5031047463417053,
-0.6216487884521484,
0.8218947052955627,
0.30784741044044495,
-0.12837840616703033,
0.4855329394340515,
-0.34318649768829346,
-0.9551827311515808,
1.0473506450653076,
1.2919343709945679,
1.1019755601882935,
0.4704250395298004,
0.20200461149215698,
0.05631139129400253,
... |
func NewStorageInterfaceFromContext(sugar *zap.SugaredLogger, c *cli.Context, tokenAmountFormatter blockchain.TokenAmountFormatterInterface) (Interface, error) {
kncAddr := KNCAddressFromContext(c)
db, err := libapp.NewDBFromContext(c)
if err != nil {
return nil, err
}
postgresStorage, err := postgres.NewTradeLo... | [
0.6825731992721558,
-0.06953602284193039,
0.5595643520355225,
0.14223931729793549,
-0.8382095694541931,
0.1054811179637909,
-0.20272216200828552,
-1.4177892208099365,
-0.0005468424642458558,
0.6177867650985718,
0.0728464275598526,
-0.6010019779205322,
-0.9439383149147034,
0.477094173431396... |
func NewQuestionController(questionServ service.QuestionService, jwtServ service.JWTService) QuestionController {
return &questionController{
questionService: questionServ,
jwtService: jwtServ,
}
} | [
0.6817805171012878,
-0.8116306662559509,
0.47063612937927246,
-0.05756939947605133,
-1.1489475965499878,
0.6033369898796082,
-0.9376431107521057,
-1.0549410581588745,
0.5944236516952515,
-0.19777162373065948,
-0.08371024578809738,
0.4756467938423157,
0.45749160647392273,
0.9259451031684875... |
func (c *questionController) All(context *gin.Context) {
pagination := utils.GeneratePaginationFromRequest(context)
var question entity.Question
var questions []entity.Question = c.questionService.All(&question, &pagination)
res := helper.BuildResponse(true, "OK!", questions)
context.JSON(http.StatusOK, res)
} | [
0.22222058475017548,
-1.4998247623443604,
0.5716648697853088,
0.41452664136886597,
0.6851739287376404,
0.6862668991088867,
-0.36226385831832886,
0.22461462020874023,
-0.13603012263774872,
0.18161547183990479,
0.3453702926635742,
0.5016118288040161,
0.8286292552947998,
1.0806151628494263,
... |
func (c *questionController) FindByID(context *gin.Context) {
id, err := strconv.ParseUint(context.Param("id"), 0, 0)
if err != nil {
res := helper.BuildErrorResponse("No param id was found", err.Error(), helper.EmptyObj{})
context.AbortWithStatusJSON(http.StatusBadRequest, res)
return
}
var question entity.Q... | [
0.21823133528232574,
-0.8547124862670898,
0.6328897476196289,
-0.19254423677921295,
-0.08019208163022995,
0.3746652603149414,
0.18128544092178345,
-0.7060667276382446,
-0.009546162560582161,
0.5445743799209595,
0.05869065970182419,
0.0974789708852768,
-0.23300863802433014,
1.46478891372680... |
func (c *questionController) Update(context *gin.Context) {
var questionUpdateDTO dto.QuestionUpdateDTO
errDTO := context.ShouldBind(&questionUpdateDTO)
if errDTO != nil {
res := helper.BuildErrorResponse("Failed to process request", errDTO.Error(), helper.EmptyObj{})
context.JSON(http.StatusBadRequest, res)
r... | [
-0.11231942474842072,
-1.0546095371246338,
0.8252686858177185,
0.71868896484375,
-1.1932318210601807,
0.7388888597488403,
0.13564887642860413,
-0.27985453605651855,
0.3903043866157532,
0.38627609610557556,
0.43916457891464233,
0.7298212647438049,
-0.2031102329492569,
-0.5515392422676086,
... |
func (c *questionController) Delete(context *gin.Context) {
var question entity.Question
id, err := strconv.ParseUint(context.Param("id"), 0, 0)
if err != nil {
response := helper.BuildErrorResponse("Failed to get ID", "No param id was found", helper.EmptyObj{})
context.JSON(http.StatusBadRequest, response)
}
... | [
0.3953816294670105,
-0.6458082795143127,
0.9074057340621948,
0.8403841853141785,
-0.3724112808704376,
0.5416610240936279,
0.1385566145181656,
-0.28004783391952515,
0.614412784576416,
0.4186428487300873,
0.7962270379066467,
0.6685653328895569,
-0.3195798099040985,
-0.1534424126148224,
-0.... |
func (c *questionController) getUserIDByToken(token string) string {
aToken, err := c.jwtService.ValidateToken(token)
if err != nil {
panic(err.Error())
}
claims := aToken.Claims.(jwt.MapClaims)
id := fmt.Sprintf("%v", claims["user_id"])
return id
} | [
1.3415513038635254,
-0.7861866354942322,
0.44246867299079895,
0.05015462264418602,
-0.49983224272727966,
0.6637440919876099,
-0.17716842889785767,
-1.1559555530548096,
0.5220888257026672,
0.1523558646440506,
-0.33893758058547974,
-0.01839400641620159,
-0.1387411504983902,
-0.11310849338769... |
func New() *zap.SugaredLogger {
var config zap.Config
if os.Getenv("LOG_LEVEL") == "prod" {
config = zap.NewProductionConfig()
} else {
config = zap.NewDevelopmentConfig()
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
}
config.EncoderConfig.TimeKey = "timestamp"
config.EncoderConfig.En... | [
0.3843836188316345,
-0.8378451466560364,
0.6365266442298889,
0.3693253695964813,
-0.7746019959449768,
0.32167795300483704,
-0.37564992904663086,
0.2827100157737732,
-0.3813827335834503,
0.24276496469974518,
-0.17210696637630463,
0.45765531063079834,
0.060825165361166,
1.6780388355255127,
... |
func (f *FieldSet) String() string {
a := make([]string, len(f.fields))
for i, f := range f.fields {
a[i] = f.String()
}
return fmt.Sprintf("%v", a)
} | [
-0.43756768107414246,
-0.2398727983236313,
-0.04031483829021454,
-1.3121577501296997,
-0.251113623380661,
-0.16297361254692078,
-0.003400977933779359,
-1.2110459804534912,
-0.8503068089485168,
-0.3087211549282074,
-0.06829137355089188,
0.6200404763221741,
0.009295761585235596,
-0.446216046... |
func (f *FieldSet) NumInputField() int {
cnt := 0
for _, field := range f.fields {
if field.in() {
cnt++
}
}
return cnt
} | [
-0.1128077283501625,
0.6953118443489075,
0.639096200466156,
-0.649402916431427,
-0.7703291177749634,
-0.09976696968078613,
0.6458575129508972,
0.7844427824020386,
-0.6512995958328247,
-0.9279155731201172,
-1.4300717115402222,
-0.48731735348701477,
-0.914442241191864,
-0.25622087717056274,
... |
func (f *FieldSet) NumOutputField() int {
cnt := 0
for _, field := range f.fields {
if field.out() {
cnt++
}
}
return cnt
} | [
-0.6397556662559509,
0.5076491236686707,
0.4951026141643524,
-0.8048793077468872,
-1.0364433526992798,
-0.5451634526252747,
1.0310914516448975,
0.2119424045085907,
-0.8017712235450745,
-0.38120612502098083,
-1.3739423751831055,
-0.7790876030921936,
0.17976859211921692,
-0.38233184814453125... |
func (f *FieldSet) DataType(idx int) DataType {
return f.fields[idx].typeCode().dataType()
} | [
-0.34569051861763,
1.194865345954895,
0.011170350015163422,
-1.278188943862915,
0.5447310209274292,
-1.164162516593933,
-0.17824852466583252,
-1.0023128986358643,
0.4698999226093292,
-0.43899816274642944,
-0.3519841730594635,
0.6032963395118713,
0.09745129942893982,
-0.16048207879066467,
... |
func (f *FieldSet) DatabaseTypeName(idx int) string {
return f.fields[idx].typeCode().typeName()
} | [
-0.835637629032135,
1.129640817642212,
0.33791863918304443,
-0.5314828753471375,
-0.02692973054945469,
-0.5106154084205627,
0.13062319159507751,
-0.7591192126274109,
-0.036781471222639084,
0.6903373003005981,
-0.8964769840240479,
-0.16860035061836243,
-0.5854358077049255,
-0.15529152750968... |
func (f *FieldSet) TypeLength(idx int) (int64, bool) {
return f.fields[idx].typeLength()
} | [
-1.4737378358840942,
0.7247902154922485,
0.449001669883728,
-0.8411303758621216,
0.48308366537094116,
0.12163550406694412,
0.010366986505687237,
-1.130263090133667,
0.24149924516677856,
0.7761189937591553,
-1.0590015649795532,
0.1262689232826233,
-0.8318682909011841,
-0.5716955661773682,
... |
func (f *FieldSet) TypePrecisionScale(idx int) (int64, int64, bool) {
return f.fields[idx].typePrecisionScale()
} | [
-1.45293128490448,
0.1322171986103058,
0.6164731979370117,
-0.7638204097747803,
-0.403402179479599,
-0.5744252800941467,
-1.05203115940094,
-1.7633334398269653,
-0.4776232838630676,
0.5957496762275696,
-0.21250714361667633,
-1.0072153806686401,
-0.7383161187171936,
-0.5923858284950256,
-... |
func (f *FieldSet) TypeNullable(idx int) bool {
return f.fields[idx].nullable()
} | [
-1.160624384880066,
0.09028374403715134,
0.77439284324646,
-0.38057172298431396,
-0.022840507328510284,
-0.2962295711040497,
-0.4272902011871338,
-1.5471903085708618,
-0.58072429895401,
0.7803381085395813,
-0.8811336159706116,
-0.3717668354511261,
-0.547365665435791,
-0.9216770529747009,
... |
func (f *FieldSet) OutputNames(names []string) error {
i := 0
for _, field := range f.fields {
if field.out() {
if i >= len(names) { // assert names size
return fmt.Errorf("names size too short %d - expected min %d", len(names), i)
}
names[i] = field.name(f.names)
i++
}
}
return nil
} | [
-1.2751086950302124,
0.5713068246841431,
0.44170093536376953,
-1.2614737749099731,
-0.5612014532089233,
-0.6057512760162354,
0.37800511717796326,
-0.9132922291755676,
-0.26226040720939636,
0.032632216811180115,
-0.2912544012069702,
-0.21648363769054413,
-0.22595053911209106,
-0.03207850828... |
func (f *FieldValues) NumRow() int {
return f.rows
} | [
-0.10270243883132935,
1.2110739946365356,
-0.05106763541698456,
0.21073028445243835,
-0.21424418687820435,
-0.5595747828483582,
0.37601956725120544,
0.7716413140296936,
-0.4125100076198578,
-1.575410008430481,
-0.27424952387809753,
-0.5570791363716125,
0.4432598948478699,
1.567266345024108... |
func (f *FieldValues) Row(idx int, dest []driver.Value) {
copy(dest, f.values[idx*f.cols:(idx+1)*f.cols])
if f.lobCols == 0 {
return
}
for i, descr := range f.descrs {
col := descr.col
writer := dest[col].(lobWriter)
f.writers[i] = writer
descr.w = writer
dest[col] = lobReadDescrToPointer(descr)
}
... | [
-0.6782726645469666,
0.9044144153594971,
0.35435301065444946,
-0.14603066444396973,
0.03201231732964516,
-0.4402139186859131,
-0.31614866852760315,
-0.08028300106525421,
-0.33206576108932495,
-0.6539443135261536,
0.6893976330757141,
0.00983391422778368,
0.884368360042572,
-0.18890930712223... |
func readDate(rd *bufio.Reader) (int, time.Month, int, bool, error) {
year, err := rd.ReadUint16()
if err != nil {
return 0, 0, 0, false, err
}
if (year & 0x8000) == 0 { //null value
if err := rd.Skip(2); err != nil {
return 0, 0, 0, false, err
}
return 0, 0, 0, true, nil
}
year &= 0x3fff
month, err ... | [
0.3435578942298889,
0.15375852584838867,
1.1107399463653564,
0.11855050176382065,
-0.7061612010002136,
0.8921329379081726,
-0.14993856847286224,
-0.12957032024860382,
-0.37497439980506897,
0.025586996227502823,
0.026619290933012962,
0.23213300108909607,
-0.8434662222862244,
0.9849950075149... |
func writeDate(wr *bufio.Writer, t time.Time) error {
//store in utc
utc := t.In(time.UTC)
year, month, day := utc.Date()
if err := wr.WriteUint16(uint16(year) | 0x8000); err != nil {
return err
}
if err := wr.WriteInt8(int8(month) - 1); err != nil {
return err
}
if err := wr.WriteInt8(int8(day)); err !=... | [
-0.05830012261867523,
-0.051571957767009735,
0.7038730382919312,
0.24435187876224518,
0.36854657530784607,
1.24448561668396,
-0.03483124077320099,
0.003064971650019288,
-0.3624749779701233,
-0.4306272268295288,
-0.5269376635551453,
0.1182931587100029,
-0.8887604475021362,
1.039747357368469... |
func convertTimeToLongdate(t time.Time) int64 {
t = t.UTC()
return (((((((int64(convertTimeToDayDate(t))-1)*24)+int64(t.Hour()))*60)+int64(t.Minute()))*60)+int64(t.Second()))*10000000 + int64(t.Nanosecond()/100) + 1
} | [
-0.3477516770362854,
-0.09959173202514648,
0.6975430846214294,
-0.5550394058227539,
-0.18729104101657867,
-0.9764847755432129,
-1.4563194513320923,
0.12496906518936157,
0.5360382795333862,
0.2922351360321045,
-0.34530386328697205,
-0.35476139187812805,
-0.39395931363105774,
1.4035145044326... |
func readShortUtf8(rd *bufio.Reader) ([]byte, int, error) {
size, err := rd.ReadByte()
if err != nil {
return nil, 0, err
}
b, err := rd.ReadCesu8(int(size))
if err != nil {
return nil, 0, err
}
return b, int(size), nil
} | [
0.3918338716030121,
-0.5681414604187012,
0.3674832582473755,
-0.1569834202528,
-0.7512108087539673,
0.3753603994846344,
0.773003876209259,
0.6440373063087463,
0.40132778882980347,
0.17347900569438934,
-0.543027400970459,
0.540745198726654,
-0.1846427023410797,
-0.022152503952383995,
1.18... |
func writeLob(wr *bufio.Writer) error {
if err := wr.WriteByte(0); err != nil {
return err
}
if err := wr.WriteInt32(0); err != nil {
return err
}
if err := wr.WriteInt32(0); err != nil {
return err
}
return nil
} | [
-0.10554780811071396,
-0.13742247223854065,
1.0331920385360718,
-0.5381534099578857,
0.991303563117981,
1.1694104671478271,
0.7122624516487122,
-0.3439866900444031,
-0.580362856388092,
-0.8316120505332947,
-0.6029595136642456,
-0.23919205367565155,
-0.22743619978427887,
0.9876818656921387,... |
func CreateUser(db *mongo.Client, w http.ResponseWriter, r *http.Request) {
user, err := parseUser(r)
if err != nil {
log.Fatal(err)
}
user.Password = encryptPassword([]byte(user.Password))
_, err = db.Database("charon").Collection("users").InsertOne(context.TODO(), user)
if err != nil {
log.Fatal(err)
}
io... | [
0.08768880367279053,
0.01160460989922285,
0.7122145295143127,
0.8758459687232971,
1.0600296258926392,
0.8726760745048523,
0.10007448494434357,
0.2848562002182007,
-0.0983106717467308,
0.3348183333873749,
-1.0450105667114258,
-0.5745835304260254,
-0.6061142683029175,
0.015017753466963768,
... |
func AuthUser(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "User created.")
} | [
0.1363515555858612,
-0.9706532955169678,
0.3334871232509613,
0.8984583616256714,
0.23858219385147095,
-0.05447069928050041,
1.1507171392440796,
-0.6710814237594604,
-0.3768450617790222,
-0.5911318063735962,
-0.5800793766975403,
0.23649050295352936,
0.5477207899093628,
0.2662402093410492,
... |
func generatePseudoRand() string {
alphanum := "0123456789abcdefghigklmnopqrst"
var bytes = make([]byte, 10)
rand.Read(bytes)
for i, b := range bytes {
bytes[i] = alphanum[b%byte(len(alphanum))]
}
return string(bytes)
} | [
-0.46279850602149963,
-0.1139196828007698,
0.8550362586975098,
-1.1292234659194946,
-0.6025048494338989,
0.9990522861480713,
-0.5552492737770081,
0.6192679405212402,
0.776340901851654,
-0.0052934749983251095,
-1.0007587671279907,
0.00020329705148469657,
-1.345772385597229,
0.20715740323066... |
func (e *eventManager) cleanup() {
now := time.Now()
if now.Sub(e.lastRun).Seconds() < eventExpiry {
return
}
for s, ev := range e.events {
if now.Sub(ev.at).Seconds() > eventExpiry {
delete(e.events, s)
}
}
e.lastRun = now
} | [
0.49764135479927063,
-0.9097819924354553,
0.7132053971290588,
-0.33960404992103577,
-0.43011289834976196,
-0.22290317714214325,
-0.03540516644716263,
0.2576805055141449,
0.6391401290893555,
-0.10261846333742142,
0.6751267313957214,
0.015789231285452843,
0.04711870104074478,
1.2302520275115... |
func (e *eventManager) pub(service string, version uint64, action, info string) {
e.mtx.Lock()
defer e.mtx.Unlock()
e.cleanup()
now := time.Now()
name := fmt.Sprintf("%s%d", service, version)
ev, ok := e.events[name]
if ok {
if ev.action == action && now.Sub(ev.at).Seconds() < eventTTL {
return
}
}
p... | [
0.08707667887210846,
-0.0010993395699188113,
0.3678877055644989,
0.13246925175189972,
-0.32644832134246826,
0.5371601581573486,
-0.20690132677555084,
0.552864670753479,
-0.5544463396072388,
0.02503020502626896,
0.20822712779045105,
0.2340550422668457,
0.117340087890625,
0.7603853344917297,... |
func (e *eventManager) pubNSQ(service string, version uint64, action, info, mClass, user string) {
event := eventToNSQ(service, version, action, info, mClass, user)
bytes, err := json.Marshal(event)
if err != nil {
log.Errorf("Error marshaling nsq event message for %v:%v", service, err)
return
}
err = nsq.Publ... | [
0.2380560040473938,
-0.586254894733429,
0.29192468523979187,
0.3834676146507263,
-0.9008224010467529,
-0.11734256893396378,
-0.7237986326217651,
-0.4267094135284424,
-0.2758176326751709,
0.6137890219688416,
-0.35980576276779175,
0.9418014287948608,
0.35125744342803955,
1.439909815788269,
... |
func Provisioned(service string, version uint64) {
defaultManager.pub(service, version, provisioned, "")
} | [
0.6448633670806885,
-0.6799989342689514,
0.15370947122573853,
0.6802203059196472,
0.35396820306777954,
0.14197498559951782,
-0.5604130029678345,
0.5080205202102661,
0.3319259583950043,
-0.020126527175307274,
-1.2459897994995117,
0.4026721119880676,
0.006793071981519461,
0.48620814085006714... |
func Deprovisioned(service string, version uint64) {
defaultManager.pub(service, version, deprovisioned, "")
} | [
0.07518505305051804,
0.15579864382743835,
0.23895405232906342,
0.428650438785553,
0.12754520773887634,
-0.2849467098712921,
-0.7211642861366272,
1.001081943511963,
-0.05040115490555763,
-0.06040804833173752,
-0.7947099208831787,
0.6158749461174011,
-0.9533567428588867,
0.22425006330013275,... |
func ProvisionedToNSQ(service string, version uint64, mClass, user string) {
defaultManager.pubNSQ(service, version, provisioned, "", mClass, user)
} | [
0.19007179141044617,
-0.6521823406219482,
0.1869456022977829,
0.7989029884338379,
-0.5069229006767273,
-0.1274634450674057,
-0.9757953882217407,
-0.15399418771266937,
0.6408294439315796,
0.45411446690559387,
-0.8861679434776306,
0.647311806678772,
0.3894455134868622,
0.7448246479034424,
... |
func DeprovisionedToNSQ(service string, version uint64, mClass, user string) {
defaultManager.pubNSQ(service, version, deprovisioned, "", mClass, user)
} | [
0.000782293442171067,
0.07219376415014267,
0.2854230999946594,
0.5876679420471191,
-0.6797505021095276,
-0.39431077241897583,
-1.0718477964401245,
0.21739372611045837,
0.3400990962982178,
-0.02783947065472603,
-0.5557518005371094,
0.6095174551010132,
0.04214666411280632,
0.9090654253959656... |
func RestartedToNSQ(service string, version uint64, user string) {
defaultManager.pubNSQ(service, version, restarted, "", mclass, user)
} | [
0.7369834780693054,
-0.29608356952667236,
0.02231067232787609,
0.603328287601471,
-0.3550006151199341,
-0.618013322353363,
-0.8251376748085022,
0.19126324355602264,
0.46098804473876953,
0.13792508840560913,
-1.3836708068847656,
1.1552180051803589,
-0.15290631353855133,
0.21252323687076569,... |
func (*FeeLimit) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _FeeLimit_OneofMarshaler, _FeeLimit_OneofUnmarshaler, _FeeLimit_OneofSizer, []interface{}{
(*FeeLimit_Fixe... | [
-0.2194548398256302,
0.43479177355766296,
0.5657569169998169,
-0.8682975769042969,
-0.15468667447566986,
-0.6497092247009277,
0.25185418128967285,
-0.9944868087768555,
0.653866708278656,
-0.4325205683708191,
-0.6703764200210571,
0.37289959192276,
-0.6692674160003662,
0.32528918981552124,
... |
func (m *SendToRouteRequest) GetRoutes() []*Route {
if m != nil {
return m.Routes
}
return nil
} | [
0.10607916861772537,
0.9519517421722412,
0.09655793756246567,
0.527881920337677,
1.4196627140045166,
-0.3088345527648926,
-0.07255285233259201,
-0.6835493445396423,
0.5331304669380188,
-1.0021765232086182,
0.18082325160503387,
-0.3718639612197876,
-0.39954298734664917,
0.6804339289665222,
... |
func (*ChannelPoint) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _ChannelPoint_OneofMarshaler, _ChannelPoint_OneofUnmarshaler, _ChannelPoint_OneofSizer, []interface{}{
... | [
0.1901291310787201,
0.2419692426919937,
0.4214514195919037,
-0.5610455870628357,
0.7799561023712158,
-0.6920948028564453,
0.380973756313324,
-0.9441083669662476,
0.4542495906352997,
0.01121051236987114,
-0.23466847836971283,
0.3098774552345276,
-0.5402578711509705,
0.5613821148872375,
0.... |
func (m *GetInfoResponse) GetTestnet() bool {
if m != nil {
return m.Testnet
}
return false
} | [
-0.2439582645893097,
0.06139242649078369,
0.2267448604106903,
-0.30704179406166077,
0.8578243851661682,
0.06401482969522476,
0.0899307131767273,
-1.4379631280899048,
0.4889903664588928,
-1.3601242303848267,
-0.644258439540863,
-0.7619191408157349,
-1.3515530824661255,
0.35305649042129517,
... |
func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSiz... | [
-0.817213773727417,
0.08211695402860641,
0.6177303791046143,
-0.143428772687912,
-0.35051894187927246,
-0.1077253669500351,
0.32859182357788086,
-1.0870611667633057,
0.1617857664823532,
-0.773406445980072,
-0.047904375940561295,
-0.07396862655878067,
-0.6196096539497375,
1.1260160207748413... |
func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, ... | [
-0.6293236613273621,
0.11369403451681137,
0.4885028004646301,
-0.7351489663124084,
-0.2557604908943176,
-0.633662223815918,
0.01644916646182537,
-0.559455156326294,
0.42322713136672974,
-0.7629733681678772,
-0.2765050232410431,
-0.17017202079296112,
-0.5660991072654724,
0.7187290191650391,... |
func (*ChannelEventUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _ChannelEventUpdate_OneofMarshaler, _ChannelEventUpdate_OneofUnmarshaler, _ChannelEventUpdate_Oneo... | [
0.12588617205619812,
-0.3970801830291748,
0.5632694959640503,
-0.7592895030975342,
0.04028758779168129,
-0.8063604235649109,
-0.08114813268184662,
-0.38462239503860474,
0.2849256098270416,
-0.4098089933395386,
-0.2915274202823639,
-0.2480723112821579,
-0.959209144115448,
0.1011411994695663... |
func (m *QueryRoutesRequest) GetNumRoutes() int32 {
if m != nil {
return m.NumRoutes
}
return 0
} | [
0.011404749006032944,
1.1174191236495972,
0.26875078678131104,
0.7422665953636169,
0.9230738282203674,
-0.147526815533638,
0.12726232409477234,
-0.06372936815023422,
0.6718084216117859,
-1.4461804628372192,
-0.2132236659526825,
-0.6421288847923279,
-0.8386051058769226,
0.33595019578933716,... |
func (m *Hop) GetAmtToForward() int64 {
if m != nil {
return m.AmtToForward
}
return 0
} | [
0.49692338705062866,
0.22811689972877502,
0.5167054533958435,
-0.2657981216907501,
-0.3994782865047455,
0.29797297716140747,
0.19023685157299042,
0.09672042727470398,
-0.13964124023914337,
-0.7489518523216248,
-0.12183169275522232,
0.5593816637992859,
0.6554495692253113,
0.6575378179550171... |
func (m *Hop) GetFee() int64 {
if m != nil {
return m.Fee
}
return 0
} | [
0.2659975290298462,
0.8462294936180115,
0.2318611741065979,
1.7375917434692383,
0.8941839337348938,
-0.3746606409549713,
0.6685174703598022,
0.19249451160430908,
-0.032051775604486465,
-0.82908034324646,
0.5267293453216553,
-0.6709221005439758,
-0.8758917450904846,
1.66657292842865,
0.53... |
func (m *Route) GetTotalFees() int64 {
if m != nil {
return m.TotalFees
}
return 0
} | [
0.520401656627655,
0.299019455909729,
0.6083367466926575,
0.6425347924232483,
0.873046338558197,
-0.7261111736297607,
0.41771116852760315,
0.7728758454322815,
1.0364069938659668,
-0.1785760223865509,
0.11223812401294708,
-0.5022990107536316,
-1.4264750480651855,
0.31158435344696045,
0.54... |
func (m *Route) GetTotalAmt() int64 {
if m != nil {
return m.TotalAmt
}
return 0
} | [
0.26372984051704407,
-0.17947956919670105,
0.6252244114875793,
-0.09103166311979294,
0.5859699249267578,
-0.031173037365078926,
0.6037068963050842,
0.4327316880226135,
1.1002103090286255,
-0.3653208911418915,
0.5161769390106201,
-0.3544032871723175,
-0.15851740539073944,
0.2533521056175232... |
func (m *Invoice) GetReceipt() []byte {
if m != nil {
return m.Receipt
}
return nil
} | [
0.8556913733482361,
0.7156458497047424,
0.4359424114227295,
0.8204032182693481,
0.37984153628349304,
0.10818489640951157,
0.15300478041172028,
-0.0061071449890732765,
0.9349284768104553,
-0.9565953016281128,
0.21228711307048798,
-0.4784471094608307,
-0.5666719079017639,
-0.7552810311317444... |
func (m *Invoice) GetSettled() bool {
if m != nil {
return m.Settled
}
return false
} | [
0.6622288823127747,
0.3604573607444763,
0.6072872877120972,
-0.24353204667568207,
0.7018697261810303,
0.5352726578712463,
-0.27329304814338684,
0.4318445920944214,
-0.022319432348012924,
-0.9153518080711365,
-0.3675909638404846,
0.33010709285736084,
-1.3503910303115845,
-0.0769664943218231... |
func (m *Invoice) GetAmtPaid() int64 {
if m != nil {
return m.AmtPaid
}
return 0
} | [
0.7103108763694763,
-0.35267525911331177,
0.6928600072860718,
-0.16313400864601135,
-0.07717282325029373,
0.8202371597290039,
-0.40589937567710876,
0.16918231546878815,
1.2579467296600342,
0.3965127766132355,
0.43204542994499207,
-0.17023317515850067,
-1.019980788230896,
-0.117942184209823... |
func (m *Payment) GetValue() int64 {
if m != nil {
return m.Value
}
return 0
} | [
0.4680696725845337,
1.1958661079406738,
0.4900268316268921,
0.8034792542457581,
0.513080358505249,
-0.6593962907791138,
0.003449964802712202,
-0.00632453290745616,
0.776168942451477,
-0.16103918850421906,
1.3366118669509888,
-0.4459107220172882,
-0.3546736240386963,
0.9948833584785461,
0... |
func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_... | [
-1.132877230644226,
0.253662109375,
0.5192496180534363,
-0.4711391031742096,
0.0800614207983017,
-0.4551333785057068,
-0.19280262291431427,
-0.9569785594940186,
0.5821316242218018,
-0.1485850065946579,
-0.04010233283042908,
0.09762419015169144,
-0.3340367078781128,
0.8132902383804321,
0.... |
func WithContext(ctx *Context) *option.Option {
return &option.Option{
Context: ctx,
}
} | [
0.16630998253822327,
0.24724715948104858,
0.13873007893562317,
-0.4912680387496948,
-0.12287072092294693,
0.17537975311279297,
-0.7549328804016113,
-1.4139810800552368,
1.7916183471679688,
-0.4075734615325928,
-0.2322949767112732,
0.08644584566354752,
0.22655026614665985,
-1.43134939670562... |
func Exists(opt *option.Option) bool {
return opt != nil && opt.Context != nil
} | [
-0.53892582654953,
-0.2524818778038025,
0.5438802242279053,
-0.2134293019771576,
0.7179311513900757,
-0.24242177605628967,
-0.8642605543136597,
0.39760786294937134,
1.4906871318817139,
0.11701136827468872,
-0.1626560240983963,
-0.1630856692790985,
-0.3158470094203949,
-0.360596626996994,
... |
func New(opts ...*option.Option) *Context {
merged := option.Merge(opts...)
var ctx *Context
if merged.Context != nil {
var castOK bool
ctx, castOK = merged.Context.(*Context)
if !castOK {
panic("passed in a non-Context for the WithContext() function!")
}
return ctx
}
ctx = &Context{
alert: option.... | [
0.00201783562079072,
-0.6901719570159912,
0.6480487585067749,
0.6122594475746155,
-0.5983114838600159,
-0.1875237077474594,
0.1397804468870163,
-0.3036477863788605,
1.235527515411377,
-0.05663156881928444,
0.19026361405849457,
-0.3567798435688019,
0.3234241306781769,
0.4759533107280731,
... |
func FromEnv() *Context {
chrootVal := option.EnvOrDefaultChroot()
enableTools := option.EnvOrDefaultTools()
snapPathVal := option.EnvOrDefaultSnapshotPath()
snapRootVal := option.EnvOrDefaultSnapshotRoot()
snapExclusiveVal := option.EnvOrDefaultSnapshotExclusive()
return &Context{
Chroot: chrootVal,... | [
-0.06692834943532944,
-0.1403530240058899,
0.304414838552475,
0.639557421207428,
-0.31492945551872253,
-0.0041265892796218395,
0.1040210947394371,
-0.4797113835811615,
0.5353162884712219,
-0.020911190658807755,
-0.2706444263458252,
0.1772233545780182,
0.6333966255187988,
0.1180158630013465... |
func (ctx *Context) Do(fn func() error) error {
err := ctx.Setup()
if err != nil {
return err
}
defer func() {
err := ctx.Teardown()
if err != nil {
ctx.Warn("teardown error: %v", err)
}
}()
return fn()
} | [
-0.008803854696452618,
0.7093832492828369,
0.8376444578170776,
-0.009340284392237663,
0.8747873902320862,
0.1329946219921112,
0.5913807153701782,
-0.9822989106178284,
0.3897959291934967,
0.23691970109939575,
0.22749176621437073,
0.0016072349390015006,
0.6837025284767151,
-0.038451641798019... |
func (ctx *Context) Setup() error {
if ctx.err != nil {
return ctx.err
}
if ctx.SnapshotPath == "" {
// nothing to do!
return nil
}
var err error
root := ctx.SnapshotRoot
if root == "" {
root, err = snapshot.Unpack(ctx.SnapshotPath)
if err == nil {
ctx.snapshotUnpackedPath = root
}
} else {
va... | [
-0.40985825657844543,
-0.06783227622509003,
0.7541276216506958,
0.10257267951965332,
0.057044778019189835,
-0.605391263961792,
0.6020188331604004,
0.38872388005256653,
1.1776024103164673,
-0.4607180058956146,
0.08768671751022339,
-0.06938155740499496,
0.12090662866830826,
0.059612635523080... |
func (ctx *Context) Teardown() error {
if ctx.snapshotUnpackedPath == "" {
// if the client code provided the unpack directory,
// then it is also in charge of the cleanup.
return nil
}
return snapshot.Cleanup(ctx.snapshotUnpackedPath)
} | [
0.4096704125404358,
0.674074113368988,
0.5443434715270996,
-0.11703047156333923,
0.5742144584655762,
-0.07352526485919952,
1.096101999282837,
0.3913806676864624,
1.9835456609725952,
-0.9222410321235657,
0.435796856880188,
-0.16987712681293488,
0.07804762572050095,
0.2212495654821396,
-0.... |
func Dockerfile(travis *Travis, opt *DockerfileOpt, archive string) (res []byte, err error) {
var data []byte
// Loading the base template.
data, err = Asset(DockerfileAsset)
if err != nil {
return
}
base, err := template.New("").Parse(string(data))
if err != nil {
return
}
// Loading a child template.
... | [
0.3205721378326416,
0.6058768033981323,
0.68166583776474,
-0.4171648919582367,
0.00754445418715477,
-0.458520770072937,
0.23559637367725372,
-0.11836161464452744,
-1.1058241128921509,
0.32845795154571533,
-0.4222031831741333,
-0.8028596639633179,
0.08728139847517014,
-0.3635365664958954,
... |
func PrepareBaseImage(ctx context.Context, ref string, output io.Writer) (err error) {
cli, err := client.NewEnvClient()
if err != nil {
return
}
reader, err := cli.ImagePull(ctx, ref, types.ImagePullOptions{})
if err != nil {
return
}
defer reader.Close()
var log pullLog
status := make(map[string]strin... | [
-0.70151686668396,
-0.4212743043899536,
0.6050995588302612,
-0.2560015916824341,
-0.08349015563726425,
-0.4879121482372284,
-0.7052404284477234,
-0.27445709705352783,
-0.30433982610702515,
1.1208162307739258,
-0.08641009777784348,
0.44267427921295166,
0.029743850231170654,
0.81476491689682... |
func Build(ctx context.Context, dir, tag, version string, noCache bool, output io.Writer) (err error) {
// Create a docker client.
cli, err := client.NewEnvClient()
if err != nil {
return
}
defer cli.Close()
// Create a pipe.
reader, writer := io.Pipe()
// Send the build context.
go func() {
defer write... | [
-0.4324560761451721,
-0.3481602370738983,
0.7942120432853699,
0.31453683972358704,
-0.4880811870098114,
-0.6302995085716248,
0.0921723023056984,
-0.27595004439353943,
-0.6212913393974304,
0.5636082291603088,
-0.09630890190601349,
0.619211733341217,
0.7419564723968506,
-0.23318332433700562,... |
func Start(ctx context.Context, tag, name string, env []string, output io.Writer) (err error) {
// Create a docker client.
cli, err := client.NewEnvClient()
if err != nil {
return
}
defer cli.Close()
// Create a docker container.
config := container.Config{
Image: tag,
Env: env,
}
c, err := cli.Conta... | [
0.2814760208129883,
-0.536626935005188,
0.7941613793373108,
0.5984638333320618,
-0.3077777624130249,
-0.9141761064529419,
0.49168726801872253,
-0.43669095635414124,
-0.43486863374710083,
0.6118544936180115,
0.39751747250556946,
0.5596251487731934,
0.3991802930831909,
0.007029063533991575,
... |
func archiveContext(ctx context.Context, root string, writer io.Writer) (err error) {
// Create a buffered writer.
bufWriter := bufio.NewWriter(writer)
defer bufWriter.Flush()
// Create a zipped writer on the bufferd writer.
zipWriter, err := gzip.NewWriterLevel(bufWriter, gzip.BestCompression)
if err != nil {
... | [
0.198573037981987,
-0.22188636660575867,
0.9181022047996521,
-0.7555801868438721,
-0.08298663049936295,
-0.46574631333351135,
-0.020496994256973267,
-0.3627678155899048,
0.06904654949903488,
-0.017194723710417747,
0.3491474986076355,
-0.06264402717351913,
0.44062137603759766,
-0.1038060560... |
func main() {
// load data
records := loadData("data/canadianCheeseDirectory.csv", NumRecordsToLoad)
// loop until exit
for true {
// display menu and process choice
switch selection := showMenu(); selection {
case OptionReload:
fmt.Println("Reloading data...")
records = loadData("data/canadianCh... | [
0.019661687314510345,
0.1316295862197876,
0.7791909575462341,
0.24331052601337433,
0.7440698146820068,
0.42341551184654236,
0.790366530418396,
0.5434454083442688,
-0.046945519745349884,
0.12196334451436996,
0.000046763809223193675,
0.6988496780395508,
-0.21343868970870972,
0.08134210854768... |
func check(e error) {
if e != nil {
log.Fatal("Error", e)
panic(e)
}
} | [
0.4811328053474426,
0.23002737760543823,
0.2684103846549988,
1.4652084112167358,
0.47996827960014343,
0.7160692811012268,
-0.3486136198043823,
0.4011518955230713,
0.6104004383087158,
0.5688179731369019,
0.46272552013397217,
0.3591923415660858,
1.1795562505722046,
1.5802628993988037,
0.65... |
func getFirstNonEmptyStringOrNA(first string, second string) string {
if strings.TrimSpace(first) != "" {
return first
} else if strings.TrimSpace(second) != "" {
return second
} else {
return "N/A"
}
} | [
0.3355608284473419,
-0.6426290273666382,
0.6674439907073975,
-0.24551178514957428,
-0.03639423847198486,
-0.2398272156715393,
-0.6377308368682861,
-0.6611196994781494,
-0.30326056480407715,
-0.16134193539619446,
0.8718940019607544,
0.36673271656036377,
0.5520204305648804,
1.000200867652893... |
func getLinesFromCSV(filePath string) (lines [][]string, err error) {
// open file
file, err := os.Open(filePath)
check(err)
defer file.Close() // defer closing the file until function returns
// create CSV Reader from file
reader := csv.NewReader(file)
return reader.ReadAll()
} | [
0.4966578185558319,
-0.7290181517601013,
0.37654298543930054,
0.4039117991924286,
0.3402819335460663,
0.8734762668609619,
-0.16988995671272278,
-0.12247086316347122,
0.11261488497257233,
0.08547913283109665,
0.6878718137741089,
0.5330507159233093,
0.07109754532575607,
0.06690927594900131,
... |
func lineToRecord(line []string) Record {
// parse some values from strings
cheeseId, err := strconv.ParseInt(line[0], 10, 64)
if err != nil { cheeseId = 0 }
fatContentPercent, err := strconv.ParseFloat(line[10], 32)
if err != nil { fatContentPercent = 0.0 }
moisturePercent, err := strconv.ParseFloat(line[11], 3... | [
0.8498188853263855,
-0.7391471862792969,
0.670967161655426,
-0.8662551641464233,
0.06319539248943329,
-0.5453047752380371,
-0.392667680978775,
0.5058308243751526,
-0.24485018849372864,
-0.099508136510849,
0.23164775967597961,
0.6423828601837158,
-0.08443872630596161,
0.2961370646953583,
... |
func loadData(filePath string, numRecords int) []Record {
var records []Record
// Load lines from CSV
lines, err := getLinesFromCSV(filePath)
check(err)
// get rid of column names
lines = lines[1:]
// convert lines to records slice
for i := 0; i < numRecords && i < len(lines); i++ {
records = append(recor... | [
-0.01614447496831417,
-0.05300084501504898,
0.5011305212974548,
-0.058976903557777405,
0.12843161821365356,
0.2941712439060211,
-0.7635461688041687,
0.6498144865036011,
0.13303209841251373,
0.31573113799095154,
-0.15812042355537415,
0.17700742185115814,
-0.15001140534877777,
-0.14430877566... |
func showMenu() int {
selection := 0
fmt.Println("\nLucas Estienne's Canadian Cheese Directory App")
fmt.Println("Please choose from the following options:")
fmt.Printf(" %d. Reload the data\n", OptionReload)
fmt.Printf(" %d. Persist the in-memory data to file\n", OptionPersist)
fmt.Printf(" %d. Display all rec... | [
-0.025381971150636673,
-0.05563659593462944,
0.9588568210601807,
-0.3869961202144623,
0.005937907379120588,
-0.2747807204723358,
0.7490432858467102,
0.3839571177959442,
0.2523308992385864,
-0.2850862443447113,
0.22502759099006653,
0.6511630415916443,
-0.9400795698165894,
0.5820257663726807... |
func displayAllRecords(records []Record) {
fmt.Printf("\nDisplaying all records...\n\n")
for i := 0; i < len(records); i++ {
fmt.Printf("Record ID: %d: %+v\n", i, records[i])
time.Sleep(5 * time.Millisecond) // 5ms between records
}
} | [
0.9921849966049194,
-0.7055778503417969,
0.6479505896568298,
0.4451236128807068,
-0.24551385641098022,
0.6803447008132935,
0.3257584869861603,
-0.2854505479335785,
0.3947313725948334,
0.48994749784469604,
-0.018907295539975166,
0.6202141642570496,
-1.1816473007202148,
0.9809131026268005,
... |
func displayRecord(records []Record) {
id := -1
// loop until ID is valid
for id == -1 {
fmt.Printf("\n Please enter the # of the record you would like to display: ")
_, err := fmt.Scanf("%d", &id)
if err != nil {
id = -1
fmt.Println("\nPlease enter a valid integer.")
} else if id < 0 || id > len(re... | [
0.316101610660553,
-0.2721465826034546,
0.8139220476150513,
-0.37747031450271606,
-0.6441087126731873,
1.0430314540863037,
0.522915244102478,
-0.10522983968257904,
-0.27228260040283203,
-0.12195849418640137,
0.5067880749702454,
0.8549560904502869,
-0.9582785964012146,
0.34778210520744324,
... |
func deleteRecordFromSlice(slice []Record, id int) []Record {
return append(slice[:id], slice[id+1:]...)
} | [
-0.10016743838787079,
-0.7779847979545593,
0.3112297058105469,
0.199997216463089,
-0.3450812101364136,
0.03561072424054146,
-1.2711883783340454,
-0.10664667934179306,
0.1387779265642166,
0.8119518160820007,
-0.46039119362831116,
1.192718505859375,
-0.6315339803695679,
0.01797466352581978,
... |
func readString(toRead string) string {
fmt.Printf("Please enter the %s: ", toRead)
// read from scanner
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
s := scanner.Text()
if s == "" {
s = "N/A"
}
return s
} | [
-0.44815871119499207,
-0.2139798104763031,
0.618529200553894,
0.3523050844669342,
-0.7840218544006348,
1.225013256072998,
0.3465555012226105,
-0.7121862769126892,
-0.28326427936553955,
-0.05241725221276283,
1.6786197423934937,
-0.1936478614807129,
-0.11996865272521973,
-0.37965792417526245... |
func recordToSlice(record Record) []string {
var recordSlice []string
recordSlice = []string{
fmt.Sprintf("%d",record.CheeseId), record.CheeseName, record.ManufacturerName, record.ManufacturerProvCode,
record.ManufacturingType, record.WebSite, fmt.Sprintf("%.2f", record.FatContentPercent),
fmt.Sprintf("%.2f",... | [
-0.5509766340255737,
-0.8950227499008179,
0.4918637275695801,
-0.7581074833869934,
0.33677297830581665,
-0.6521401405334473,
-0.5713611245155334,
-0.25346463918685913,
-0.14176714420318604,
1.7112966775894165,
-0.674126923084259,
1.00696861743927,
0.09555569291114807,
0.7163330912590027,
... |
func persistToFile(records []Record, filePath string) {
fmt.Printf("\n Writing all in-memory records to %s.\n", filePath)
headers := []string {
"CheeseId", "CheeseName", "ManufacturerName", "ManufacturerProvCode", "ManufacturingType",
"WebSite", "FatContentPercent", "MoisturePercent", "Particularities", "Flav... | [
0.24104885756969452,
-0.586750328540802,
0.6590735912322998,
-0.14348958432674408,
1.2948243618011475,
0.3221413493156433,
0.31313562393188477,
0.3384847044944763,
-0.4467717707157135,
0.7088316679000854,
-0.0056257485412061214,
0.6327822804450989,
-0.6489911079406738,
0.5746105313301086,
... |
func readNewOrKeepDefaultString(toRead string, def string) string {
fmt.Printf("Please enter the %s [%s]: ", toRead, def)
// read from scanner
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
s := scanner.Text()
if s == "" {
s = def
}
return s
} | [
-0.060370251536369324,
0.32276836037635803,
0.5525553822517395,
0.32500407099723816,
-0.21316610276699066,
0.4457416832447052,
-0.35773488879203796,
-0.5557073950767517,
-0.378927081823349,
0.30962586402893066,
0.5331853032112122,
0.18976810574531555,
-0.8887330889701843,
-0.50584751367568... |
func editRecord(records []Record) []Record {
var recordSlice []string
id := -1
// loop until ID is valid
for id == -1 {
fmt.Printf("\n Please enter the # of the record you would like to edit: ")
_, err := fmt.Scanf("%d", &id)
if err != nil {
id = -1
fmt.Println("\nPlease enter a valid integer.")
} ... | [
-0.3022521734237671,
-0.5632711052894592,
0.6905502080917358,
-0.2264479398727417,
0.04901590943336487,
0.01304855290800333,
0.3016635775566101,
-0.13733771443367004,
-0.7148044109344482,
0.5769004821777344,
0.20493973791599274,
0.7620535492897034,
-0.7000430822372437,
0.9248223900794983,
... |
func NewCron() engine.Action {
return &Cron{}
} | [
0.8194368481636047,
-0.79537433385849,
0.341670423746109,
1.1987709999084473,
-0.14718784391880035,
-0.9021276831626892,
0.2644685208797455,
-0.06378785520792007,
0.0668407529592514,
-0.5322389602661133,
-0.23709996044635773,
1.099961757659912,
0.027446316555142403,
0.3596529960632324,
0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.