text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (attachStatus *AttachmentStatus) ShouldSend() bool { return *attachStatus == AttachmentAttached }
[ 0.6231273412704468, -0.6137644648551941, 0.41660091280937195, 0.6438550353050232, -0.36331111192703247, 1.5892161130905151, -1.0589721202850342, -0.2661559283733368, 0.15485689043998718, -0.43762311339378357, 0.2005821168422699, 0.6864866018295288, 0.3251400589942932, 0.6177166104316711, ...
func EchoLoop(ctx context.Context, c *websocket.Conn) error { defer c.Close(websocket.StatusInternalError, "") c.SetReadLimit(1 << 30) ctx, cancel := context.WithTimeout(ctx, time.Minute) defer cancel() b := make([]byte, 32<<10) for { typ, r, err := c.Reader(ctx) if err != nil { return err } w, err...
[ 0.0722598135471344, -0.15074245631694794, 0.9717457890510559, -0.45499709248542786, -0.15490856766700745, 0.5967369675636292, -0.2926415503025055, -0.8945132493972778, 0.2978688180446625, 0.6384022235870361, 0.14349785447120667, 0.37806636095046997, -0.4880731999874115, -0.1793657690286636...
func Echo(ctx context.Context, c *websocket.Conn, max int) error { expType := websocket.MessageBinary if xrand.Bool() { expType = websocket.MessageText } msg := randMessage(expType, xrand.Int(max)) writeErr := xsync.Go(func() error { return c.Write(ctx, expType, msg) }) actType, act, err := c.Read(ctx) i...
[ 0.2928178906440735, 0.2961041331291199, 0.8958723545074463, -0.4311442971229553, -0.7522627711296082, 0.340702086687088, -0.5044649243354797, -0.5050061345100403, 0.3625716269016266, 0.18204016983509064, 0.18015487492084503, 1.2263705730438232, -0.23668111860752106, -0.07840581238269806, ...
func NewFancyPrinter(writer io.Writer) *FancyPrinter { return &FancyPrinter{ writer: writer, } }
[ 0.3853197991847992, -0.8212474584579468, 0.15584728121757507, -0.3186897337436676, -1.4699137210845947, -1.1500200033187866, -0.506821870803833, -0.2776169776916504, 0.1973399966955185, -1.1835554838180542, -1.563881516456604, 0.20766574144363403, -0.005922461859881878, 1.073613166809082, ...
func (fp *FancyPrinter) SetIndent(indent string) *FancyPrinter { fp.indent = indent return fp }
[ 0.5324681401252747, -0.6569548845291138, 0.4261242151260376, 0.24598446488380432, -0.009792893193662167, 0.24333147704601288, 0.22812964022159576, 0.296266108751297, -0.1471577286720276, -0.769575297832489, -0.24556514620780945, 0.3907105624675751, 0.019833333790302277, -0.1929937154054641...
func (fp *FancyPrinter) SetSeparators(separators ...string) { fp.separators = separators }
[ -0.4504099488258362, -0.43799254298210144, 0.45435646176338196, -0.2021832913160324, 0.018900029361248016, 0.09634292870759964, -0.6560946702957153, -0.46076294779777527, 0.1101195216178894, -0.6191713809967041, -1.079267144203186, -0.21327276527881622, -0.7412695288658142, 1.1045453548431...
func (fp *FancyPrinter) SetSeparatorsFunc(separatorsFunc func(inputs []Input)) { fp.separatorsFunc = separatorsFunc }
[ 0.1382259726524353, -0.6248537302017212, 0.42500534653663635, -0.4006657898426056, -0.04346160963177681, -0.3204781115055084, 0.8188097476959229, -0.40606412291526794, 0.27084267139434814, -0.40935802459716797, -0.691891610622406, 0.29878294467926025, 0.5387149453163147, 0.8169980645179749...
func (fp *FancyPrinter) Print(inputs []Input) error { if fp.separatorsFunc != nil { fp.separatorsFunc(inputs) } b := strings.Builder{} b.WriteString(fmt.Sprintln()) b.WriteString(fp.indent) pos := len(fp.indent) texts := make([]posTxt, 0) valid := true for idx, input := range inputs { b.WriteString(fm...
[ -0.15518802404403687, -0.3808884620666504, 0.8259533047676086, 0.27393609285354614, -0.27266359329223633, -0.1478063315153122, -0.36427178978919983, -0.5145081877708435, -0.17095284163951874, -0.6144172549247742, 0.457669198513031, -0.06535719335079193, -0.3609307110309601, 0.2214199006557...
func (m *MySQL) Close() { m.DB.Close() }
[ -0.27184054255485535, 0.12392520904541016, 0.15170691907405853, 0.08060567826032639, -0.20390953123569489, 0.9247624278068542, 0.02061910554766655, -0.4047510027885437, -0.6517688632011414, -0.7915644645690918, 0.018122473731637, 0.10080129653215408, -1.4071561098098755, 1.6442607641220093...
func (m *MySQL) Insert(todo *schema.Todo) (int, error) { //Insert Title and Complete, ID is auto-populated res, err := m.DB.Exec(`INSERT INTO Todo (Title, Complete) VALUES (?,?)`, todo.Title, todo.Complete) if err != nil { println("Exec err:", err.Error()) return -1, err } //Use MySQL LastInsertId to get ID ...
[ -1.089363932609558, 0.4362102746963501, 1.058415412902832, 0.13327443599700928, -0.514407753944397, 0.36861342191696167, 0.9951322078704834, 0.06721176952123642, -0.5549302101135254, -0.12638652324676514, -0.9534045457839966, -0.44850772619247437, -1.1133251190185547, 0.03320655971765518, ...
func (m *MySQL) Update(todo *schema.Todo) error { var stmt = `UPDATE Todo SET Title = ?, Complete = ? WHERE ID = ?` _, err := m.DB.Exec(stmt, todo.Title, todo.Complete, todo.ID) if err != nil { println("Exec err:", err.Error()) return err } return nil }
[ -0.8168100118637085, -0.3041585087776184, 0.6141558885574341, 0.1785343736410141, -0.6229242086410522, 0.5493861436843872, -0.255832314491272, 0.3159236013889313, -0.43002569675445557, 0.3907236158847809, -0.719795823097229, 0.13813038170337677, -0.372612863779068, -0.366377592086792, -0...
func (m *MySQL) Delete(id int) error { var stmt = `DELETE FROM Todo WHERE ID = ?` if _, err := m.DB.Exec(stmt, id); err != nil { println("Exec err:", err.Error()) return err } return nil }
[ -0.14493922889232635, 0.8154029846191406, 0.8053629398345947, 0.5224885940551758, 0.2848358452320099, 0.23338676989078522, 0.158844456076622, 0.03356060013175011, -0.2725592851638794, 0.2388266623020172, -0.23464184999465942, 0.11501358449459076, -0.5361781716346741, -0.15325884521007538, ...
func (m *MySQL) GetAll() ([]schema.Todo, error) { query := ` SELECT * FROM Todo ORDER BY ID; ` rows, err := m.DB.Query(query) if err != nil { return nil, err } var todoList []schema.Todo for rows.Next() { var t schema.Todo if err := rows.Scan(&t.ID, &t.Title, &t.Complete); err ...
[ 0.07467461377382278, 0.42777666449546814, 0.7310962677001953, 0.9215188026428223, 0.3141338527202606, 0.011969713494181633, -0.5114818811416626, 0.3187042474746704, -0.04238739609718323, -0.057100117206573486, -0.8087518215179443, 0.5589718818664551, 0.08390071243047714, 0.2252416312694549...
func ConnectMySQL() (*MySQL, error) { db, err := sql.Open("mysql", "root:admin@tcp(localhost:3306)/Todo_db") if err != nil { return nil, err } fmt.Println("connected to mySql") err = db.Ping() if err != nil { return nil, err } fmt.Println("pinged mySql") return &MySQL{db}, nil }
[ -0.12217085808515549, 0.0025832694955170155, 0.5573378205299377, 0.47641077637672424, 0.05836069956421852, 0.5424091815948486, 0.034171294420957565, -0.40293365716934204, 0.3727257549762726, 0.2163325995206833, -0.06475008279085159, 0.15087555348873138, -0.4979051947593689, 0.0971549972891...
func newAPIKeyQueryBearerSecurityDefinition(secDefName string) specAPIKeyQueryBearerSecurityDefinition { return specAPIKeyQueryBearerSecurityDefinition{secDefName} }
[ 1.5542415380477905, -0.6319172382354736, 0.24426640570163727, 0.3015586733818054, -1.1580110788345337, -0.5088240504264832, -0.5024547576904297, -0.4718326926231384, 0.811591625213623, -0.06778182834386826, -0.6708835959434509, 0.7975318431854248, -0.6682279109954834, 0.27604758739471436, ...
func (wc *WalletCreate) SetSeed(s string) *WalletCreate { wc.mutation.SetSeed(s) return wc }
[ 0.2752569615840912, 0.10660964250564575, 0.0700564831495285, 0.9765194654464722, -0.33353158831596375, 0.7362488508224487, 0.5164481997489929, 0.0022996310144662857, 1.230750560760498, -0.7850897312164307, -0.3460935950279236, 0.4735194444656372, -0.24264362454414368, 0.6818646192550659, ...
func (wc *WalletCreate) SetRepresentative(s string) *WalletCreate { wc.mutation.SetRepresentative(s) return wc }
[ -0.6987010836601257, 0.7548860311508179, 0.3155529499053955, 0.44608959555625916, -0.34257322549819946, 0.23075158894062042, -0.022638704627752304, 0.4015796482563019, -0.4869854748249054, 0.2178870588541031, -0.802025556564331, -0.3242330551147461, -0.06749249249696732, -0.067826814949512...
func (wc *WalletCreate) SetNillableRepresentative(s *string) *WalletCreate { if s != nil { wc.SetRepresentative(*s) } return wc }
[ -0.19706764817237854, 0.17148150503635406, 0.37069815397262573, -0.5934115052223206, -0.7822752594947815, 0.40043905377388, -0.37394243478775024, 0.17368125915527344, -0.11755859106779099, -0.022752558812499046, -0.12210971862077713, -0.542904794216156, -1.1709065437316895, 0.0922259390354...
func (wc *WalletCreate) SetEncrypted(b bool) *WalletCreate { wc.mutation.SetEncrypted(b) return wc }
[ -0.442049115896225, 0.7784568071365356, 0.2841717600822449, 0.6199730634689331, 1.175625205039978, -0.18183815479278564, 0.8514261841773987, 0.003068214748054743, -0.021531634032726288, 0.004717323463410139, -1.396270990371704, 0.057509128004312515, -0.48717576265335083, 0.4127998352050781...
func (wc *WalletCreate) SetNillableEncrypted(b *bool) *WalletCreate { if b != nil { wc.SetEncrypted(*b) } return wc }
[ -0.05056598037481308, 0.8614022731781006, 0.43310797214508057, 0.40484485030174255, 0.26779285073280334, -0.3446766138076782, 0.1096540167927742, -0.6691903471946716, -0.0852305218577385, 0.5195297598838806, -1.1850842237472534, -0.4661296010017395, -1.0767494440078735, 0.6203427910804749,...
func (wc *WalletCreate) SetWork(b bool) *WalletCreate { wc.mutation.SetWork(b) return wc }
[ -1.0169000625610352, 1.2024980783462524, 0.7679444551467896, 1.8671870231628418, 0.4766118824481964, 0.5224403142929077, 0.04814630001783371, 0.21217094361782074, 0.1277228146791458, 0.22794143855571747, -0.9784993529319763, -0.7699641585350037, -0.8798907995223999, 0.6493383646011353, -...
func (wc *WalletCreate) SetNillableWork(b *bool) *WalletCreate { if b != nil { wc.SetWork(*b) } return wc }
[ -0.14323456585407257, 0.9829637408256531, 0.6277555823326111, 1.0088293552398682, -0.3035534620285034, 0.4909140169620514, 0.3198307454586029, -0.30482423305511475, -0.14665761590003967, -0.2006378471851349, -1.0488144159317017, -1.218084692955017, -1.4892200231552124, 0.6504268646240234, ...
func (wc *WalletCreate) SetCreatedAt(t time.Time) *WalletCreate { wc.mutation.SetCreatedAt(t) return wc }
[ -0.3478369116783142, -0.37512582540512085, 0.18285922706127167, -0.2329023778438568, 0.19756966829299927, 0.38949865102767944, -0.3342207968235016, -0.8045997619628906, -0.1502935141324997, -0.6053844094276428, -0.8914281725883484, -0.7378280758857727, 0.31209051609039307, 0.95546001195907...
func (wc *WalletCreate) SetNillableCreatedAt(t *time.Time) *WalletCreate { if t != nil { wc.SetCreatedAt(*t) } return wc }
[ 0.428989440202713, -0.005122362170368433, 0.25874778628349304, -0.10436178743839264, -0.29244038462638855, 0.736316442489624, -0.45977479219436646, -1.0284054279327393, -0.3179858922958374, -0.8233221769332886, -0.7445135712623596, -1.0012998580932617, -0.2824101150035858, 0.71836137771606...
func (wc *WalletCreate) SetID(u uuid.UUID) *WalletCreate { wc.mutation.SetID(u) return wc }
[ -0.35366585850715637, 0.5174544453620911, 0.2540416419506073, 1.535399079322815, 0.2157955914735794, 1.0899497270584106, 0.4815908670425415, 0.5694966912269592, 1.2436624765396118, -0.04664153978228569, -0.7490557432174683, -0.06288477778434753, -0.5028576254844666, 0.8996120095252991, -...
func (wc *WalletCreate) SetNillableID(u *uuid.UUID) *WalletCreate { if u != nil { wc.SetID(*u) } return wc }
[ 0.506881594657898, 0.4531779885292053, 0.05015501007437706, 0.6276590824127197, -0.48611927032470703, 0.8472380638122559, -0.13472282886505127, 0.17463496327400208, 0.2901526689529419, 0.5733376741409302, -0.20557990670204163, -0.058961257338523865, -1.0065127611160278, 0.5440451502799988,...
func (wc *WalletCreate) AddAccountIDs(ids ...uuid.UUID) *WalletCreate { wc.mutation.AddAccountIDs(ids...) return wc }
[ -1.2854593992233276, -0.30153822898864746, 0.21698252856731415, 0.9887338876724243, 0.3635396957397461, 0.34212133288383484, 0.5250037312507629, 0.06895052641630173, 0.70354825258255, 0.3136157989501953, 0.18342405557632446, 0.20807796716690063, -0.07096293568611145, 0.3695305585861206, ...
func (wc *WalletCreate) AddAccounts(a ...*Account) *WalletCreate { ids := make([]uuid.UUID, len(a)) for i := range a { ids[i] = a[i].ID } return wc.AddAccountIDs(ids...) }
[ -0.7883181571960449, 0.48781657218933105, 0.35809263586997986, 0.7778099179267883, 0.5831594467163086, 0.22582465410232544, 0.5280696153640747, -0.2858715057373047, 0.7212164998054504, -0.23210959136486053, 1.0529340505599976, -0.4821869730949402, -0.7962533831596375, 0.6179177165031433, ...
func (wc *WalletCreate) Mutation() *WalletMutation { return wc.mutation }
[ -0.18470466136932373, -0.16115480661392212, 0.07656271755695343, 0.26035964488983154, 0.32231831550598145, 0.1936635971069336, 0.4158782958984375, -0.6323606371879578, 1.3279539346694946, -0.06863077729940414, 0.3886205554008484, -0.2335689812898636, -0.6076514720916748, 0.5323026776313782...
func (wc *WalletCreate) Save(ctx context.Context) (*Wallet, error) { var ( err error node *Wallet ) wc.defaults() if len(wc.hooks) == 0 { if err = wc.check(); err != nil { return nil, err } node, err = wc.sqlSave(ctx) } else { var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Valu...
[ -0.36597004532814026, -0.025026872754096985, 0.6044110655784607, -0.5430940389633179, 0.5869061946868896, -0.5758979916572571, 0.41186168789863586, -1.2318605184555054, 0.16567878425121307, 0.7691406607627869, 0.22871437668800354, 0.26532575488090515, -0.46135473251342773, 0.47020325064659...
func (wc *WalletCreate) SaveX(ctx context.Context) *Wallet { v, err := wc.Save(ctx) if err != nil { panic(err) } return v }
[ -0.18104557693004608, 0.7630001306533813, 0.2671814560890198, 0.5622234344482422, -0.47462061047554016, 0.8543984293937683, -1.0885802507400513, -0.3634360432624817, 1.346364974975586, 0.20010733604431152, -1.1112735271453857, -0.11933010816574097, -0.6126835346221924, 0.4373111128807068, ...
func (wc *WalletCreate) Exec(ctx context.Context) error { _, err := wc.Save(ctx) return err }
[ 0.12245115637779236, 0.3702320158481598, 0.5984518527984619, 0.26321133971214294, 0.6683894991874695, 1.150403618812561, -0.3574938178062439, -0.7828335165977478, -0.2230079025030136, 0.46756070852279663, -0.37272706627845764, -0.11364885419607162, -0.2615460157394409, 0.30120596289634705,...
func (wc *WalletCreate) ExecX(ctx context.Context) { if err := wc.Exec(ctx); err != nil { panic(err) } }
[ 0.8159858584403992, 1.0183967351913452, 0.6600436568260193, 0.3510310649871826, 0.28682637214660645, 1.3208650350570679, -0.8380867838859558, -0.5881866216659546, 0.511284589767456, -0.06870221346616745, 0.04296401888132095, 0.638519287109375, 0.2525388300418854, 0.552945613861084, 0.271...
func (wc *WalletCreate) defaults() { if _, ok := wc.mutation.Encrypted(); !ok { v := wallet.DefaultEncrypted wc.mutation.SetEncrypted(v) } if _, ok := wc.mutation.Work(); !ok { v := wallet.DefaultWork wc.mutation.SetWork(v) } if _, ok := wc.mutation.CreatedAt(); !ok { v := wallet.DefaultCreatedAt() wc....
[ -0.8892372846603394, 0.4764896333217621, 0.2626302242279053, 0.05616297572851181, 1.2393004894256592, -0.29112499952316284, -0.3553556799888611, -1.1133432388305664, -0.004877348896116018, -0.04641725495457649, -0.5154478549957275, 0.12593147158622742, -0.2286975085735321, 0.60991984605789...
func (wc *WalletCreate) check() error { if _, ok := wc.mutation.Seed(); !ok { return &ValidationError{Name: "seed", err: errors.New(`ent: missing required field "Wallet.seed"`)} } if v, ok := wc.mutation.Seed(); ok { if err := wallet.SeedValidator(v); err != nil { return &ValidationError{Name: "seed", err: fm...
[ -0.4465475082397461, 0.19254295527935028, 0.6174706220626831, -0.21139737963676453, 0.751926064491272, 0.6193938255310059, 0.2065868377685547, -0.8952785134315491, -0.4479908347129822, 0.0026121842674911022, 0.39884307980537415, -0.1804431676864624, -0.09968092292547226, 1.3633286952972412...
func (wcb *WalletCreateBulk) Save(ctx context.Context) ([]*Wallet, error) { specs := make([]*sqlgraph.CreateSpec, len(wcb.builders)) nodes := make([]*Wallet, len(wcb.builders)) mutators := make([]Mutator, len(wcb.builders)) for i := range wcb.builders { func(i int, root context.Context) { builder := wcb.builde...
[ -0.5550982356071472, 0.2863391935825348, 0.7223169803619385, 0.47221502661705017, 1.0528945922851562, -0.6722090244293213, 0.5600408911705017, -0.9724329710006714, -0.036176033318042755, 0.7223689556121826, -0.3128821849822998, 0.2580355405807495, -0.5571603178977966, 0.4136836528778076, ...
func (wcb *WalletCreateBulk) SaveX(ctx context.Context) []*Wallet { v, err := wcb.Save(ctx) if err != nil { panic(err) } return v }
[ -0.6735824942588806, 0.7943823337554932, 0.5432860851287842, 0.9747157692909241, 0.128854438662529, 0.3957560360431671, -1.1468522548675537, -0.28139033913612366, 1.128076434135437, 0.7082934975624084, -1.4194966554641724, -0.12629561126232147, -0.7081487774848938, 1.041006088256836, -0....
func (wcb *WalletCreateBulk) Exec(ctx context.Context) error { _, err := wcb.Save(ctx) return err }
[ -0.1010422334074974, 0.713275134563446, 0.665766179561615, 0.3122359812259674, 1.1616265773773193, 0.6641950607299805, -0.3167155683040619, -0.5473582148551941, -0.2812434434890747, 0.6989300847053528, -0.6925266981124878, 0.06111835688352585, -0.5769277215003967, 0.6836774349212646, -0....
func (wcb *WalletCreateBulk) ExecX(ctx context.Context) { if err := wcb.Exec(ctx); err != nil { panic(err) } }
[ 0.6023775935173035, 1.1820909976959229, 0.7169873714447021, 0.4705660045146942, 0.5245845913887024, 0.9179536700248718, -0.7843223810195923, -0.3187253773212433, 0.29517945647239685, 0.24602758884429932, -0.232740581035614, 0.7350268363952637, -0.06761355698108673, 0.7935075163841248, -0...
func TestGithubCipdDEPSRepoManager(t *testing.T) { cfg := githubCipdDEPSRmCfg(t) ctx, rm, _, _, _, _, _, cleanup := setupGithubCipdDEPS(t, cfg) defer cleanup() lastRollRev, tipRev, notRolledRevs, err := rm.Update(ctx) require.NoError(t, err) // Assert last roll, next roll and not rolled yet. require.Equal(t, ...
[ -0.7687669992446899, 0.19244864583015442, 0.6882765889167786, -1.2601228952407837, 0.39966967701911926, 0.36060771346092224, -0.000843685818836093, 0.2341519594192505, 0.7829182147979736, -0.4664890170097351, -0.7935057878494263, -0.16243530809879303, -0.6604005098342896, 0.303070485591888...
func TestGithubCipdDEPSRepoManagerPreUploadSteps(t *testing.T) { // Create a fake pre-upload step. ran := false stepName := parent.AddPreUploadStepForTesting(func(context.Context, []string, *http.Client, string, *revision.Revision, *revision.Revision) error { ran = true return nil }) cfg := githubCipdDEPSRmCf...
[ -0.31119656562805176, 0.898063063621521, 0.7794020771980286, -0.3298676013946533, 0.5153847336769104, 0.610584557056427, 0.4567006826400757, -0.3249700665473938, -0.0456559993326664, -0.746988832950592, -1.1243165731430054, -0.6135762333869934, -0.6014105081558228, 0.9866218566894531, 0....
func TestGithubCipdDEPSRepoManagerPreUploadStepsError(t *testing.T) { ran := false expectedErr := errors.New("Expected error") stepName := parent.AddPreUploadStepForTesting(func(context.Context, []string, *http.Client, string, *revision.Revision, *revision.Revision) error { ran = true return expectedErr }) cf...
[ -0.3901999294757843, 0.7688512206077576, 0.6670750975608826, -0.36702731251716614, 0.5290287137031555, 0.8029542565345764, 0.404653936624527, -0.1475933939218521, -0.19465644657611847, -0.40928152203559875, -0.797246515750885, -0.4648495614528656, -0.6360248923301697, 0.9891558885574341, ...
func writeBootstrapConfig(config configWriter, path string) { switch filepath.Ext(path) { case ".yaml": f, err := os.Create(path) check(err) err = config.WriteYAML(f) check(err) check(f.Close()) default: check(fmt.Errorf("path %s must end in .yaml", path)) } }
[ -0.2030111849308014, -0.3681464195251465, 0.6094014048576355, 0.6174215078353882, -0.013226103968918324, -0.015431852079927921, 0.3551473319530487, 0.6758173108100891, -0.2851131856441498, 0.5742279887199402, -0.44228073954582214, -0.5320601463317871, 0.4202219843864441, 0.5158410668373108...
func HomePage(w http.ResponseWriter, req *http.Request) { switch req.Method { case "GET": // Serve the resource. fmt.Fprintf(w, "Hello, %q", html.EscapeString(req.URL.Path)) default: fmt.Fprintf(w, "Error: Invalid request") } }
[ 0.12449085712432861, 0.19179026782512665, 0.7711790800094604, 0.5091052651405334, 0.22425267100334167, -0.007762331981211901, 0.3397539258003235, 0.3598623275756836, -0.5104154348373413, -0.10479606688022614, 1.8392874002456665, -0.5528932809829712, -0.43131813406944275, 0.174507737159729,...
func NotesListPage(w http.ResponseWriter, req *http.Request) { switch req.Method { case "GET": // return list of valid note IDs default: // Give an error message. } }
[ -0.32404157519340515, -0.006671655457466841, 0.5395231246948242, 0.037127744406461716, 0.6252538561820984, -0.004141674377024174, -0.3320743441581726, -0.6691636443138123, 0.2362060248851776, 0.7288647890090942, 0.35396575927734375, 0.0705554187297821, -0.5300767421722412, 0.28922125697135...
func NotePage(w http.ResponseWriter, req *http.Request) { switch req.Method { case "GET": // return the note corresponding to the ID case "POST": // Create a new note, overwriting the old one, if it existed case "PUT": // Update the note. case "DELETE": // Delete the note default: // Give an error messa...
[ -0.44753530621528625, 0.3116465210914612, 0.7305062413215637, 0.13061514496803284, 1.2416269779205322, -0.2684380114078522, 0.15030616521835327, -0.7173994183540344, -0.16678717732429504, 0.7391397953033447, 0.9325246214866638, -0.41663700342178345, -0.5181020498275757, 0.3047163486480713,...
func (e *Engine) Handle(method string, path string, h HandlerFunc) *Route { return e.handler(method, path, h) }
[ 0.31170395016670227, -0.07680542767047882, 0.2649514377117157, 0.3552936017513275, 0.45771098136901855, 0.07279032468795776, 0.24530380964279175, 0.5510772466659546, -0.9186405539512634, -1.0420687198638916, 0.2202383130788803, 0.03520650044083595, 0.5758198499679565, -0.43288490176200867,...
func printFile(filename string) { file, err := os.Open(filename) if err != nil { panic(err) } scanner := bufio.NewScanner(file) for scanner.Scan() { fmt.Println(scanner.Text()) } }
[ 0.6451336145401001, -0.4214495122432709, 0.44277170300483704, 0.20998427271842957, 0.22083041071891785, 1.044018268585205, 0.2237304002046585, 0.7454943656921387, -1.3615449666976929, -0.39793363213539124, 0.07257936149835587, 0.3412284255027771, -0.29388123750686646, 0.3630911707878113, ...
func New() (*Config, error) { c := &Config{} configPath := os.Getenv("CONFIG_PATH") configFile := filepath.Join(configPath, ConfigFileName) file, err := os.Open(configFile) defer file.Close() if err != nil { return c, err } b, err := ioutil.ReadAll(file) if err != nil { return c, err } if len(b) != 0 {...
[ 0.41054776310920715, -1.245411992073059, 0.6080636382102966, 0.07698888331651688, -0.12024785578250885, -0.33506402373313904, -0.08930143713951111, 0.8694292902946472, -2.0236778259277344, 0.32394513487815857, -0.09985672682523727, -0.03404794633388519, 0.6428876519203186, 0.91498923301696...
func NewMemBook() (bookStore BookStore) { return &MemBook{ books: make(map[string]*models.Book), } }
[ -0.5442200303077698, -1.1966629028320312, 0.025085659697651863, 1.3026841878890991, -0.6498433947563171, 0.26623594760894775, -0.18651273846626282, 0.4446760416030884, -0.4254940152168274, 0.13077856600284576, 0.004680402111262083, -0.22433513402938843, -0.07076467573642731, 0.391137897968...
func (m *MemBook) Close(_ context.Context) (err error) { // Lock the Book data for async safe use. m.mux.Lock() defer m.mux.Unlock() // Delete all Book data. m.deleteAll() return nil }
[ -0.6846281886100769, -0.2550707161426544, 0.5546308159828186, 0.6938841938972473, -0.47450128197669983, 0.8158901929855347, 0.10222985595464706, -0.13699594140052795, -1.1828078031539917, -0.45258983969688416, 0.9160048365592957, 0.08306794613599777, -1.3084923028945923, 0.6725088953971863...
func (m *MemBook) Delete(_ context.Context, isbns []string) (err error) { // Lock the Book data for async safe use. m.mux.Lock() defer m.mux.Unlock() // Check for the empty case. if len(isbns) == 0 { // Delete all Book data. m.deleteAll() } else { // Iterate through the given ISBNs and delete their stat...
[ -0.3004149794578552, 0.09100433439016342, 0.4065939486026764, 1.785086750984192, 0.5666548013687134, 0.6424630284309387, -0.007910491898655891, 0.6550126671791077, -0.5612295269966125, 0.19424213469028473, 0.9593706130981445, 0.0494556799530983, -1.1162217855453491, 0.5179521441459656, -...
func (m *MemBook) Read(_ context.Context, isbns []string) (books map[string]models.Book, err error) { // Create the return map. books = make(map[string]models.Book, len(isbns)) // Lock the book data for async safe use. m.mux.RLock() defer m.mux.RUnlock() // Check for the empty case. if len(isbns) == 0 { //...
[ -0.9265608191490173, -0.4008811116218567, 0.5676366090774536, 1.351650595664978, -0.1584925651550293, 0.30125993490219116, -0.21901263296604156, -0.04329688474535942, -0.6134952902793884, 0.09242623299360275, 0.9708313345909119, 0.2835999131202698, -0.7658662796020508, -0.10124554485082626...
func (m *MemBook) Write(_ context.Context, books []models.Book, operation WriteOperation) (err error) { // Lock the Book data for async safe use. m.mux.Lock() defer m.mux.Unlock() // Iterate through the given statuses. for _, book := range books { // Check to see if a book with that ISBN already exists. if ...
[ -1.4512817859649658, -0.15837229788303375, 0.5677459836006165, 1.6167523860931396, 1.0663319826126099, 0.6553075313568115, 0.4331265687942505, 0.5101775527000427, -0.9608018398284912, 0.2879585325717926, 0.09563607722520828, -0.48593372106552124, -0.8984835147857666, 0.4623834192752838, ...
func (m *MemBook) deleteAll() { // Reassign the Book data so it's take by the garbage collector. m.books = make(map[string]*models.Book) }
[ 0.11668351292610168, -1.111372470855713, 0.21966415643692017, 0.5789402723312378, 0.3828798234462738, 0.9999318718910217, -0.14718832075595856, 0.5590142011642456, -0.6900589466094971, -0.9364556074142456, 0.19225738942623138, 0.11420267075300217, -0.22687233984470367, 1.3727197647094727, ...
func (b *BookmarksHandler) GetBookmarkByID() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { id := chi.URLParam(r, "id") user := ensureUser(r) bm, err := b.App.GetBookmarkByID(id, *user) if err != nil { encodeError(err, b.App.Logger, w, r) return } respondJSON(w, bm) } }
[ -0.2924726605415344, -0.47206440567970276, 0.3948698937892914, 0.4466731548309326, -0.06257259100675583, -0.5208595991134644, 0.48067015409469604, -0.9335425496101379, -0.3577391803264618, 0.15453845262527466, -0.573924720287323, 0.5425480008125305, -0.047445569187402725, 0.868912875652313...
func (b *BookmarksHandler) GetBookmarksByPath() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { path := queryParam(r, "path") user := ensureUser(r) b.App.Logger.InfoRequest(fmt.Sprintf("get bookmarks by path: '%s' for user: '%s'", path, user.Username), r) bms, err := b.App.GetBookmar...
[ -0.26858463883399963, -0.18121294677257538, 0.6472948789596558, 0.21916700899600983, 0.13055625557899475, -0.35314232110977173, 1.243643045425415, -1.116708517074585, -0.8460505604743958, 0.596830427646637, -0.8177309632301331, 0.16933393478393555, -0.3240232467651367, 0.45743444561958313,...
func (b *BookmarksHandler) GetBookmarksFolderByPath() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { path := queryParam(r, "path") user := ensureUser(r) b.App.Logger.InfoRequest(fmt.Sprintf("get bookmarks-folder by path: '%s' for user: '%s'", path, user.Username), r) bm, err := b.Ap...
[ -0.5116716623306274, -0.10342750698328018, 0.4844549894332886, 0.2862895727157593, -0.22844932973384857, -0.2961183488368988, 1.5405035018920898, -1.6793925762176514, -1.176474928855896, 0.2172602415084839, -0.27126041054725647, 0.6448932886123657, -0.43039315938949585, 0.5911011695861816,...
func (b *BookmarksHandler) GetAllPaths() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { user := ensureUser(r) paths, err := b.App.GetAllPaths(*user) if err != nil { encodeError(err, b.App.Logger, w, r) return } respondJSON(w, BookmarksPaths{ Paths: paths, Count: len(pa...
[ -0.16875740885734558, 0.10147131234407425, 0.6203428506851196, 1.2766581773757935, -0.46148109436035156, 0.07374124228954315, 0.6365751028060913, -0.020052526146173477, 0.06271255761384964, -0.5337864756584167, -0.19591571390628815, 0.16577720642089844, 0.26431164145469666, 0.9035055041313...
func (b *BookmarksHandler) GetBookmarksByName() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := queryParam(r, "name") user := ensureUser(r) b.App.Logger.InfoRequest(fmt.Sprintf("get bookmarks by name: '%s' for user: '%s'", name, user.Username), r) bms, err := b.App.GetBookmar...
[ -0.3266294300556183, -0.1611476093530655, 0.5409569144248962, 0.07435730844736099, -0.26087385416030884, -0.8515848517417908, 0.7821889519691467, -1.0673764944076538, -1.0462889671325684, 0.9076323509216309, -1.197386384010315, -0.1195746436715126, -0.23570561408996582, 0.7750694155693054,...
func (b *BookmarksHandler) GetFavicon() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { user := ensureUser(r) id := chi.URLParam(r, "id") b.App.Logger.InfoRequest(fmt.Sprintf("try to fetch bookmark with ID '%s'", id), r) favicon, err := b.App.GetBookmarkFavicon(id, *user) if err != ...
[ 0.22566290199756622, -0.08447129279375076, 0.567277193069458, 0.754827618598938, -0.5273207426071167, -0.7475282549858093, -0.06373487412929535, -0.03931793197989464, -0.44919416308403015, 0.4733562171459198, -1.390320897102356, 1.1701741218566895, 0.15246833860874176, 0.18253915011882782,...
func (b *BookmarksHandler) GetTempFavicon() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { id := chi.URLParam(r, "id") b.App.Logger.InfoRequest(fmt.Sprintf("get the locally fetched favicon with id '%s'", id), r) favicon, err := b.App.GetLocalFaviconByID(id) if err != nil { encodeE...
[ 0.44180431962013245, -0.49775663018226624, 0.599486231803894, -0.12383181601762772, -0.4942081868648529, -0.816538393497467, -0.09982028603553772, 0.054159700870513916, -0.26938921213150024, 0.5267347097396851, -1.352718710899353, 0.6583832502365112, 0.21488425135612488, 0.1700921207666397...
func (b *BookmarksHandler) CreateBaseURLFavicon() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // the post payload is interpreted as the URL defer r.Body.Close() payload, err := io.ReadAll(r.Body) if err != nil { b.App.Logger.ErrorRequest(fmt.Sprintf("could not read the URL from ...
[ 0.0934610515832901, -0.14324921369552612, 0.69670569896698, 0.5278958678245544, -0.48962870240211487, -0.2345154881477356, -0.6103689670562744, -0.11333305388689041, -0.24520954489707947, 0.485110342502594, -1.2429664134979248, 0.1703411340713501, 0.4075636863708496, -0.05483921617269516, ...
func (b *BookmarksHandler) CreateFaviconFromCustomURL() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // the post payload is interpreted as the URL defer r.Body.Close() payload, err := io.ReadAll(r.Body) if err != nil { b.App.Logger.ErrorRequest(fmt.Sprintf("could not read the URL...
[ 0.39530065655708313, -0.19598309695720673, 0.5357650518417358, 0.2061571180820465, -1.2881444692611694, -0.6630686521530151, -0.34469839930534363, -0.34325850009918213, 0.10296528786420822, 0.795141875743866, -1.071895718574524, 0.41326019167900085, 0.526850163936615, 0.5113200545310974, ...
func (b *BookmarksHandler) Create() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { user := ensureUser(r) payload := &BookmarkRequest{} if err := render.Bind(r, payload); err != nil { b.App.Logger.ErrorRequest(fmt.Sprintf("cannot bind payload: '%v'", err), r) encodeError(app.ErrVa...
[ -0.2098669558763504, -0.00821742508560419, 0.4951472878456116, 0.49789273738861084, 0.43419593572616577, 0.07386805862188339, 0.1381952315568924, -0.4655327796936035, -1.3302066326141357, 0.015501057729125023, -0.5456635355949402, -0.02921345643699169, 0.04947267845273018, 0.79846245050430...
func (b *BookmarksHandler) Delete() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { user := ensureUser(r) id := chi.URLParam(r, "id") b.App.Logger.InfoRequest(fmt.Sprintf("will try to delete bookmark with ID '%s'", id), r) err := b.App.Delete(id, *user) if err != nil { encodeErr...
[ -0.11661845445632935, -0.24040968716144562, 0.4618735611438751, 0.6212769746780396, 0.3000416159629822, -0.38290226459503174, 0.5014317631721497, -0.25110945105552673, -0.2496912032365799, 0.29327845573425293, -0.5470414757728577, 0.49822673201560974, -0.3879275918006897, 0.374613404273986...
func (b *BookmarksHandler) UpdateSortOrder() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { user := ensureUser(r) payload := &BookmarksSortOrderRequest{} if err := render.Bind(r, payload); err != nil { b.App.Logger.ErrorRequest(fmt.Sprintf("cannot bind payload: '%v'", err), r) en...
[ -1.0440729856491089, -0.6423556804656982, 0.3542361855506897, 0.042716123163700104, -0.7792102694511414, -0.33833712339401245, -0.07827281951904297, -0.9562800526618958, -0.5572435259819031, 0.5928237438201904, -0.9179683923721313, 0.33976107835769653, -0.6395019292831421, 0.35162907838821...
func (b *BookmarksHandler) FetchAndForward() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { user := ensureUser(r) id := chi.URLParam(r, "id") b.App.Logger.InfoRequest(fmt.Sprintf("try to fetch bookmark with ID '%s'", id), r) redirectURL, err := b.App.FetchAndForward(id, *user) if ...
[ 0.138236865401268, -0.0050580971874296665, 0.3773079216480255, -0.15229229629039764, -0.5494391322135925, 0.8809021711349487, 0.5906233191490173, -0.8682765960693359, -0.058891721069812775, -0.7111926674842834, -0.06527635455131531, 0.5183606743812561, 1.0858128070831299, 0.627315223217010...
func indexHandler(res http.ResponseWriter, req *http.Request) { fmt.Fprintf(res, "You requested: "+req.URL.Path) }
[ -0.31337839365005493, -0.8821301460266113, 0.24568194150924683, 0.2207004725933075, -0.11098913848400116, 0.07931087166070938, 1.3274704217910767, 1.149070143699646, -0.13039405643939972, -0.908105194568634, 0.6616402864456177, -0.25062668323516846, -0.48584064841270447, -0.805358648300170...
func NewServer(proto, addr string, job *engine.Job) (Server, error) { // Basic error and sanity checking switch proto { case "tcp": return setupTcpHttp(addr, job) default: return nil, errors.New("Invalid protocol format. Windows only supports tcp.") } }
[ -0.12316765636205673, -0.7277353405952454, 0.31410112977027893, 0.5736434459686279, -0.7554936408996582, 0.6533791422843933, -0.1534544974565506, 0.5364686846733093, -0.017754025757312775, 0.24556751549243927, 0.1722090095281601, 0.15979190170764923, -0.9509573578834534, 0.5776416063308716...
func thumbRelPath(i Image, t ThumbOpts) string { base := filepath.Base(i.RelPath) ext := filepath.Ext(base) noExt := strings.TrimSuffix(base, ext) thumbDir := filepath.Join(filepath.Dir(i.RelPath), "_") dimensions := "" if t.X != 0 { dimensions = fmt.Sprintf("x%d", t.X) } if t.Y != 0 { dimensions = fmt.Spr...
[ -0.18100358545780182, -0.4142328202724457, 0.857371985912323, -0.8361927270889282, -0.3405088186264038, 0.27085167169570923, 0.4184504747390747, -0.4133174419403076, 0.03555544465780258, 0.4491675794124603, 0.47915351390838623, -0.30364280939102173, -0.01794291101396084, -0.607413828372955...
func Constructor(k int) MyCircularDeque { hNode := &Node{} tNode := &Node{} hNode.next = tNode tNode.prev = hNode deque := MyCircularDeque{k, 0, hNode, tNode} return deque }
[ -0.22689880430698395, -0.30264657735824585, 0.4515039026737213, -0.9960473775863647, -0.4582975506782532, -0.33611270785331726, 0.17615532875061035, 1.0622814893722534, -0.44275766611099243, -0.04843337461352348, -0.47124162316322327, 0.048263564705848694, -0.32626545429229736, 0.903573930...
func (this *MyCircularDeque) InsertFront(value int) bool { if this.length == this.size { return false } node := &Node{value, nil, nil} this.head.next.prev = node node.next = this.head.next node.prev = this.head this.head.next = node this.length++ return true }
[ -0.9134920239448547, 1.6022634506225586, 0.6935653686523438, -1.9532372951507568, -0.2203492522239685, 0.08387637138366699, 0.7468418478965759, 0.020905787125229836, 0.73907470703125, -0.44288188219070435, -1.3214116096496582, -0.19820533692836761, -1.47920823097229, 0.6689003109931946, ...
func (this *MyCircularDeque) InsertLast(value int) bool { if this.length == this.size { return false } node := &Node{value, nil, nil} this.tail.prev.next = node node.prev = this.tail.prev node.next = this.tail this.tail.prev = node this.length++ return true }
[ -0.6244782209396362, 1.2908968925476074, 0.9434613585472107, -2.1353816986083984, 0.06625328212976456, 0.22491157054901123, 0.6692361831665039, 0.11126712709665298, 0.4804140031337738, 0.3953634202480316, -1.1158971786499023, -1.1866015195846558, -1.9948533773422241, 0.012310401536524296, ...
func (this *MyCircularDeque) DeleteFront() bool { if this.length == 0 { return false } node := this.head.next this.head.next = node.next node.next.prev = this.head node.prev = nil node.next = nil this.length-- return true }
[ -0.4436366856098175, 0.423330694437027, 0.6953144669532776, -1.3485732078552246, -0.14671966433525085, -0.48918086290359497, 0.2820247411727905, 0.22517560422420502, 0.9035393595695496, -0.33332690596580505, -1.3422214984893799, 0.563718855381012, -1.2700369358062744, 0.5288400650024414, ...
func (this *MyCircularDeque) DeleteLast() bool { if this.length == 0 { return false } node := this.tail.prev this.tail.prev = node.prev node.prev.next = this.tail node.prev = nil node.next = nil this.length-- return true }
[ 0.1416214108467102, 0.3370331823825836, 1.1180533170700073, -1.5776270627975464, 0.3415394723415375, -0.5019362568855286, 0.11561772227287292, 0.4363851249217987, 0.6444647908210754, 0.7746301293373108, -0.8149353265762329, -0.3639698624610901, -1.5314230918884277, -0.18617920577526093, ...
func (this *MyCircularDeque) GetFront() int { if this.length == 0 { return -1 } return this.head.next.val }
[ -0.6682788133621216, 0.6787889003753662, 0.3905404806137085, -0.1244996190071106, 0.22964614629745483, -0.5153059959411621, 0.3567732870578766, 0.18213577568531036, 0.3576560914516449, -1.5198678970336914, -0.6625925898551941, 1.561982274055481, -0.974267840385437, 1.1259377002716064, 0....
func (this *MyCircularDeque) GetRear() int { if this.length == 0 { return -1 } return this.tail.prev.val }
[ -0.6485776305198669, 0.3396233916282654, 0.6895534992218018, -0.238538920879364, 0.1003015786409378, -0.6934568285942078, 0.5217730402946472, 0.3538220524787903, 0.3656216263771057, -1.03847074508667, -0.19443638622760773, 0.9648592472076416, -1.0722514390945435, 0.42870616912841797, 1.0...
func (this *MyCircularDeque) IsEmpty() bool { return this.length == 0 }
[ -1.2417060136795044, -0.6323222517967224, 0.41589251160621643, -1.045370101928711, 1.0681092739105225, -0.0120034608989954, 0.12115716934204102, 0.19610100984573364, 0.6008845567703247, -0.10364846140146255, -0.8321331739425659, 0.5547529458999634, -0.7447102069854736, -0.01875890046358108...
func (this *MyCircularDeque) IsFull() bool { return this.length == this.size }
[ 0.4153323769569397, -0.7640007138252258, 0.4312453269958496, -0.6819937825202942, 0.1684105098247528, -0.09253380447626114, -0.31836485862731934, -0.012049471028149128, 1.248770833015442, 0.2502543032169342, -1.5975868701934814, 0.5463180541992188, -0.6407736539840698, -0.15404443442821503...
func main() { c := Constructor(3) c.InsertLast(1) c.InsertLast(2) c.InsertFront(3) c.InsertFront(4) fmt.Println(c.GetRear()) fmt.Println(c.IsFull()) c.DeleteLast() c.InsertFront(4) fmt.Println(c.GetFront()) }
[ -0.0006049670628271997, 0.43917596340179443, 0.594187319278717, -0.3585154712200165, 0.8740717768669128, -0.269870400428772, 1.2560070753097534, 0.4025709927082062, 0.48202431201934814, -0.8998805284500122, -0.5086387991905212, -0.5221649408340454, -0.03505870699882507, -0.3160530030727386...
func (cs *CacheWithSubcache) Get(key string) (interface{}, error) { return cs.Subcache.GetOrCompute(key, func() (interface{}, error) { return cs.Cache.Get(key) }) }
[ -0.6323187351226807, 0.8372679352760315, 0.49167102575302124, 0.6653939485549927, -0.740405797958374, -0.5156480073928833, -0.6028023958206177, -0.051773589104413986, -0.8353167176246643, 0.18373362720012665, -0.8866673111915588, 0.787117600440979, 0.36190730333328247, -0.02253853902220726...
func (cs *CacheWithSubcache) Peek(key string) (interface{}, error) { value, err := cs.Subcache.Peek(key) if err == nil { return value, err } return cs.Cache.Peek(key) }
[ 0.035667791962623596, 0.9624759554862976, 0.6945576667785645, 0.19438742101192474, -1.3298985958099365, -0.4117854833602905, -0.18940939009189606, -1.0848826169967651, -0.23264676332473755, 0.45092129707336426, -0.4899899363517761, 0.6531743407249451, 0.530121922492981, 0.1651463657617569,...
func (cs *CacheWithSubcache) Set(key string, value interface{}) error { if err := cs.Subcache.Set(key, value); err != nil { return err } return cs.Cache.Set(key, value) }
[ -0.4335995316505432, 0.46479856967926025, 0.26326635479927063, 0.39117878675460815, -1.2390117645263672, 0.5707589983940125, -0.5264250636100769, -0.2743687629699707, -0.6925866603851318, 0.6619441509246826, -0.7652207612991333, 0.3142858147621155, 0.19023700058460236, 0.36990946531295776,...
func (cs *CacheWithSubcache) Delete(key string) error { if err := cs.Cache.Delete(key); err != nil { return err } return cs.Subcache.Delete(key) }
[ 0.629335880279541, 0.9962438941001892, 0.5324668288230896, 0.8803516030311584, -0.8432300090789795, 0.3729993999004364, -0.37921082973480225, 0.31569987535476685, -0.07635096460580826, 0.7309063076972961, -0.7140052914619446, -0.1518101990222931, -0.5952292084693909, 0.2393450140953064, ...
func (cs *CacheWithSubcache) Keys() ([]string, error) { return cs.Cache.Keys() }
[ -0.2623891532421112, 0.4647828936576843, 0.13868087530136108, 0.5319915413856506, -0.2882322371006012, 0.0993041843175888, -0.8266740441322327, 0.15372900664806366, 0.08764810860157013, 0.2041819989681244, -1.2007594108581543, 0.8758548498153687, 0.13119299709796906, 0.4433195888996124, ...
func (cs *CacheWithSubcache) Purge() error { keys, err := cs.Keys() if err != nil { return err } for _, key := range keys { if err := cs.Delete(key); err != nil { return err } } return nil }
[ 0.24075078964233398, 1.0625554323196411, 0.3052169382572174, 0.5377660989761353, 0.6153004169464111, -0.9950908422470093, -0.8807362914085388, -0.3273785710334778, -0.22221112251281738, 0.2668951153755188, -1.0827898979187012, 0.29616308212280273, -0.3261565864086151, 0.6245129704475403, ...
func AgentWithConfig(ctx context.Context, agentNamespace, controllerNamespace, agentScope string, cg *client.Getter, tokenName string, opts *Options) ([]runtime.Object, error) { if opts == nil { opts = &Options{} } objs := []runtime.Object{ &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: agentNamespace}}, } ...
[ -0.24866262078285217, -1.5192959308624268, 0.5249941945075989, 0.0790116935968399, -0.39651528000831604, -1.3527456521987915, -1.2252326011657715, -0.44644826650619507, 0.9897623062133789, 0.8346319794654846, -0.669890820980072, 0.28204667568206787, 0.4433087110519409, 0.8604369163513184, ...
func agentBootstrapSecret(ctx context.Context, agentNamespace, controllerNamespace string, client *client.Client, tokenName string, opts *Options) (*v1.Secret, error) { data, err := getToken(ctx, controllerNamespace, tokenName, client) if err != nil { return nil, err } if opts.Host != "" { data["apiServerURL"]...
[ -0.12859971821308136, -0.5663163065910339, 0.6099958419799805, -0.46995386481285095, -0.19576960802078247, -0.5373066067695618, -0.9900698661804199, -0.8831787109375, 0.1671477109193802, 0.5967326164245605, -0.2338891476392746, 0.12430264800786972, -0.06958470493555069, -0.5660709738731384...
func getToken(ctx context.Context, controllerNamespace, tokenName string, client *client.Client) (map[string][]byte, error) { secretName, err := waitForSecretName(ctx, tokenName, client) if err != nil { return nil, err } secret, err := client.Core.Secret().Get(client.Namespace, secretName, metav1.GetOptions{}) ...
[ 0.10901430249214172, 0.4145592153072357, 0.7472425103187561, -0.2593456208705902, 0.10797759890556335, -1.1444249153137207, -0.2644738554954529, 0.18087507784366608, -0.0720653310418129, -0.12024496495723724, -1.368360996246338, 1.419796347618103, 0.07857394218444824, 0.8624537587165833, ...
func handleWeatherWS(conn *websocket.Conn) { // Subscribe the socket to receive updates. weatherUpdate.AddSocket(conn) // Connection closes when function returns. Since uibroadcast is writing and we don't need to read anything (for now), just keep it busy. for { buf := make([]byte, 1024) _, err := conn.Read(bu...
[ 0.46477824449539185, 0.15045441687107086, 0.7718804478645325, -0.2355930656194687, -0.18250322341918945, -0.12818214297294617, -0.34557586908340454, -0.29408371448516846, -0.10964933037757874, -0.5030916929244995, 0.28452542424201965, 0.22264635562896729, -0.6112276315689087, 0.73106712102...
func handleTrafficWS(conn *websocket.Conn) { trafficMutex.Lock() for _, traf := range traffic { if !traf.Position_valid { // Don't send unless a valid position exists. continue } trafficJSON, _ := json.Marshal(&traf) conn.Write(trafficJSON) } // Subscribe the socket to receive updates. trafficUpdate.Add...
[ 0.06498019397258759, 0.0497656874358654, 0.6597370505332947, -0.30556154251098633, 0.12623344361782074, -0.6972809433937073, 0.06752284616231918, -0.6628378629684448, -0.12145645916461945, 0.14522624015808105, -0.26964566111564636, -0.43995651602745056, -0.3053742051124573, 0.1611606031656...
func handleStatusRequest(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Content-Type", "application/json") statusJSON, _ := json.Marshal(&globalStatus) fmt.Fprintf(w, "%s\n", statusJSON) }
[ -0.34299394488334656, -1.1895978450775146, 0.6959266066551208, 0.0017747855745255947, -0.12115153670310974, 0.39339524507522583, 0.11668661236763, 0.5019108653068542, -0.35221415758132935, 0.2148866206407547, -0.16544760763645172, 0.6437228322029114, 0.3340395987033844, 0.4996906518936157,...
func handleSituationRequest(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Content-Type", "application/json") situationJSON, _ := json.Marshal(&mySituation) fmt.Fprintf(w, "%s\n", situationJSON) }
[ -0.9786049723625183, -1.4242128133773804, 0.616482675075531, -0.3805500268936157, -0.2666102349758148, -0.17455683648586273, 0.04658076539635658, 0.20772527158260345, 0.17006199061870575, 0.20562222599983215, 0.5101597309112549, -0.34624654054641724, 0.5019078850746155, 0.06687518954277039...
func handleTowersRequest(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Content-Type", "application/json") towersJSON, _ := json.Marshal(&ADSBTowers) // for testing purposes, we can return a fixed reply // towersJSON = []byte(`{"(38.490880,-76.135554)":...
[ -0.15144576132297516, -0.8898341059684753, 0.9907873272895813, -1.5206646919250488, 0.2052367776632309, -0.0011816006153821945, -0.2083003669977188, -1.2094640731811523, 0.07869242131710052, 0.11040642857551575, -0.07238704711198807, 0.033056944608688354, 0.10780348628759384, 0.56700927019...
func handleSettingsGetRequest(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Content-Type", "application/json") settingsJSON, _ := json.Marshal(&globalSettings) fmt.Fprintf(w, "%s\n", settingsJSON) }
[ -0.875805675983429, -0.12944313883781433, 0.691665768623352, -0.027473267167806625, -0.034367725253105164, -0.10908161848783493, 0.06306877732276917, -0.5071746706962585, -0.9370220303535461, 0.9480161070823669, 0.6436102986335754, 0.4939926862716675, -0.301491916179657, 0.308660089969635,...
func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) { // define header in support of cross-domain AJAX w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Method", "GET, POST, OPTIONS") w.Header().Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Co...
[ -1.0083752870559692, 0.009670916013419628, 1.0022859573364258, 0.35354042053222656, 0.14929071068763733, -0.18250057101249695, -0.29115909337997437, -0.5566410422325134, -0.46846362948417664, 0.731036901473999, 0.4855027496814728, 0.06318741291761398, -0.49056875705718994, 0.62673932313919...
func (cl *Client) GetLeaderSchedule( ctx context.Context, ) (out *GetLeaderScheduleResult, err error) { return cl.GetLeaderScheduleWithOpts( ctx, nil, ) }
[ -0.44870680570602417, 0.2794981002807617, 0.4182192385196686, 0.2981163263320923, 0.3219137191772461, 0.2317991703748703, -0.4254527688026428, -1.2461107969284058, 0.5418382883071899, 0.006946875713765621, -0.26043206453323364, 1.1635353565216064, -1.0596718788146973, -0.30698275566101074,...
func (cl *Client) GetLeaderScheduleWithOpts( ctx context.Context, opts *GetLeaderScheduleOpts, ) (out *GetLeaderScheduleResult, err error) { params := []interface{}{} if opts != nil { if opts.Epoch != nil { params = append(params, opts.Epoch) } obj := M{} if opts.Commitment != "" { obj["commitment"] =...
[ -0.4227924346923828, 0.33549171686172485, 0.8958044052124023, -0.24967867136001587, 0.05601688474416733, -0.07902964949607849, -1.372310757637024, -1.0686559677124023, 0.578220784664154, 0.48337680101394653, -0.5075742602348328, 0.9721053838729858, -1.0390599966049194, -0.2420555055141449,...
func (m *BaseMethod) GetHeader() []KVPair { return m.Headers }
[ -1.037484884262085, -0.16599015891551971, 0.5951066017150879, 1.4580252170562744, 0.1313476860523224, -0.27852532267570496, 0.11911178380250931, -0.9779108762741089, -0.03160925582051277, -0.4839690327644348, 0.10247352719306946, -0.43069422245025635, -0.6670230031013489, 1.132795572280883...