text
stringlengths
11
6.3k
embedding
listlengths
768
768
func homeDirPath() string { homeDir, err := os.UserHomeDir() if err != nil { return "." } return homeDir }
[ 0.9040952324867249, -1.048691749572754, 0.5503021478652954, 1.2525322437286377, -0.7501285076141357, 0.9185113310813904, 0.14097440242767334, -0.6732398867607117, 0.41467633843421936, 0.547066867351532, 0.4963347017765045, -0.36765792965888977, -1.1202820539474487, 0.514853835105896, 0.4...
func readBytesFromFile(reader io.Reader) ([]byte, error) { configBytes, err := ioutil.ReadAll(reader) if err != nil { return nil, err } return configBytes, nil }
[ -0.374150812625885, 0.44934508204460144, 0.12688769400119781, -0.20468385517597198, -0.7561406493186951, 0.5273716449737549, -0.1964505910873413, 0.0725024938583374, -1.143257737159729, 0.38050079345703125, -0.1849987804889679, -0.12309983372688293, -0.8438507914543152, 1.079350471496582, ...
func archiveProject(writer io.Writer, sourcePath, module, version string) error { // Ignoring unnecessary file ignoreParser, err := getIgnoreParser(sourcePath) if err != nil { return nil } zipWriter := zip.NewWriter(writer) defer zipWriter.Close() return filepath.Walk(sourcePath, func(path string, info os.Fil...
[ 0.11543582379817963, -0.28761589527130127, 0.7520584464073181, -0.03526174649596214, -0.5626930594444275, 0.30598804354667664, 0.44912946224212646, 0.01527483481913805, -0.0679515153169632, 0.7373414039611816, -0.03399770334362984, -0.38886648416519165, -0.42769065499305725, -0.60918962955...
func getIgnoreParser(sourcePath string) (ignore.IgnoreParser, error) { exists, err := fileutils.IsFileExists(filepath.Join(sourcePath, ".gitignore")) if err != nil { return nil, err } if exists { return ignore.CompileIgnoreFileAndLines(filepath.Join(sourcePath, ".gitignore"), "vendor", ".gitignore") } return...
[ 0.1234312430024147, -0.18986324965953827, 0.8230265378952026, -0.38480058312416077, 0.07899151742458344, 0.05625617131590843, -0.2018948644399643, 0.07608608901500702, 0.33801013231277466, 0.16754962503910065, -0.616755485534668, -0.10186190903186798, -0.6873483061790466, 0.488215416669845...
func (o LookupConsentStoreIamPolicyResultOutput) Etag() pulumi.StringOutput { return o.ApplyT(func(v LookupConsentStoreIamPolicyResult) string { return v.Etag }).(pulumi.StringOutput) }
[ 0.6347780227661133, -0.009293632581830025, 0.2702319025993347, -0.8129377961158752, 0.5193556547164917, 1.1617547273635864, -0.1644035279750824, 0.19628022611141205, 0.7302964925765991, 0.8629468083381653, 0.37215280532836914, -0.41298773884773254, 0.5119279026985168, -0.7092527151107788, ...
func (o LookupConsentStoreIamPolicyResultOutput) Id() pulumi.StringOutput { return o.ApplyT(func(v LookupConsentStoreIamPolicyResult) string { return v.Id }).(pulumi.StringOutput) }
[ 0.9634196162223816, -0.4927058815956116, 0.13254056870937347, -0.3612777292728424, 0.32268956303596497, 1.3475372791290283, 0.0378849022090435, 0.15959680080413818, 1.7518476247787476, 0.40231820940971375, 0.2429775446653366, -0.13788069784641266, -0.27585771679878235, -1.2364717721939087,...
func (o LookupConsentStoreIamPolicyResultOutput) PolicyData() pulumi.StringOutput { return o.ApplyT(func(v LookupConsentStoreIamPolicyResult) string { return v.PolicyData }).(pulumi.StringOutput) }
[ 0.558525800704956, -0.3442305028438568, 0.20377473533153534, -0.8169170022010803, 0.09544263780117035, 2.14672589302063, -0.4981289505958557, 0.08975598961114883, 1.6316205263137817, -0.19774536788463593, 0.3831605613231659, 0.19843077659606934, 0.3171996474266052, -1.5250324010849, -0.1...
func (format *Move) Configure(conf core.PluginConfigReader) { }
[ -0.4336748719215393, -1.0646930932998657, 0.3991250991821289, 0.6317161917686462, 0.3739289939403534, -1.4951443672180176, 0.04655712470412254, 0.41143059730529785, -0.44470128417015076, 0.3141423463821411, -0.2683250308036804, -0.7012984752655029, -0.18329153954982758, 0.6605222821235657,...
func (format *Move) ApplyFormatter(msg *core.Message) error { srcData := format.GetSourceData(msg) format.SetTargetData(msg, srcData) format.SetSourceData(msg, nil) return nil }
[ -0.8833286762237549, -0.5296177864074707, 0.47226327657699585, -1.0713368654251099, -0.4568783938884735, -0.28413742780685425, -0.04114017263054848, 0.8696842789649963, 0.4608360826969147, -1.196663737297058, 0.35785433650016785, 0.7512141466140747, -0.03911083936691284, 2.4218456745147705...
func (w *Watches) GetInput() (input.Input, error) { if w.Path == "" { w.Path = WatchesFile } w.TemplateBody = watchesAnsibleTmpl w.RolesDir = RolesDir return w.Input, nil }
[ 0.4297526180744171, 0.47337067127227783, 0.42360442876815796, 0.09754639863967896, 0.14549089968204498, 1.0353078842163086, 1.601707935333252, -0.37039631605148315, 0.33888089656829834, -0.5997520685195923, 0.43860194087028503, 0.39625251293182373, -0.47687384486198425, 0.4183441996574402,...
func NewHTTPServer(port string) (*http.Server, error) { s := &server{} mux := mux.NewRouter() mux.Handle("/", handler.Playground("LINGVA Playground", "/graphql")) config := gql.Config{Resolvers: s} mux.Handle("/graphql", auth.ValidateMiddleware(handler.GraphQL( gql.NewExecutableSchema(config), handler.Error...
[ -0.6052097678184509, -0.15886932611465454, 0.5901296734809875, -0.4151371121406555, -0.27581706643104553, 0.38175514340400696, 0.023877831175923347, -1.081768274307251, -0.23666130006313324, 0.05430230125784874, -0.24410240352153778, 0.16328352689743042, -0.06024675443768501, 0.29107540845...
func isHappy(n int) bool { slow, fast := n, next(n) for fast != 1 && slow != fast { // we don't need to worry about fast goes up to infinity slow = next(slow) fast = next(next(fast)) } return fast == 1 }
[ -0.7775993943214417, 0.8668304681777954, 0.6422141194343567, 0.29518625140190125, 0.4599023461341858, -0.5908958911895752, -0.07556349039077759, -0.3779791295528412, 0.6517441272735596, -0.5827301144599915, -1.082202672958374, 0.09524049609899521, -0.4243212342262268, 1.2325791120529175, ...
func statHeader(info os.FileInfo, header *Header) {}
[ 0.22923259437084198, -1.7937670946121216, 0.46527108550071716, 0.6897423267364502, -0.16502194106578827, -0.13842014968395233, -0.010850436054170132, -0.07273969799280167, -0.47543710470199585, -0.7296255230903625, -0.5538625121116638, -0.05553241819143295, 0.04258909076452255, 0.190668046...
func (u *User) Create(ctx context.Context, log *log.Logger, w http.ResponseWriter, r *http.Request, params map[string]string) error { var newU NewUser if err := web.Unmarshal(r.Body, &newU); err != nil { return errors.Wrap(err, "") } id, err := uuid.NewV4() if err != nil { return err } userDetails := Use...
[ -0.16759136319160461, 0.25410696864128113, 0.8788864612579346, 0.5885561108589172, 0.3078276813030243, 0.6769667267799377, 0.2449677437543869, 0.11166989058256149, -0.7499194741249084, 0.3871736526489258, -0.99370938539505, -0.6892704367637634, -0.6313936114311218, 0.4985639750957489, 0....
func (u *User) Retrieve(ctx context.Context, log *log.Logger, w http.ResponseWriter, r *http.Request, params map[string]string) error { queryParams := r.URL.Query() var email, id string var usr *UserDetails var err error if len(queryParams["email"]) > 0 { // TODO: add email validation email = queryParams["emai...
[ 0.2565411925315857, 0.19105975329875946, 0.761536180973053, 0.17884203791618347, 0.36672818660736084, -0.3796311318874359, 0.13156625628471375, 0.5833705067634583, 0.32549193501472473, -0.42505085468292236, 0.21910938620567322, -0.0939808189868927, -0.9751818180084229, -0.00852104369550943...
func queryByEmail(dbConn *db.DB, email string) (*UserDetails, error) { var id *string f := func(db *leveldb.DB) error { data, err := db.Get([]byte(email), nil) if err != nil { return err } tempID := string(data) id = &tempID return nil } if err := dbConn.Execute(f); err != nil { return nil, errors...
[ 0.8631831407546997, 0.8967667818069458, 0.4225520193576813, -0.38687577843666077, 0.2463838756084442, -0.2017693668603897, -0.08329244703054428, -0.2125387191772461, -0.33121439814567566, -0.00003310955435154028, -0.32868674397468567, -0.03684277459979057, -1.1843770742416382, -0.328553318...
func EnsureAtlasRegion(region string) string { r := strings.ToUpper(strings.Replace(string(region), "-", "_", -1)) log.Printf("EnsureAtlasRegion--- region:%s r:%s", region,r) return r }
[ 0.2290377914905548, -0.3620327413082123, 0.3184920847415924, -0.45732900500297546, -0.2893756926059723, 0.16697490215301514, -0.29101982712745667, -0.40384694933891296, 0.2943139672279358, 0.02782360091805458, 0.210658997297287, 0.36549362540245056, 0.9141677021980286, 0.15505751967430115,...
func EnsureAWSRegion(region string) string { r := strings.ToLower(strings.Replace(string(region), "_", "-", -1)) log.Printf("EnsureAWSRegion--- region:%s r:%s", region,r) return r }
[ 0.014234346337616444, -0.3626358211040497, 0.4122602343559265, -1.6335575580596924, -0.5537780523300171, -0.25607141852378845, -0.002515528816729784, -1.0488085746765137, 0.7004204988479614, -0.20417127013206482, 0.15605957806110382, 0.3935093283653259, 0.06985727697610855, 0.3221418261528...
func addCollector(d *schema.ResourceData, m interface{}) error { client := m.(*lmclient.LMSdkGo) collector := makeDeviceCollectorObject(d) params := lm.NewAddCollectorParams() params.SetBody(&collector) // calling API to add collector to portal log.Printf("Adding collector") restCollectorResponse, err := client....
[ -0.45704394578933716, -0.46234530210494995, 0.6609209775924683, -0.7308423519134521, -0.4836740493774414, 0.7783746719360352, -0.42709532380104065, -0.20554538071155548, 0.34046033024787903, -0.7448634505271912, 0.3737695813179016, -0.2962063252925873, -0.3203425109386444, 0.94554316997528...
func readCollector(d *schema.ResourceData, m interface{}) error { client := m.(*lmclient.LMSdkGo) // get collector id id, err := strconv.Atoi(d.Id()) if err != nil { return err } params := lm.NewGetCollectorByIDParams() params.SetID(int32(id)) restCollectorResponse, err := client.LM.GetCollectorByID(params...
[ 0.0987207219004631, -1.3966190814971924, 0.7728041410446167, -0.9324825406074524, -0.6704084277153015, -0.6408610343933105, -0.4172479808330536, -0.5555128455162048, -0.17748333513736725, -0.34173882007598877, -0.1895519345998764, 0.027202438563108444, -0.03888818249106407, 0.0409904271364...
func updateCollector(d *schema.ResourceData, m interface{}) error { d.Partial(true) client := m.(*lmclient.LMSdkGo) collector := makeDeviceCollectorObject(d) // get collector id id, err := strconv.Atoi(d.Id()) if err != nil { return err } params := lm.NewUpdateCollectorByIDParams() params.SetID(int32(id)) ...
[ -0.6646670699119568, -1.515259861946106, 0.7449149489402771, -0.5358238816261292, -0.836965799331665, -0.6831635236740112, -0.3196510374546051, -0.5411482453346252, -0.2908976376056671, 0.10625872015953064, -0.00004496046312851831, 0.09319289773702621, -0.2106226533651352, 0.38475009799003...
func deleteCollector(d *schema.ResourceData, m interface{}) error { client := m.(*lmclient.LMSdkGo) // get collector id id, err := strconv.Atoi(d.Id()) if err != nil { return err } params := lm.NewDeleteCollectorByIDParams() params.SetID(int32(id)) restCollectorResponse, err := client.LM.DeleteCollectorByI...
[ -0.19906111061573029, -0.9961363673210144, 0.633858323097229, -0.6180650591850281, -0.5833789706230164, -0.03410826250910759, -0.10445737838745117, -0.3989543914794922, 0.3197442889213562, -0.5292569398880005, -0.10542266070842743, 0.31573930382728577, -0.1893947273492813, 0.97729080915451...
func Page(items []PageItem) error { if len(items) == 0 { fmt.Println("No resources found") return nil } app := tview.NewApplication() // convert color codes for i, p := range items { p.Name = tview.TranslateANSI(p.Name) p.Content = tview.TranslateANSI(p.Content) items[i] = p } // right side: text vie...
[ -0.17416800558567047, 0.391724556684494, 0.8330273032188416, -0.4595419764518738, -0.5169644355773926, 0.17784254252910614, 0.6745908856391907, 0.22668449580669403, 0.07904527336359024, 0.5485600829124451, 0.5180074572563171, -1.3151885271072388, 0.2791159451007843, 0.6539431214332581, 0...
func NewMockUserIface(ctrl *gomock.Controller) *MockUserIface { mock := &MockUserIface{ctrl: ctrl} mock.recorder = &MockUserIfaceMockRecorder{mock} return mock }
[ -0.556069016456604, 0.3908507525920868, 0.36996346712112427, 0.8020488023757935, 0.030535930767655373, -0.4313221275806427, 1.3757978677749634, -0.3081592917442322, 1.3532952070236206, 0.6991268992424011, -0.8184372186660767, -0.3139524757862091, -0.6089147329330444, 0.5307930111885071, ...
func (m *MockUserIface) EXPECT() *MockUserIfaceMockRecorder { return m.recorder }
[ 0.11666106432676315, 0.555828869342804, 0.21439491212368011, 0.6852385997772217, -0.16202983260154724, 0.14583125710487366, 0.4832020103931427, 0.2623656690120697, 0.9478289484977722, -0.23817618191242218, 0.6489004492759705, 0.779735267162323, -1.0197088718414307, 0.30521029233932495, 0...
func (m *MockUserIface) Get(key string) (*UserModel, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", key) ret0, _ := ret[0].(*UserModel) ret1, _ := ret[1].(error) return ret0, ret1 }
[ -1.3842480182647705, -0.010813368484377861, 0.3469473421573639, 0.6642794013023376, 0.9701123237609863, 0.0505562350153923, 0.3345043361186981, -0.42507681250572205, -1.3023149967193604, 0.27531126141548157, -0.6255179643630981, -0.2861994206905365, -0.41674748063087463, 0.6154928803443909...
func (mr *MockUserIfaceMockRecorder) Get(key interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockUserIface)(nil).Get), key) }
[ -0.8138278126716614, 0.7566274404525757, 0.29933881759643555, 0.01904275082051754, 0.19602665305137634, 0.06668227910995483, -0.6584469676017761, -0.9599935412406921, 0.3241855800151825, 1.0676625967025757, 0.6149264574050903, 0.8192343711853027, -0.9744021892547607, 1.2844372987747192, ...
func (m *MockUserIface) Set(key string, value *UserModel) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Set", key, value) ret0, _ := ret[0].(error) return ret0 }
[ -1.0792471170425415, 0.26353058218955994, 0.06978268176317215, 0.18295219540596008, 0.809950590133667, 0.4981396496295929, 0.8875366449356079, -0.6467847228050232, -1.127311110496521, 0.7746151685714722, -0.09313659369945526, -0.6910203099250793, -0.40583062171936035, 0.9599129557609558, ...
func (mr *MockUserIfaceMockRecorder) Set(key, value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockUserIface)(nil).Set), key, value) }
[ -0.7025695443153381, 0.9593278765678406, -0.009954635985195637, 0.1281539350748062, -0.22529888153076172, 0.4049699306488037, -0.20840409398078918, -1.0272910594940186, -0.017486251890659332, 1.2874095439910889, 0.7437263131141663, 0.28225427865982056, -0.6763350367546082, 1.51754403114318...
func NewClient() *Client { if defaultClient != nil { return defaultClient } defaultClient = &Client{} return defaultClient }
[ 0.2488674521446228, -0.21137049794197083, 0.06710493564605713, 0.2980901002883911, -0.08164511620998383, -0.24139682948589325, 0.6593808531761169, -0.15953652560710907, 0.1471533179283142, -0.7322844862937927, -0.18931441009044647, 0.7006686925888062, -1.3468890190124512, -0.51037734746932...
func (c *Client) Get(endpoint string, params map[string]string) *grequests.Response { url := c.Endpoint + endpoint resp, err := grequests.Get(url, &grequests.RequestOptions{ Params: params, }) if err != nil { utilities.CheckError(resp.Error, "Unable to make requests") } if resp.Ok != true { log.Println("Re...
[ -0.5177797079086304, -0.04092688113451004, 0.6527255773544312, -0.136459618806839, 1.2758866548538208, -0.16103261709213257, -0.5046108961105347, -0.6731284856796265, -0.7906742691993713, 0.5656484365463257, 0.8268090486526489, 0.9505171775817871, -0.8455276489257812, -0.7785450220108032, ...
func (c *Client) Post(endpoint string, params map[string]string) *grequests.Response { url := c.Endpoint + endpoint resp, err := grequests.Post(url, &grequests.RequestOptions{ JSON: params, IsAjax: true, }) if err != nil { log.Println("Unable to make request", resp.Error) } if resp.Ok != true { log.Pri...
[ 0.01732904464006424, -0.04343241825699806, 0.6539427638053894, 0.3174383342266083, 0.5422548055648804, 0.044771887362003326, -0.4622969925403595, -0.7875351309776306, -0.7201104164123535, -0.1033727154135704, 0.8254337310791016, -0.035099174827337265, -0.9684133529663086, -0.13026008009910...
func (c *Client) Upload(endpoint string, filename string) *grequests.Response { fmt.Printf("Uploading %s >>> %s", filename, endpoint) fd, err := grequests.FileUploadFromDisk(filename) if err != nil { utilities.CheckError(err, "Cannot open file: "+filename) } resp, err := grequests.Post(endpoint, &grequests.Reque...
[ -0.34301847219467163, 0.3360483944416046, 0.8666121959686279, -0.17725138366222382, 0.5579976439476013, -0.21716424822807312, 0.24353061616420746, -0.8411000967025757, -1.13249933719635, 0.07369734346866608, 0.9976366758346558, -0.4157702326774597, -1.3765524625778198, -0.7513290047645569,...
func OAUTHRedirect(ctx *fiber.Ctx) error { models.SYSLOG.Tracef("entering OAUTHRedirect; original URL: %v", ctx.OriginalURL()) defer models.SYSLOG.Trace("exiting OAUTHRedirect") // First, we need to get the value of the `code` query param code := ctx.Query("code", "") if len(code) < 1 { return ctx.SendStatus(f...
[ -0.3174898028373718, -0.14436297118663788, 0.940712034702301, -0.2570025324821472, 0.5149834156036377, -0.2592901587486267, 0.1024128869175911, -0.36214780807495117, 0.5357070565223694, -0.3614829480648041, 0.7537682056427002, 0.9706776738166809, -0.2069736123085022, -0.022593049332499504,...
func OAUTHProtected(c *fiber.Ctx) error { models.SYSLOG.Tracef("entering OAUTHProtected; original URL: %v", c.OriginalURL()) defer models.SYSLOG.Trace("exiting OAUTHProtected") sessData, err := models.MySessionStore.Get(c) if err != nil { models.SYSLOG.Errorf("session exception %v", err) panic(err) } // for...
[ -0.013083148747682571, -0.2061643749475479, 0.5455975532531738, -0.060374971479177475, 0.3422395884990692, -1.1032257080078125, 0.6356468200683594, -0.8206319212913513, 1.3519058227539062, 0.3301651179790497, 0.09364895522594452, 0.3931184709072113, 0.15054340660572052, -0.0489144884049892...
func OAUTHGETHandler(c *fiber.Ctx) error { models.SYSLOG.Trace("entering OAUTHGETHandler") defer models.SYSLOG.Trace("exiting OAUTHGETHandler") return c.Render("protected", fiber.Map{}) }
[ 0.08843675255775452, -0.26001617312431335, 0.1666252613067627, -0.2702905833721161, 0.011614501476287842, -0.32422885298728943, 0.32335472106933594, 0.01672712154686451, 0.6981845498085022, -0.47482210397720337, 1.1126991510391235, 1.020040512084961, -0.7839385271072388, -0.186774030327796...
func OAUTHDisconnect(c *fiber.Ctx) error { models.SYSLOG.Tracef("entering OAUTHDisconnect; original URL: %v", c.OriginalURL()) defer models.SYSLOG.Trace("exiting OAUTHDisconnect") sessData, err := models.MySessionStore.Get(c) if err != nil { models.SYSLOG.Errorf("session exception %v", err) panic(err) } // f...
[ -0.37930169701576233, -0.4863663911819458, 0.46136876940727234, -0.5692132115364075, -0.022324789315462112, -0.07847906649112701, 0.6132926344871521, -0.6442181468009949, 0.8998450636863708, 0.2573993504047394, 0.434059202671051, 0.07319682091474533, 0.2913658320903778, 0.02234904654324054...
func QueryID(id string) bson.M { objID, err := primitive.ObjectIDFromHex(id) if err != nil { panic(err) } return bson.M{"_id": bson.M{"$eq": objID}} }
[ -0.08198481053113937, -0.2553812563419342, 0.15333466231822968, 0.11398675292730331, -0.44309714436531067, 0.9907432198524475, -0.28950750827789307, -0.19090977311134338, 1.2516634464263916, 0.17836220562458038, -0.0913650318980217, -0.010375400073826313, -0.045444056391716, -0.07544095069...
func (o *GcpKmsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGcpKmsDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil defa...
[ 0.15174885094165802, -0.8723322749137878, 0.6297181844711304, 0.5813999772071838, 0.03989120572805405, -0.8211368918418884, -0.525007426738739, -0.0682050883769989, 0.38872256875038147, 0.30107593536376953, 0.799953818321228, -0.5931069850921631, -0.7802867293357849, -0.05453621968626976, ...
func NewGcpKmsDeleteOK() *GcpKmsDeleteOK { return &GcpKmsDeleteOK{} }
[ 0.4786224067211151, -0.6585491299629211, 0.13421201705932617, 0.3860234022140503, -0.6278340220451355, 1.4914737939834595, -0.464872270822525, 1.0027377605438232, -0.6729578375816345, 0.024250991642475128, -0.24896295368671417, -1.2115509510040283, 0.4281054139137268, -0.28432396054267883,...
func (o *GcpKmsDeleteOK) IsSuccess() bool { return true }
[ 0.40259242057800293, -0.40755191445350647, 0.5390665531158447, 1.4120681285858154, -0.18572849035263062, 0.8267436027526855, -0.5729377865791321, 1.0469554662704468, 0.0054867565631866455, -0.15779370069503784, -0.33140337467193604, -0.5736338496208191, -0.1494872272014618, 0.3296658396720...
func (o *GcpKmsDeleteOK) IsRedirect() bool { return false }
[ 0.3670191764831543, -0.46716293692588806, 0.46913543343544006, 1.2622933387756348, -0.2508966624736786, 0.8551341891288757, -0.011281542479991913, 0.4216301143169403, 0.7926195859909058, -0.5746970176696777, 0.5098852515220642, -0.47413915395736694, -0.8319770097732544, 0.34851041436195374...
func (o *GcpKmsDeleteOK) IsCode(code int) bool { return code == 200 }
[ -0.031815964728593826, -0.5899303555488586, 0.3619333505630493, 0.9532719254493713, 0.09108822792768478, 0.5813432931900024, -0.7605159282684326, 0.8239902853965759, 0.4552885890007019, 0.46610864996910095, 0.1954689770936966, -0.6327873468399048, -0.5976378917694092, 0.5526983141899109, ...
func NewGcpKmsDeleteDefault(code int) *GcpKmsDeleteDefault { return &GcpKmsDeleteDefault{ _statusCode: code, } }
[ 0.5638642311096191, -0.695353090763092, -0.0023238821886479855, 0.47043222188949585, 0.7923411726951599, 0.5154967904090881, -0.8746634721755981, 0.8728734850883484, -0.24143874645233154, 0.11124500632286072, -0.6098945736885071, -0.7478095293045044, -0.9247060418128967, -0.337312281131744...
func (o *GcpKmsDeleteDefault) Code() int { return o._statusCode }
[ 0.46561679244041443, 0.10428906977176666, 0.4044106602668762, 1.2493571043014526, 0.9626732468605042, 0.08573432266712189, -0.2859325110912323, 0.9549323320388794, -0.3579109013080597, -0.17397375404834747, 0.17141331732273102, -0.47556373476982117, -0.332660973072052, 0.32902655005455017,...
func (o *GcpKmsDeleteDefault) IsSuccess() bool { return o._statusCode/100 == 2 }
[ 0.5706586837768555, 0.030583849176764488, 0.42782044410705566, 1.416597843170166, 0.6827790141105652, -0.0654035285115242, -0.8781138062477112, 0.6393426656723022, -0.14226841926574707, -0.02110978215932846, -0.49406906962394714, -0.4768337309360504, -0.5042552351951599, -0.067341163754463...
func (o *GcpKmsDeleteDefault) IsRedirect() bool { return o._statusCode/100 == 3 }
[ 0.6991764903068542, 0.2641797363758087, 0.4957559406757355, 1.2763161659240723, 0.8585669994354248, 0.22613847255706787, -0.5547730326652527, 0.18721923232078552, 0.6588427424430847, -0.2801210582256317, -0.11325186491012573, -0.36000707745552063, -1.0387723445892334, -0.581468939781189, ...
func (o *GcpKmsDeleteDefault) IsCode(code int) bool { return o._statusCode == code }
[ 0.3400706648826599, 0.1596473753452301, 0.39079567790031433, 1.0700217485427856, 1.1622555255889893, 0.031716976314783096, -0.9838732481002808, 0.584134042263031, 0.5076970458030701, 0.32971346378326416, -0.18242576718330383, -0.4921274185180664, -1.3410390615463257, 0.130674809217453, -...
func AddFile(name, data string) error { return templates.addFile(name, data, false) }
[ 0.17337708175182343, 0.6061176657676697, 0.3184875547885895, 0.3174385726451874, -0.7033873200416565, 0.2911154329776764, -1.0258516073226929, 0.7594795823097229, -0.6626971960067749, -0.9007248878479004, -0.13336436450481415, -0.525301456451416, -0.39605429768562317, 0.1268591731786728, ...
func NewRepository(funcs template.FuncMap) *Repository { repo := Repository{ files: make(map[string]string), templates: make(map[string]*template.Template), funcs: funcs, } if repo.funcs == nil { repo.funcs = make(template.FuncMap) } return &repo }
[ -0.25537604093551636, -0.48464521765708923, 0.2534570097923279, -0.07096200436353683, -0.20292750000953674, -1.078805685043335, 0.38387325406074524, 0.8491507768630981, 0.39815929532051086, -0.8594252467155457, -0.7500593066215515, -0.21829310059547424, 0.11091802269220352, 0.6854003667831...
func (t *Repository) LoadDefaults() { for name, asset := range assets { if err := t.addFile(name, string(asset), true); err != nil { log.Fatal(err) } } }
[ 0.05639609694480896, 1.7523900270462036, 0.3596051037311554, -0.6428371071815491, 1.3517322540283203, 0.25498339533805847, -0.8840736150741577, -0.17386548221111298, -0.3493667244911194, 0.1580645889043808, -0.5131917595863342, -0.8040335774421692, -0.2941649556159973, 0.6348139047622681, ...
func (t *Repository) LoadDir(templatePath string) error { err := filepath.Walk(templatePath, func(path string, info os.FileInfo, err error) error { if strings.HasSuffix(path, ".gotmpl") { if assetName, e := filepath.Rel(templatePath, path); e == nil { if data, e := ioutil.ReadFile(path); e == nil { if e...
[ 0.08617814630270004, 0.1917642056941986, 0.8733347058296204, -0.24841496348381042, -0.6838984489440918, -0.196059450507164, 0.6330310106277466, -0.20554468035697937, 0.21736352145671844, 0.01022124569863081, 0.4509267807006836, -0.6629642844200134, -0.4308684170246124, 0.9542582035064697, ...
func (t *Repository) LoadContrib(name string) error { log.Printf("loading contrib %s", name) const pathPrefix = "templates/contrib/" basePath := pathPrefix + name filesAdded := 0 for _, aname := range AssetNames() { if !strings.HasSuffix(aname, ".gotmpl") { continue } if strings.HasPrefix(aname, basePath)...
[ 0.08437034487724304, -0.26154565811157227, 0.9716688394546509, -0.6496735215187073, 0.15445972979068756, -0.011590869165956974, 0.971793532371521, 0.43036210536956787, 0.2990734577178955, 0.619788408279419, 0.04927380383014679, -1.1885071992874146, -0.5885692834854126, 0.5374804139137268, ...
func (t *Repository) MustGet(name string) *template.Template { tpl, err := t.Get(name) if err != nil { panic(err) } return tpl }
[ -0.31424230337142944, 0.36225754022598267, 0.3831233084201813, -0.47334393858909607, -0.038673002272844315, 0.24165423214435577, -1.6400105953216553, -0.8975164890289307, 0.37352603673934937, 0.6821452975273132, -0.2689618170261383, -0.37390148639678955, -0.09068111330270767, -0.8568347692...
func (t *Repository) AddFile(name, data string) error { return t.addFile(name, data, false) }
[ -0.246219664812088, 0.9093849062919617, 0.17570626735687256, 0.031863532960414886, -0.05927151441574097, 0.424625039100647, -1.375490665435791, 0.25022295117378235, -0.7585218548774719, -0.5249799489974976, 0.13112160563468933, -0.48179513216018677, -0.5547908544540405, 0.01943797990679741...
func (t *Repository) Get(name string) (*template.Template, error) { templ, found := t.templates[name] if !found { return templ, fmt.Errorf("template doesn't exist %s", name) } return t.addDependencies(templ) }
[ -0.8979833722114563, -0.1941174417734146, 0.4573386013507843, -1.474599003791809, -0.003852203255519271, -0.6604956984519958, -0.7784273028373718, -0.3380446434020996, 0.1972719430923462, 0.4559006094932556, -0.6132168769836426, -0.3555048108100891, -0.34104442596435547, -0.365854084491729...
func (t *Repository) DumpTemplates() { buf := bytes.NewBuffer(nil) fmt.Fprintln(buf, "\n# Templates") for name, templ := range t.templates { fmt.Fprintf(buf, "## %s\n", name) fmt.Fprintf(buf, "Defined in `%s`\n", t.files[name]) if deps := findDependencies(templ.Tree.Root); len(deps) > 0 { fmt.Fprintf(buf,...
[ -0.12647148966789246, 0.017324961721897125, 0.9608204364776611, -1.2787591218948364, 0.20253948867321014, 0.0937030166387558, 0.1653616577386856, -0.23202434182167053, -0.24202311038970947, 0.39446157217025757, -0.8404876589775085, 0.36437609791755676, -0.14872600138187408, 1.5224891901016...
func NewResponse() (*Response, error) { return &Response{ Moves: make([]*ResponseMove, 0, 10), }, nil }
[ 0.3557167649269104, -0.3030691146850586, 0.1817024201154709, 0.8429502844810486, 0.5006588101387024, -1.1470292806625366, 0.45422831177711487, -0.8026723861694336, 1.146929144859314, 0.15361915528774261, -1.1839191913604736, -0.6268613934516907, -0.271355539560318, -0.19548724591732025, ...
func (response *Response) ToJSON() (responseJSON []byte, err error) { return json.Marshal(response.Moves) }
[ -0.11187071353197098, -0.9391676783561707, 0.4043371379375458, -0.06656503677368164, 0.16015800833702087, -0.48644617199897766, 0.7250890135765076, -0.6759452223777771, 1.1830419301986694, 0.7818684577941895, -1.240298867225647, 0.18599426746368408, -0.05125444009900093, -0.560189068317413...
func (response *Response) AddMove(fromNode *Node, toNode *Node, numSoldiers int) { response.Moves = append(response.Moves, &ResponseMove{fromNode.Id, toNode.Id, numSoldiers}) }
[ -0.48460227251052856, 0.04504428803920746, 0.5392667651176453, 0.21042436361312866, 0.3444105088710785, -0.37232398986816406, -0.687325656414032, -0.3295597434043884, 0.6187594532966614, -0.6099727153778076, 0.08651935309171677, 0.04269188269972801, -0.7553011178970337, -0.0518436692655086...
func Notify(title, message string) error { notification := toast.Notification{ AppID: "ntify", Title: title, Message: message, Icon: "", Actions: nil} return notification.Push() }
[ 0.1994907408952713, 1.0371869802474976, 0.2643141448497772, 0.8530672788619995, -0.5299137830734253, -0.1423683762550354, -1.1377922296524048, 0.21262449026107788, -0.3547241687774658, 0.9556326270103455, -1.1832528114318848, 0.7303236126899719, -0.44289258122444153, 0.9401771426200867, ...
func ParseEventSenders(clientId string, topicsFunc TopicsFunc, config string, disableTls bool, configMap map[string]interface{}) (EventSender, error) { reSenderType := regexp.MustCompile(`^([a-z]+)`) reArgument := regexp.MustCompile(`^,([a-zA-Z]+)=([^,]+)`) var eventSenders EventSenders for config != "" { match...
[ 0.2158190757036209, -0.7007243633270264, 0.4778943657875061, 0.14653119444847107, 0.19878068566322327, -0.5899662971496582, -0.16219964623451233, 0.24433696269989014, -0.6027712821960449, 0.8745409250259399, -0.39852750301361084, 0.17190594971179962, -0.6465119123458862, 0.9263595342636108...
func NewPostgresDB(driver, host, username, password, dbname string, timeout, port int) (*Postgres, error) { psqlInfo := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s connect_timeout=%d sslmode=disable", host, port, username, password, dbname, timeout) db, err := sql.Open(driver, psqlInfo) if err != nil ...
[ -0.07535255700349808, 0.1943638026714325, 0.6539952754974365, 0.9663472175598145, -1.1155953407287598, 0.3864295780658722, -1.2005366086959839, 0.5954654216766357, -1.0979512929916382, 0.2244010716676712, -0.062792107462883, -0.20263798534870148, -1.2034002542495728, 0.3601430654525757, ...
func (l *LinkedList) reverseSingly() { prev := nil for head != nil { head := l.head next := head.next head.next = prev prev = head head = next } }
[ -0.3402178883552551, 0.7428709268569946, 0.4491333067417145, -0.4110921323299408, 0.48100531101226807, -0.9319824576377869, -0.14596496522426605, 0.895219624042511, -0.3530775308609009, 0.09822726994752884, -1.0218220949172974, 0.6215694546699524, -0.25657781958580017, 0.9292964339256287, ...
func (l *LinkedList) isPalindrome() bool { halfPoint := int(l.length / 2) current := l.head start := l.head for i := halfPoint + 1; i < 0; i-- { current = current.next } // now current points to the first element of the second half // we can reverse a new linked list with root current secondHalf := LinkedList...
[ 0.06980929523706436, -0.6628278493881226, 0.9332360029220581, 0.29191431403160095, -0.3579706847667694, -0.06268494576215744, 0.21208517253398895, 0.2642768919467926, 0.2535792291164398, -0.5268887877464294, -0.7327821850776672, 0.03956480324268341, -2.0872929096221924, 0.6053192615509033,...
func CreateKey(s Server, password string) (*Key, error) { return AddKey(s, password, nil) }
[ 0.11153965443372726, 0.12023692578077316, 0.21152068674564362, 0.70162034034729, 0.07443209737539291, -0.20153383910655975, -1.3296921253204346, -0.05842965096235275, 0.31350600719451904, 0.6451754570007324, -0.2687247097492218, -0.34092655777931213, -1.15095055103302, 0.3817799389362335, ...
func OpenKey(s Server, id backend.ID, password string) (*Key, error) { // extract data from repo data, err := s.Get(backend.Key, id) if err != nil { return nil, err } // restore json k := &Key{} err = json.Unmarshal(data, k) if err != nil { return nil, err } // check KDF if k.KDF != "scrypt" { return...
[ -0.22056080400943756, 0.26815733313560486, 0.7352338433265686, -0.08228778094053268, -0.632561445236206, -0.16848435997962952, -0.9620121121406555, 0.66496342420578, 0.3321233093738556, 0.6386170983314514, -0.20564402639865875, 0.4927172064781189, -0.7965829372406006, -0.36368876695632935,...
func SearchKey(s Server, password string) (*Key, error) { // list all keys ids, err := s.List(backend.Key) if err != nil { panic(err) } // try all keys in repo var key *Key for _, id := range ids { key, err = OpenKey(s, id, password) if err != nil { continue } return key, nil } return nil, ErrN...
[ -0.7626964449882507, 0.38428694009780884, 0.47746068239212036, 0.4738762080669403, 0.21766552329063416, -0.46833565831184387, -1.063881754875183, -0.08169660717248917, -0.4682198762893677, 0.8348579406738281, 0.010098372586071491, 0.045111048966646194, -1.352819800376892, 0.565689325332641...
func AddKey(s Server, password string, template *Key) (*Key, error) { // fill meta data about key newkey := &Key{ Created: time.Now(), KDF: "scrypt", N: scryptN, R: scryptR, P: scryptP, } hn, err := os.Hostname() if err == nil { newkey.Hostname = hn } usr, err := user.Current(...
[ -0.39777588844299316, 0.4741289019584656, 0.8968302607536316, 0.3503807783126831, -0.11716503649950027, 0.16185881197452545, -0.015481523238122463, 0.206465944647789, 0.22442872822284698, 0.6201025247573853, -0.7234614491462708, 0.235503152012825, -0.5961992144584656, 0.23872914910316467, ...
func (k *Key) encrypt(ks *keys, ciphertext, plaintext []byte) (int, error) { if cap(ciphertext) < len(plaintext)+ivSize+hmacSize { return 0, ErrBufferTooSmall } _, err := io.ReadFull(rand.Reader, ciphertext[:ivSize]) if err != nil { panic(fmt.Sprintf("unable to generate new random iv: %v", err)) } c, err :=...
[ -0.6013789176940918, 0.9714692831039429, 0.8591700196266174, 0.007720551919192076, -0.31171807646751404, -0.632132351398468, 0.4668194055557251, 0.286889910697937, 0.46930328011512756, 0.732792854309082, -0.9245855212211609, -0.426663875579834, -1.205626368522644, -0.1209314838051796, -0...
func (k *Key) EncryptUser(ciphertext, plaintext []byte) (int, error) { return k.encrypt(k.user, ciphertext, plaintext) }
[ -0.9452165365219116, 0.7715380787849426, 0.21769602596759796, 0.7354632019996643, -0.9178651571273804, -0.1492948830127716, 0.4356076419353485, 0.24736124277114868, -0.07309925556182861, 0.23913313448429108, -1.7674888372421265, -0.07189369201660156, -0.9061998128890991, -0.590894818305969...
func (k *Key) Encrypt(ciphertext, plaintext []byte) (int, error) { return k.encrypt(k.master, ciphertext, plaintext) }
[ -0.15479642152786255, 1.4756921529769897, 0.37822043895721436, 0.3475917875766754, -0.27813875675201416, -0.3349039852619171, -0.001786949927918613, 0.6178991794586182, 0.11422132700681686, 0.40341758728027344, -1.1312001943588257, -0.10863292217254639, -1.7609204053878784, 0.0003562841739...
func (k *Key) decrypt(ks *keys, ciphertext []byte) ([]byte, error) { // check for plausible length if len(ciphertext) < ivSize+hmacSize { panic("trying to decryipt invalid data: ciphertext too small") } hm := hmac.New(sha256.New, ks.Sign) // extract hmac l := len(ciphertext) - hm.Size() ciphertext, mac := ci...
[ -0.15613862872123718, 0.7475067377090454, 0.555878758430481, 0.732494056224823, -0.5848281979560852, -0.48233598470687866, -0.34705179929733276, -0.28200477361679077, 0.7484065890312195, 0.7806301712989807, -0.5958374738693237, -0.17829306423664093, -1.1145576238632202, -0.3925181925296783...
func (k *Key) Decrypt(ciphertext []byte) ([]byte, error) { return k.decrypt(k.master, ciphertext) }
[ -0.08816350996494293, 1.5199280977249146, 0.2594496011734009, 0.6928573250770569, -0.842829704284668, -0.3205735385417938, 0.0671323761343956, 0.2955784201622009, 0.5543413758277893, 0.2866191565990448, -1.3846814632415771, -0.29270559549331665, -1.5165951251983643, 0.2041478157043457, 0...
func (k *Key) DecryptUser(ciphertext []byte) ([]byte, error) { return k.decrypt(k.user, ciphertext) }
[ -0.5537549257278442, 0.6900588870048523, 0.17379878461360931, 1.3611869812011719, -0.8501094579696655, -0.5110772848129272, 0.5389500260353088, -0.1242353543639183, 0.09725764393806458, 0.1735093593597412, -1.327793836593628, -0.4577859938144684, -0.9656946659088135, 0.07948987931013107, ...
func NewContractCommand(cli *Cli) *cobra.Command { cmd := &cobra.Command{ Use: "contract", Short: "Operate contract command, query", } cmd.AddCommand(NewContractStatDataQueryCommand(cli)) return cmd }
[ -0.7735353112220764, 0.15497718751430511, 0.6911270618438721, 0.3407902717590332, 0.627971351146698, -0.055517736822366714, 0.3154059052467346, 0.03703805059194565, 0.5007045269012451, -0.6333127617835999, -0.2470700591802597, 0.0054888129234313965, 0.4586765468120575, 0.78385329246521, ...
func GetZapConfigTemplate(ctx context.Context) []*Template { templates := []*Template{ &Template{ Name: "Writes", Field: "writes", Type: "[]string", Must: false, Description: "logger write outs.", Example: "lumberjack", }, &Template{ Name: "Level", Fi...
[ -0.6601239442825317, -0.22446760535240173, 0.8856798410415649, -0.2513788044452667, -0.5606160759925842, -0.17389298975467682, -0.24779310822486877, -0.45867323875427246, -0.2942080795764923, 0.5792369246482849, -1.0947060585021973, -0.45260581374168396, -0.7356600165367126, 0.280683964490...
func ExportToJSON(jiraFile string, userMaps []userMap, exportFile string) error { export, err := GetDataFromXMLFile(jiraFile) if err != nil { return err } data, err := json.Marshal(export.GetDataForClubhouse(userMaps)) if err != nil { return err } err = ioutil.WriteFile(exportFile, data, 0644) if err != nil...
[ 0.06321296840906143, -0.582615852355957, 0.4408421218395233, 0.6581425666809082, -0.5045592784881592, 0.0318111926317215, 1.0061694383621216, 0.08505922555923462, -0.11149868369102478, 0.7958579063415527, -0.22519080340862274, -0.027767745777964592, -0.21743714809417725, 0.0368071012198925...
func UploadToClubhouse(jiraFile string, userMaps []userMap, token string, testMode bool) error { export, err := GetDataFromXMLFile(jiraFile) if err != nil { return err } data := export.GetDataForClubhouse(userMaps) fmt.Printf("Found %d epics and %d stories.\n\n", len(data.Epics), len(data.Stories)) if !testMo...
[ 0.12267895042896271, 0.025789668783545494, 0.5760627388954163, 0.5421819090843201, 0.8385952115058899, 0.4031379222869873, 0.6534146070480347, -0.11745119094848633, -1.0472567081451416, 0.43358999490737915, -0.20320802927017212, -0.05420086532831192, -0.39876624941825867, -0.08682902157306...
func SendData(token string, data ClubHouseData) error { // epicMap is used to get the return from the submitting of the ClubHouseCreateEpic to get the ID created by the API so stories can be mapped to the correct epic. epicMap := make(map[string]int64) client := &http.Client{} for _, epic := range data.Epics { ...
[ -0.3601495325565338, -0.17835772037506104, 1.0164774656295776, 0.12851515412330627, 1.1893092393875122, 0.34573397040367126, -0.03720634803175926, -0.35521167516708374, -1.1261042356491089, 0.026707343757152557, -0.09254949539899826, 0.3657646179199219, 0.41307681798934937, 0.4166515767574...
func GetURL(kind string, token string) string { return fmt.Sprintf("%s%s?token=%s", "https://api.clubhouse.io/api/v2/", kind, token) }
[ 0.07960609346628189, -0.3459562063217163, 0.5287033915519714, 0.10888980329036713, 0.6978628039360046, -0.19529834389686584, -1.2822262048721313, -0.12128839641809464, -0.9578577280044556, 0.33459386229515076, -0.13303542137145996, 1.3924901485443115, -0.08752141892910004, -0.7577302455902...
func GetDataFromXMLFile(jiraFile string) (JiraExport, error) { xmlFile, err := os.Open(jiraFile) if err != nil { return JiraExport{}, err } defer xmlFile.Close() XMLData, err := ioutil.ReadAll(xmlFile) if err != nil { return JiraExport{}, err } jiraExport := JiraExport{} err = xml.Unmarshal(XMLData, &jir...
[ 0.6817649006843567, -0.5167909860610962, 0.692195475101471, 0.1650126874446869, -1.0457589626312256, 0.45508936047554016, 0.14518515765666962, -0.22288435697555542, -0.4780910313129425, -0.3666730523109436, 0.35677966475486755, -0.36001908779144287, -0.5373140573501587, -0.2492931485176086...
func Crawl(crawler spider.Spiderer) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { target := r.URL.Query().Get(targetParam) // Check params provided if target == "" { api.Error(w, "The target URL field 'target' is required.", http.StatusBadRequest) return } u...
[ -0.73630690574646, -0.1357908546924591, 0.7311397790908813, 0.20605891942977905, 0.1573985368013382, -0.13558262586593628, 0.6217081546783447, 0.3870488107204437, -0.3036474883556366, 0.061396997421979904, 0.5015876293182373, 0.06754671782255173, 0.7534797191619873, -0.7119478583335876, ...
func NewPostsRepository(db *sql.DB) *Posts { return &Posts{db} }
[ 0.37106648087501526, 0.2199607938528061, -0.23462523519992828, -0.7040209770202637, -1.3635368347167969, -0.47826680541038513, -0.4038848280906677, 0.21635554730892181, 0.08057992160320282, -0.5064558386802673, -0.7392842173576355, -0.5681928396224976, 0.1199331134557724, 0.969376444816589...
func (repository Posts) Create(post models.Post) (uint64, error) { dbStatement, err := repository.db.Prepare( "INSERT INTO posts (title, content, author_id) VALUES (?, ?, ?)", ) if err != nil { return 0, err } defer dbStatement.Close() dbExecution, err := dbStatement.Exec( post.Title, post.Content, pos...
[ 0.03663346916437149, 0.8681497573852539, 0.6144094467163086, 0.31145402789115906, 0.43102389574050903, 0.12325789779424667, -0.07561241090297699, -0.2651003897190094, -1.0282225608825684, 0.15093520283699036, -0.0432409942150116, -1.4390805959701538, -1.4543505907058716, 0.530708372592926,...
func (repository Posts) SearchID(postID uint64) (models.Post, error) { row, err := repository.db.Query( `SELECT p.*, u.username FROM posts p INNER JOIN users u ON u.id = p.author_id WHERE p.id = ?`, postID, ) if err != nil { return models.Post{}, err } defer row.Close() var post models.Post if row.Ne...
[ 0.6485264301300049, 0.1125589907169342, 0.3054221272468567, 0.48292890191078186, -0.2529534697532654, 0.2897569537162781, -0.718450665473938, -0.6096689701080322, 0.47425493597984314, 0.0033575790002942085, -0.15604586899280548, -0.09513067454099655, -1.0152658224105835, 0.7126414179801941...
func (repository Posts) Search(userID uint64) ([]models.Post, error) { rows, err := repository.db.Query( `SELECT DISTINCT p.*, u.username FROM posts p INNER JOIN users u on u.id = p.author_id INNER JOIN followers f on p.author_id = f.user_id WHERE u.id = ? OR f.follower_id = ? ORDER BY p.id desc`, userID, ...
[ -0.07394055277109146, 0.5303695201873779, 0.4599815905094147, 0.5029268264770508, -0.021736539900302887, 0.4607180058956146, 0.06278258562088013, -0.1766112893819809, -0.03145943954586983, -0.11198370158672333, -0.5446309447288513, 0.30982506275177, -0.5863972306251526, 0.9510488510131836,...
func (repository Posts) Update(postID uint64, post models.Post) error { dbStatement, err := repository.db.Prepare( "UPDATE posts SET title = ?, content = ? WHERE id = ?", ) if err != nil { return err } defer dbStatement.Close() if _, err = dbStatement.Exec(post.Title, post.Content, postID); err != nil { re...
[ -0.4675591289997101, -0.1979573667049408, 0.10372664779424667, -0.3221573829650879, -0.4626341760158539, 0.5920728445053101, -1.1179304122924805, -0.12135708332061768, -0.646412193775177, 0.32951265573501587, -0.3242550790309906, -0.4985225200653076, -0.8372862935066223, 0.4166350662708282...
func (repository Posts) Delete(postID uint64) error { dbStatement, err := repository.db.Prepare( "DELETE FROM posts WHERE id = ?", ) if err != nil { return err } defer dbStatement.Close() if _, err = dbStatement.Exec(postID); err != nil { return err } return nil }
[ 0.6327875852584839, 0.9095029234886169, 0.1776944398880005, 0.10740908980369568, 0.9284244179725647, 0.08070707321166992, -0.4378746747970581, -0.10663621872663498, -0.18214759230613708, 0.5772418975830078, -0.19308196008205414, -0.6994038820266724, -0.9834989309310913, 0.6446887850761414,...
func (repository Posts) SearchByUser(userID uint64) ([]models.Post, error) { rows, err := repository.db.Query( `SELECT p.*, u.username FROM posts p JOIN users u on u.id = p.author_id WHERE p.author_id = ?`, userID, ) if err != nil { return nil, err } defer rows.Close() var posts []models.Post for rows...
[ 0.019739430397748947, 0.8114653825759888, 0.4685295522212982, 0.6049715876579285, -0.2493801862001419, -0.09410463273525238, -0.23400990664958954, -0.3594844937324524, -0.5127153396606445, -0.07087375968694687, -0.9486397504806519, -0.21321672201156616, -0.5082313418388367, 1.3222899436950...
func (repository Posts) Like(postID uint64) error { dbStatement, err := repository.db.Prepare( "UPDATE posts SET likes = likes + 1 WHERE id = ?", ) if err != nil { return err } defer dbStatement.Close() if _, err = dbStatement.Exec(postID); err != nil { return err } return nil }
[ -0.5900374054908752, 0.4650365114212036, 0.6332474946975708, -0.48709291219711304, -0.5031022429466248, 0.515933096408844, -0.5783195495605469, -0.5552456378936768, -0.9972638487815857, 0.42452287673950195, -1.0127493143081665, 0.06509586423635483, -1.0784060955047607, 0.7772387862205505, ...
func (repository Posts) Unlike(postID uint64) error { dbStatement, err := repository.db.Prepare( `UPDATE posts SET likes = CASE WHEN likes > 0 THEN likes - 1 ELSE likes END WHERE id = ?`, ) if err != nil { return err } defer dbStatement.Close() if _, err = dbStatement.Exec(postID); err != nil { ret...
[ -0.5279569029808044, 0.5386300683021545, 0.6005670428276062, -0.8782646656036377, -0.5880381464958191, 1.2936478853225708, -0.10122716426849365, -0.012034661136567593, -0.7550308704376221, 0.1284194439649582, -0.2283133864402771, 0.3999008536338806, -1.2572383880615234, 1.0665342807769775,...
func containerScreen(_ fyne.Window) fyne.CanvasObject { content := container.NewBorder( widget.NewLabelWithStyle("Top", fyne.TextAlignCenter, fyne.TextStyle{}), widget.NewLabelWithStyle("Bottom", fyne.TextAlignCenter, fyne.TextStyle{}), widget.NewLabel("Left"), widget.NewLabel("Right"), widget.NewLabel("Bord...
[ -0.07124265283346176, -0.5590242147445679, 0.6261994242668152, -0.8003863096237183, -0.4744686186313629, -0.5522984862327576, -0.16610433161258698, -1.5199313163757324, 0.2132333219051361, 0.08743667602539062, 0.43790268898010254, -0.9657111763954163, 0.44253090023994446, 1.313066244125366...
func RemoveDuplicate(l *list.List) *list.List { exists := make(map[interface{}]bool) var eNext *list.Element for e := l.Front(); e != nil; e = eNext { eNext = e.Next() if _, ok := exists[e.Value]; ok == true { l.Remove(e) } else { exists[e.Value] = true } } return l }
[ -0.6711671352386475, -0.03191686049103737, 0.8556755185127258, -0.22138580679893494, -0.2764676511287689, -0.2739916145801544, -0.0845949724316597, 1.3885762691497803, 1.1516695022583008, 0.6951063275337219, -1.0668010711669922, -0.3380661904811859, -0.6368426084518433, 1.18226158618927, ...
func RemoveDuplicateLowMemory(l *list.List) *list.List { var eNext *list.Element for e := l.Front(); e != nil; e = eNext { eNext = e.Next() for e2 := l.Front(); e2 != e; e2 = e2.Next() { if e.Value == e2.Value { l.Remove(e) break } } } return l }
[ 0.3298211991786957, -0.29326796531677246, 0.7636614441871643, -0.2946370244026184, -0.9312126636505127, 0.15015345811843872, 0.6727496981620789, 0.6122997999191284, 2.0678231716156006, 0.2340955287218094, -0.9577794075012207, 0.22110861539840698, -0.46792417764663696, 1.3427050113677979, ...
func unescape(str string) (string, error) { buf := make([]byte, len(str)) offset := 0 for len(str) > 0 { val, _, tail, err := strconv.UnquoteChar(str, 0) if err != nil { return "", err } offset += utf8.EncodeRune(buf[offset:], val) str = tail } return string(buf[0:offset]), nil }
[ 0.29902493953704834, -0.21608783304691315, 0.42561784386634827, -0.47832009196281433, -0.150734543800354, -0.8340539336204529, -0.30687031149864197, 0.1453273743391037, -0.778028130531311, 0.7367002367973328, -0.08113916218280792, 0.32721883058547974, -0.5581566095352173, -0.53954190015792...
func escape(str string) string { buf := make([]byte, 0, len(str)*2) for i := 0; i < len(str); i++ { switch str[i] { case '\n': buf = append(buf, '\\', 'n') case '\r': buf = append(buf, '\\', 'r') case '\t': buf = append(buf, '\\', 't') case '\\': buf = append(buf, '\\', '\\') default: buf =...
[ 0.3819804787635803, -0.14502577483654022, 0.44987693428993225, -0.016698841005563736, -0.32311487197875977, -0.33450764417648315, -0.8128370642662048, -0.9406335353851318, -0.9825212955474854, 0.5243760347366333, -0.3504965603351593, 0.004037326667457819, -0.16672839224338531, -0.826817393...
func (SubscriptionResource) basicEnrollmentAccount(data acceptance.TestData) string { billingAccount := os.Getenv("ARM_BILLING_ACCOUNT") enrollmentAccount := os.Getenv("ARM_BILLING_ENROLLMENT_ACCOUNT") return fmt.Sprintf(` provider "azurerm" { features {} } data "azurerm_billing_enrollment_account_scope" "test" {...
[ 0.8783524036407471, -0.5362614989280701, 0.6812105774879456, -0.04084880277514458, -0.37192875146865845, 0.6978092789649963, 0.5936766862869263, -0.2399255484342575, 0.8256714940071106, 0.03864597529172897, 0.19199487566947937, 0.9467893242835999, 0.8141555190086365, 0.3122677505016327, ...
func main() { var BEGIN string fmt.Scan(&BEGIN) var END string fmt.Scan(&END) // fmt.Fprintln(os.Stderr, "Debug messages...") fmt.Println(computeDuration(BEGIN, END)) // Write answer to stdout }
[ 0.28539058566093445, -0.5048125386238098, 0.7256578207015991, 0.49675750732421875, -0.2440899759531021, 0.7428770661354065, 0.9306451082229614, -0.03506366163492203, -0.598101794719696, -0.09017544984817505, 0.8586410880088806, 0.9790281057357788, -0.4842458963394165, 0.3580837547779083, ...
func NewGetProductsCodeParams() *GetProductsCodeParams { var ( withAttributeOptionsDefault = bool(false) withQualityScoresDefault = bool(false) ) return &GetProductsCodeParams{ WithAttributeOptions: &withAttributeOptionsDefault, WithQualityScores: &withQualityScoresDefault, timeout: cr.DefaultTimeou...
[ -0.13508228957653046, -0.22216132283210754, 0.35872459411621094, 0.146623432636261, 0.05591108649969101, -0.5598475337028503, 0.2091992050409317, -0.3340260684490204, -0.1673690527677536, 0.44280505180358887, -0.6367398500442505, 0.6110696792602539, -0.33128413558006287, 0.8957886695861816...