text
stringlengths
11
6.3k
embedding
listlengths
768
768
func getFileInfo() string { _, fn, line, _ := runtime.Caller(2) gopath := os.Getenv("GOPATH") if gopath == "" { gopath = build.Default.GOPATH } fn = strings.TrimLeft(fn, gopath+"/src/") f := strings.SplitAfterN(fn, "/", 4) fn = f[len(f)-1] return fmt.Sprintf("[%s:%d]", fn, line) }
[ 0.45809975266456604, -0.03604850172996521, 0.7265970706939697, -0.6457502245903015, 1.1743223667144775, 0.192922443151474, 0.264299213886261, 0.02347143553197384, -1.3228669166564941, 0.21920035779476166, 0.14491645991802216, 0.13089630007743835, 0.051178254187107086, 0.3196752369403839, ...
func errnoIsErr(err error) error { if err.(syscall.Errno) != 0 { return err } return nil }
[ -0.548774003982544, -0.9793254137039185, 0.2854903042316437, 0.44266340136528015, -0.9919594526290894, 0.17320890724658966, -0.6087775230407715, 0.3906795382499695, 0.38029569387435913, -0.5728011131286621, -0.05059010535478592, -0.5013686418533325, -0.4752916097640991, 1.7094073295593262,...
func loop(loopbackDevice, image *os.File) error { _, _, err := syscall.Syscall( syscall.SYS_IOCTL, loopbackDevice.Fd(), loopSetFd, image.Fd(), ) return errnoIsErr(err) }
[ -0.1446019411087036, 0.24949297308921814, 0.22644735872745514, 0.26499247550964355, -0.2681853175163269, 0.4728997051715851, 0.6440531611442566, -0.9436661601066589, -0.5479028820991516, 0.650938093662262, 0.9387186765670776, 0.6959995627403259, 0.0013121555093675852, 0.21349570155143738, ...
func unloop(loopbackDevice *os.File) error { _, _, err := syscall.Syscall(syscall.SYS_IOCTL, loopbackDevice.Fd(), loopClrFd, 0) return errnoIsErr(err) }
[ -0.004327692557126284, 0.5388023257255554, 0.5632203221321106, -0.3532090485095978, -0.6330893635749817, -0.004240748006850481, 0.7934677600860596, 0.21859416365623474, -0.6646121740341187, 0.16981740295886993, 0.3845553696155548, 0.1686776578426361, -0.44365182518959045, -0.46781256794929...
func nextLoopDevice() (*os.File, error) { loopInt, err := nextUnallocatedLoop() if err != nil { return nil, err } return os.Open(fmt.Sprintf("/dev/loop%d", loopInt)) }
[ -0.6199858784675598, 0.6626235842704773, 0.5951967835426331, -0.1029745563864708, -1.235714077949524, 0.8340293765068054, 1.056121587753296, -0.8381190896034241, 0.11018895357847214, -0.6600381731987, 0.7663224935531616, 0.21732065081596375, 0.005547690205276012, 0.15456335246562958, 0.8...
func nextUnallocatedLoop() (int, error) { fd, err := os.OpenFile("/dev/loop-control", os.O_RDONLY, 0644) if err != nil { return 0, err } defer fd.Close() index, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd.Fd(), loopCtlGetFree, 0) return int(index), errnoIsErr(err) }
[ 0.2061229646205902, 0.41897428035736084, 0.6616011261940002, -0.48609834909439087, -0.6621424555778503, 0.1928974986076355, 0.9048025608062744, -0.45097237825393677, -0.3492673933506012, -0.4243340790271759, 0.17001575231552124, 0.1971513330936432, -0.8404309153556824, 0.05468200147151947,...
func (n *Node) Info() (fi os.FileInfo, fserr *Message) { var err error if n.FileInfo == nil { if n.FileInfo, err = os.Stat(n.Path); err != nil { n.Err = ErrorMessage(fmt.Errorf(n.Path + err.Error())) } } return n.FileInfo, n.Err }
[ 0.016012994572520256, -0.8530112504959106, 0.5840184092521667, -0.8481544256210327, 0.231730654835701, -0.4018726944923401, 0.4069557785987854, -0.5775559544563293, -1.1335989236831665, -0.05307173728942871, 0.047756779938936234, 0.0379234254360199, 0.6710750460624695, 0.9417940378189087, ...
func ValidateCredentials(secret *corev1.Secret) error { if secret == nil { return errors.New("Nil secret") } switch string(secret.Type) { case AWSSecretType: return ValidateAWSCredentials(secret) case AzureSecretType: return ValidateAzureCredentials(secret) case GCPSecretType: return ValidateGCPCredential...
[ -0.0938459187746048, -0.2938663065433502, 0.5222497582435608, 0.14867019653320312, 0.13776133954524994, 0.18289636075496674, -0.09061776101589203, -0.320022851228714, 0.16464027762413025, 0.6282738447189331, -0.05061139166355133, 0.37897416949272156, -0.5282502174377441, 1.3250986337661743...
func New() *Server { return &Server{make([]*websocket.Conn, 0, 10)} }
[ -0.4378340244293213, -0.9476752281188965, 0.35495829582214355, -0.6042550206184387, 0.26668763160705566, -0.20656782388687134, -0.30766934156417847, -0.2890414893627167, 0.47525694966316223, -0.006602856330573559, -1.2633771896362305, 1.0578023195266724, -0.19453072547912598, 0.31658455729...
func (server *Server) Start(path string) { onConnected := func(ws *websocket.Conn) { defer ws.Close() server.connections = append(server.connections, ws) server.Register(ws) } http.Handle(path, websocket.Handler(onConnected)) }
[ -0.1393452286720276, -0.7041329741477966, 0.6187610626220703, -0.26338380575180054, 0.11299742758274078, 0.38654693961143494, 0.08222327381372452, 0.33412012457847595, -0.21628828346729279, 0.02188313938677311, -1.2059013843536377, 1.5236968994140625, -0.15343911945819855, 0.48719841241836...
func (server *Server) Register(client *websocket.Conn) { var msg string RECEIVE_LOOP: for { switch websocket.Message.Receive(client, &msg) { case nil: server.Broadcast(msg) case io.EOF: server.RemoveClient(client) break RECEIVE_LOOP } } }
[ 0.21225546300411224, 0.4484782814979553, 0.82330322265625, -0.3162449300289154, 0.6715867519378662, -0.4870857298374176, 0.03259221836924553, -0.38928744196891785, -0.23276163637638092, 0.22920462489128113, -0.5930284857749939, 1.55884850025177, -0.8232739567756653, 1.1054970026016235, 0...
func (server *Server) Broadcast(msg string) { for _, socket := range server.connections { go func(ws *websocket.Conn) { websocket.Message.Send(ws, msg) }(socket) } }
[ -0.7366147041320801, -0.1618776023387909, 0.8901522755622864, 0.21603277325630188, 0.5224936604499817, 0.36675646901130676, 1.0706696510314941, -0.05573334917426109, 0.09679411351680756, 0.17904211580753326, 0.2451019287109375, 1.2294046878814697, -0.6491429805755615, 1.5389691591262817, ...
func (server *Server) RemoveClient(socket *websocket.Conn) { for i, client := range server.connections { if client == socket { server.connections = append(server.connections[:i], server.connections[i+1:]...) socket.Close() break } } }
[ -0.7294848561286926, -0.6269243955612183, 0.5239676237106323, -0.8005621433258057, -0.8477184772491455, -0.28978076577186584, 0.7164996862411499, -0.13759365677833557, 0.2519592046737671, 0.6916450262069702, -0.9769256114959717, 1.0826212167739868, -1.2970672845840454, 0.14334125816822052,...
func New(fs afero.Fs) *AferoFs { return &AferoFs{Fs: fs} }
[ 0.1910448521375656, -0.7507416009902954, 0.026329280808568, -0.5913019776344299, -1.0859251022338867, -1.191144585609436, 0.32846179604530334, -0.8239714503288269, 0.6410037279129028, -0.4811446964740753, 0.8366738557815552, -0.2916637659072876, 1.3725212812423706, 0.42611703276634216, 0...
func (ab *AddBackend) Help() string { helpText := ` Usage: xavi add-backend [options] Options: -name Backend name -servers List of servers to add to backend, e.g. server1,server2,server3 no spaces -load-balancer-policy Load balancer policy name -cacert-path Path to PEM file containing CA cert for backe...
[ 1.3550831079483032, 0.1280304491519928, 0.9130135774612427, -0.6489936113357544, 0.5377784967422485, 0.4990735948085785, -0.10820938646793365, -0.7880917191505432, -0.2512917220592499, 1.3923877477645874, -0.013488656841218472, 1.1186927556991577, -0.7697696089744568, -0.45728054642677307,...
func (ab *AddBackend) Run(args []string) int { log.Debug("AddBackend run commands ", args) var name, serverList, loadBalancerPolicy, caCertPath string var tlsOnly bool cmdFlags := flag.NewFlagSet("add-backend", flag.ContinueOnError) cmdFlags.Usage = func() { ab.UI.Output(ab.Help()) } cmdFlags.StringVar(&name, "na...
[ 0.23644214868545532, -0.23719649016857147, 1.2349308729171753, 0.343097984790802, -0.11723842471837997, 1.2749649286270142, 0.5302668809890747, -0.03974912688136101, -0.10874564200639725, 0.5644406676292419, -0.36391112208366394, 0.430863618850708, -1.1927928924560547, 1.082341194152832, ...
func (ab *AddBackend) Synopsis() string { return "Define a backend as a collection of servers" }
[ 0.6824876666069031, 0.7446315884590149, 0.2504599392414093, 0.08933467417955399, 0.688623309135437, -0.7205471396446228, -0.5612238049507141, 0.10919130593538284, -0.0022138613276183605, 1.0155696868896484, 0.5139288902282715, 0.5338566899299622, -0.43972453474998474, -0.020411375910043716...
func (slot fyFlexboxRow) fyMainCrossSizeForMainCrossLimits(limits frenyard.Vec2i, vertical bool, debug bool) frenyard.Vec2i { if debug { fmt.Print("R{") } // Main & Cross in here refer to in the row flexbox, not the outer flexbox. maximumMain := int32(0) presentAreaCross := slot.fullArea.Size().ConditionalTransp...
[ 0.1397416889667511, -0.05653786286711693, 0.6805471777915955, 0.22031377255916595, -0.7483721971511841, -1.2198668718338013, 0.6518420577049255, 0.07752355933189392, 0.12772196531295776, 0.17442147433757782, 0.49842607975006104, -0.11883126199245453, -0.42293888330459595, 0.973847508430481...
func (slot *fyFlexboxRow) Fill(area frenyard.Area2i, vertical bool) { for k := range slot.area { if !vertical { // Rows perpendicular to X slot.area[k].X = area.X } else { // Rows perpendicular to Y slot.area[k].Y = area.Y } } slot.fullArea = area }
[ -0.3300289511680603, 0.24150019884109497, 0.5376914143562317, 0.04918966442346573, -0.6404848098754883, -0.1401384025812149, 0.516309380531311, 0.4517022967338562, 0.19603653252124786, 0.28382793068885803, 0.1440127193927765, -0.5137987732887268, 0.5465986728668213, 1.1418362855911255, -...
func fyFlexboxSolveLine(details FlexboxContainer, slots []fyFlexboxSlotlike, out []frenyard.Area2i, mainCrossLimits frenyard.Vec2i, debug bool) bool { if len(slots) == 0 { // Nowhere to output. Also, some calculations rely on at least one slot existing. return false } if debug { if details.DirVertical { fmt...
[ 0.1063205823302269, 0.462698757648468, 0.8304824233055115, 0.42832088470458984, -0.5460760593414307, -1.0352619886398315, 1.028789758682251, -0.1528519243001938, 0.36148738861083984, -0.7504664659500122, -0.14866144955158234, -0.47638198733329773, -0.09619124978780746, 1.1491265296936035, ...
func NewUIFlexboxContainerPtr(setup FlexboxContainer) *UIFlexboxContainer { container := &UIFlexboxContainer{ UIPanel: NewPanel(frenyard.Vec2i{}), } InitUILayoutElementComponent(container) container.SetContent(setup) container.FyEResize(container._preferredSize) return container }
[ -0.06456863135099411, -0.391837477684021, 0.2566463053226471, -0.0774485245347023, -0.5305386185646057, -0.4718696177005768, 0.5652362704277039, -0.21620117127895355, 0.5326918959617615, -0.29448655247688293, 0.3748141825199127, -0.4630032479763031, -0.17713776230812073, 0.7078085541725159...
func (ufc *UIFlexboxContainer) SetContent(setup FlexboxContainer) { if ufc._state.Slots != nil { for _, v := range ufc._state.Slots { if v.Element != nil { ufc.ThisUILayoutElementComponentDetails.Detach(v.Element) } } } ufc._state = setup for _, v := range setup.Slots { if v.Element != nil { ufc....
[ 0.1458127349615097, 0.3919273614883423, 0.49354684352874756, 0.1637255847454071, 0.13237343728542328, -0.047556955367326736, 0.7075342535972595, -0.15681028366088867, 0.2057611346244812, -0.563365638256073, -0.39491555094718933, -0.6150158643722534, 0.23706980049610138, 0.6777031421661377,...
func combineColor(color ColorName, isBackgroundColor bool) outPutSet { if color >= COLOR_BLACK && color <= COLOR_WHITE { if isBackgroundColor { return COLOR_BACKGROUND + outPutSet(color) } return COLOR_FOREGROUND + outPutSet(color) } return 0 }
[ -0.13139908015727997, -0.053304899483919144, 0.4411579966545105, 0.6893638372421265, 0.34086859226226807, -0.6761110424995422, 0.05853266268968582, 0.13167256116867065, 0.028069185093045235, 0.9203543663024902, 1.4908591508865356, 0.5408926010131836, 0.1132684201002121, 1.2781264781951904,...
func (n *Notifier) ConversationIDFromTopic(topic string) string { return utils.UUIDWithString(fmt.Sprintf("conversation:%s;%s", n.UserID, topic)) }
[ 0.7611995339393616, -1.3667272329330444, 0.0806007906794548, 0.12614330649375916, -0.04350551590323448, 0.9637073278427124, 0.03152388334274292, -0.46596893668174744, 0.5793233513832092, 0.768760085105896, 0.903151273727417, -0.49252450466156006, -0.32320892810821533, -0.08851806074380875,...
func (n *Notifier) FetchOrCreateConversation(s *session.Session, topic string) (string, error) { conversationID := n.ConversationIDFromTopic(topic) if _, f := conversations[conversationID]; f { return conversationID, nil } participants := []*mixin.Participant{ &mixin.Participant{ UserID: adminID, Role: ...
[ 0.3630818724632263, -0.21004842221736908, 0.6859820485115051, -0.33216285705566406, 0.33311647176742554, -0.05598624423146248, 0.2545148432254791, -1.363398790359497, 0.9169626832008362, 0.700617253780365, 0.45167019963264465, -0.8000136017799377, -0.5274914503097534, 1.2805252075195312, ...
func InitNewWebsite(c *ishell.Context) { // Demande pour le nom du site web c.Print("Domain name of the website (ex : wafg.ca) : ") c.Print("Enter your full name : ") // Demande qu'elle page de base je veux d'enable c.Print("Admin account create with success") }
[ 0.7695727348327637, 0.3209565281867981, 0.5859125852584839, 0.6362347602844238, -0.22765393555164337, 0.8369655609130859, 0.09130559861660004, -0.29349029064178467, -0.3622513711452484, -0.14207592606544495, -0.9801420569419861, 1.54276442527771, -0.4860067069530487, 1.0371359586715698, ...
func (this *AlarmTask) RegisterCallback(callback AlarmCallback) { this.lock.Lock() defer this.lock.Unlock() this.callback = append(this.callback, callback) }
[ 0.10425850749015808, 0.16273216903209686, 0.6405428051948547, 0.9102003574371338, 0.6976740956306458, 0.49588480591773987, -0.39280572533607483, 0.24417062103748322, 0.5267288088798523, -0.1144847720861435, -1.1910911798477173, -0.20463743805885315, 0.08928931504487991, 0.8717259764671326,...
func (this *AlarmTask) RemoveCallback(cb AlarmCallback) { this.lock.Lock() defer this.lock.Unlock() for k, c := range this.callback { addr1 := &c addr2 := &cb if addr1 == addr2 { this.callback = append(this.callback[:k], this.callback[k+1:]...) } } }
[ 0.16673138737678528, -0.22906124591827393, 0.7367731928825378, 0.7047604322433472, -0.6676768064498901, -0.09971553832292557, 0.8430841565132141, 0.4739207327365875, 1.1116009950637817, 0.8862864971160889, -1.1474406719207764, -0.35673201084136963, -0.6735025644302368, 0.5880957245826721, ...
func PluginGoTypesJenny(root string) codejen.OneToOne[*pfs.PluginDecl] { return &pgoJenny{ root: root, } }
[ -1.092534065246582, 0.13467654585838318, 0.2851192057132721, 0.3426845073699951, -0.051005564630031586, -1.3519632816314697, -0.0806293711066246, -0.6430739760398865, 0.1576845645904541, -0.3091895580291748, -0.8651388883590698, 0.49366632103919983, -0.695031464099884, 0.37728896737098694,...
func ZipFolder(folder string, zipFile string) error { outFile, err := os.Create(zipFile) if err != nil { return err } defer outFile.Close() w := zip.NewWriter(outFile) zipFilePath := strings.Split(zipFile, "/") err = addFiles(w, folder, "", zipFilePath[len(zipFilePath)-1]) if err != nil { return err } ...
[ -0.030850764364004135, -0.034771256148815155, 0.5461207628250122, -0.2981441020965576, 0.1919195055961609, 0.5514232516288757, 1.4111453294754028, 0.23938094079494476, -0.7323534488677979, -0.333351731300354, -0.0493960864841938, -0.5750815868377686, -0.8345563411712646, 0.5625240802764893...
func BuildValidatingWebhook(mgr *manager.Manager) *admission.Webhook { return &admission.Webhook{Handler: &collectionValidator{}} }
[ 0.18174177408218384, -0.6257768869400024, -0.06301018595695496, 0.340162068605423, -0.23359999060630798, 1.2920221090316772, 0.12282664328813553, 0.8962624073028564, -0.2083866000175476, -0.7601229548454285, 0.1274794489145279, 0.8618981838226318, 0.08442303538322449, 0.8168171644210815, ...
func (v *collectionValidator) Handle(ctx context.Context, req admission.Request) admission.Response { collection := &kabanerov1alpha1.Collection{} err := v.decoder.Decode(req, collection) if err != nil { return admission.Errored(http.StatusBadRequest, err) } allowed, reason, err := v.validateCollectionFn(ctx, ...
[ -0.49124208092689514, -0.0980074554681778, 0.99271559715271, 0.7873032093048096, 0.12654627859592438, 0.5837116837501526, 0.312330037355423, -0.22014200687408447, -0.09615124017000198, -0.5759670734405518, 0.6436445116996765, -0.09974431991577148, -0.37406113743782043, 0.4310445189476013, ...
func (v *collectionValidator) InjectClient(c client.Client) error { v.client = c return nil }
[ -0.06390941888093948, -0.09600431472063065, 0.24536778032779694, -0.23058916628360748, -0.23729312419891357, 1.8582578897476196, 0.5740607380867004, -0.2577888071537018, -0.4665873348712921, -0.6737295389175415, -0.5169264078140259, 0.395975798368454, -1.251145601272583, 0.3780017495155334...
func (v *collectionValidator) InjectDecoder(d *admission.Decoder) error { v.decoder = d return nil }
[ -0.3394121825695038, -0.28278034925460815, 0.4285140931606293, -0.1292271614074707, -0.5783829689025879, 0.7988221049308777, -0.19146567583084106, 0.06911399215459824, 0.06395287066698074, -0.845994770526886, 0.024511028081178665, -0.1405119150876999, 0.19783718883991241, 1.950783848762512...
func (a *APIv1) PostLocation(location *entities.Location) (*entities.Location, []error) { _, err := location.ContainsMandatoryParams() if err != nil { return nil, err } supported, err2 := entities.CheckEncodingSupported(location, location.EncodingType) if !supported || err2 != nil { return nil, []error{err2} ...
[ -1.8559740781784058, 0.3384832441806793, 0.8149047493934631, -0.2990952730178833, -0.6689894795417786, 0.20662765204906464, 0.2805200517177582, 0.701166033744812, 0.23279881477355957, 0.4305986762046814, -0.30295464396476746, -0.6127610802650452, -1.1385562419891357, 0.9488375186920166, ...
func (a *APIv1) PostLocationByThing(thingID interface{}, location *entities.Location) (*entities.Location, []error) { var err []error var err2 error l, err := a.PostLocation(location) if len(err) > 0 { return nil, err } if thingID != nil { err2 = a.LinkLocation(thingID, l.ID) if err2 != nil { err3 := a....
[ -1.2875052690505981, 0.11755390465259552, 1.1503769159317017, -0.14990681409835815, 0.36267244815826416, 0.05839204415678978, 0.3567013442516327, 0.20468942821025848, 0.15149006247520447, 0.0017669430235400796, 0.08427294343709946, 0.22028276324272156, -0.5589492917060852, 0.84500366449356...
func (a *APIv1) GetLocation(id interface{}, qo *odata.QueryOptions, path string) (*entities.Location, error) { _, err := a.QueryOptionsSupported(qo, &entities.Location{}) if err != nil { return nil, err } l, err := a.db.GetLocation(id, qo) if err != nil { return nil, err } a.ProcessGetRequest(l, qo) retur...
[ -0.7753428816795349, 0.13061200082302094, 0.6206281781196594, 0.44029220938682556, 0.5028905868530273, -0.08839273452758789, 0.7646895051002502, -0.6837309002876282, 0.48365166783332825, 0.2747575044631958, 0.5819979310035706, 0.0226521585136652, -0.3332538604736328, -0.3309551775455475, ...
func (a *APIv1) GetLocations(qo *odata.QueryOptions, path string) (*models.ArrayResponse, error) { _, err := a.QueryOptionsSupported(qo, &entities.Location{}) if err != nil { return nil, err } locations, count, err := a.db.GetLocations(qo) return processLocations(a, locations, qo, path, count, err) }
[ -0.9592856168746948, 0.4464447796344757, 0.6744442582130432, 0.32569628953933716, 0.6730130910873413, -0.37574073672294617, 0.800788402557373, -0.6009969115257263, 0.43794235587120056, -0.10586561262607574, 0.36257076263427734, -0.036017924547195435, -0.5405035018920898, 0.0808717235922813...
func (a *APIv1) GetLocationsByHistoricalLocation(hlID interface{}, qo *odata.QueryOptions, path string) (*models.ArrayResponse, error) { _, err := a.QueryOptionsSupported(qo, &entities.Location{}) if err != nil { return nil, err } locations, count, err := a.db.GetLocationsByHistoricalLocation(hlID, qo) return p...
[ -0.3782295882701874, 0.29712557792663574, 0.7459831237792969, 0.45265311002731323, 0.8935262560844421, -0.3377061188220978, 1.1754403114318848, -0.1504228562116623, -0.04911196604371071, 0.10132398456335068, 0.19352172315120697, 0.19771789014339447, -0.5079227089881897, 0.36133089661598206...
func (a *APIv1) GetLocationsByThing(thingID interface{}, qo *odata.QueryOptions, path string) (*models.ArrayResponse, error) { _, err := a.QueryOptionsSupported(qo, &entities.Location{}) if err != nil { return nil, err } locations, count, err := a.db.GetLocationsByThing(thingID, qo) return processLocations(a, l...
[ -1.242434024810791, 0.014290040358901024, 0.8957816958427429, 0.009900321252644062, 0.7228716611862183, -0.24019311368465424, 0.28780245780944824, -0.8083202838897705, 0.03950025886297226, -0.3820607364177704, 0.06337399780750275, 0.031555116176605225, -0.36128559708595276, 0.2292090505361...
func (a *APIv1) PatchLocation(id interface{}, location *entities.Location) (*entities.Location, error) { if location.HistoricalLocations != nil || location.Things != nil { return nil, gostErrors.NewBadRequestError(errors.New("Unable to deep patch Location")) } if len(location.EncodingType) != 0 { supported, err...
[ -1.5425337553024292, -0.03730974718928337, 0.6187371015548706, -0.4108025133609772, -0.5426744222640991, 0.21517592668533325, 0.9920420050621033, 0.382711797952652, 0.5104774832725525, 0.22715559601783752, 0.11901223659515381, 0.07724151760339737, -0.3395361602306366, 0.5359852313995361, ...
func (a *APIv1) PutLocation(id interface{}, location *entities.Location) (*entities.Location, []error) { var err2 error putlocation, err2 := a.db.PutLocation(id, location) if err2 != nil { return nil, []error{err2} } putlocation.SetAllLinks(a.config.GetExternalServerURI()) return putlocation, nil }
[ -1.9683897495269775, 0.3193765878677368, 0.5959571003913879, -0.25371289253234863, -0.1248711347579956, 0.09320162236690521, 0.532143235206604, 0.8179794549942017, 0.3348372280597687, 0.19282080233097076, 0.026749437674880028, -0.3953808844089508, -1.4384952783584595, 0.4063310921192169, ...
func (a *APIv1) DeleteLocation(id interface{}) error { return a.db.DeleteLocation(id) }
[ -1.72610604763031, 0.0034420157317072153, 0.09597248584032059, 0.532332718372345, -0.2329978495836258, -0.3232686221599579, 0.8374675512313843, 0.29016202688217163, 1.0836830139160156, -0.3314366638660431, -0.4801691174507141, -1.0880061388015747, -0.33867403864860535, 0.8678112030029297, ...
func (a *APIv1) LinkLocation(thingID interface{}, locationID interface{}) error { err := a.db.LinkLocation(thingID, locationID) if err != nil { return gostErrors.NewBadRequestError(err) } return nil }
[ -1.5059878826141357, -0.4934643507003784, 0.2660145163536072, 0.30626627802848816, 0.9511694312095642, 0.3411906957626343, 0.0630885511636734, 0.22540046274662018, 0.6167927980422974, 0.016584722325205803, -0.05722297355532646, 0.5029362440109253, -0.33694109320640564, 0.5732596516609192, ...
func TestParseHeader(t *testing.T) { t.Parallel() parsed, err := parseHeader(bytes.NewReader(thb)) if err != nil { t.Error(err) } if parsed != th { t.Fatalf("Expected: %v, got: %v", th, parsed) } }
[ 1.1452020406723022, -0.4842814803123474, 0.5053762197494507, 0.25032010674476624, 1.1389861106872559, 0.7161988019943237, -0.09736035764217377, -0.2619769871234894, 0.04585966840386391, -0.4406518340110779, -0.9097051620483398, -0.4345468282699585, -0.9781660437583923, -0.4941595792770386,...
func TestWriteTagHeader(t *testing.T) { t.Parallel() buf := new(bytes.Buffer) bw := bufio.NewWriter(buf) dst := make([]byte, 4) if err := writeTagHeader(bw, dst, 15351, 4); err != nil { t.Fatal(err) } if err := bw.Flush(); err != nil { t.Fatal(err) } if !bytes.Equal(thb, buf.Bytes()) { t.Fatalf("Expect...
[ 0.4053719937801361, 0.2875862121582031, 0.595653772354126, 0.3353133797645569, 1.1664053201675415, 0.5281566381454468, 0.044800613075494766, -0.8779146075248718, -0.576775074005127, -0.06732858717441559, -1.014808177947998, -0.2551736831665039, -0.4655269682407379, 0.2613728940486908, -0...
func TestSmallTagHeader(t *testing.T) { t.Parallel() _, err := parseHeader(bytes.NewReader([]byte{0, 0, 0})) if err != ErrSmallHeaderSize { t.Fatalf("Expected err contains %q, got %q", "less than expected", err) } }
[ 1.442226767539978, -0.20322346687316895, 0.5721551775932312, -0.45268329977989197, 0.016713181510567665, 0.5372634530067444, -0.3476019501686096, -0.4509281516075134, 0.47392863035202026, -1.3272650241851807, -0.16320575773715973, -0.18974541127681732, -1.0040186643600464, 0.36063244938850...
func TestIsNotID3(t *testing.T) { t.Parallel() _, err := parseHeader(bytes.NewReader([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0})) if err != errNoTag { t.Fatalf("Expected: %q, got: %q", errNoTag, err) } }
[ 0.849975049495697, -0.5294284224510193, 0.5969375371932983, 0.4695225954055786, 0.7633145451545715, 0.504757821559906, -1.1492952108383179, -0.09712366759777069, 0.28051865100860596, -0.09431551396846771, -0.8536868095397949, -0.45423537492752075, -1.0007785558700562, 0.367972195148468, ...
func runWithEnvConfig(ctx context.Context) error { config := configFromEnv() //config.UserAgent = "k8s-deploy/" + Version + "/" + GitCommit return runWithConfig(ctx, config) }
[ 0.47000062465667725, -0.5486823916435242, 0.4169234037399292, -0.08925250917673111, -0.19649292528629303, 0.7083858847618103, -0.9466939568519592, -0.29170507192611694, -0.2921900451183319, 2.057722568511963, -0.8684300780296326, 0.15229828655719757, 0.06548989564180374, 0.9099011421203613...
func cancelOnInterrupt(ctx context.Context, f context.CancelFunc) { c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { select { case <-ctx.Done(): case <-c: f() } }() }
[ 0.7055879831314087, -0.8355104327201843, 0.6103744506835938, 0.23400744795799255, -0.18953238427639008, -0.3056092858314514, 0.20754632353782654, 0.4808184504508972, -0.7182616591453552, 0.6355937123298645, -0.1134026050567627, -0.700377345085144, -0.4040256440639496, -1.0667188167572021, ...
func Via(e *EndPoint, branch string) *base.ViaHeader { return &base.ViaHeader{ &base.ViaHop{ ProtocolName: "SIP", ProtocolVersion: "2.0", Transport: e.Transport, Host: e.Host, Port: &e.Port, Params: base.NewParams().Add("branch", base.String{S: branch}), },...
[ -0.2537972331047058, -0.6807611584663391, 0.6905030608177185, 0.23563970625400543, -0.6342728137969971, 0.04728527367115021, -0.5127432942390442, -0.26292580366134644, -1.0083332061767578, -0.006531098857522011, 0.6030389070510864, -0.1436457335948944, 0.09934145212173462, -0.9732266664505...
func (o *AddEntriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewAddEntriesOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 400...
[ -0.23419606685638428, -0.9134395122528076, 0.6608998775482178, 0.22738446295261383, 0.15222227573394775, -0.915215790271759, -0.0116192065179348, -0.5746576189994812, 0.5614650249481201, 0.3549095392227173, 0.1964784562587738, -0.35519030690193176, -0.7087056040763855, 0.27952274680137634,...
func NewAddEntriesOK() *AddEntriesOK { return &AddEntriesOK{} }
[ 0.12481266260147095, -0.5152484178543091, -0.11534194648265839, 0.3470225930213928, -1.0444109439849854, 0.5062246322631836, -0.0035656567197293043, -0.4809458255767822, -0.6250014901161194, 0.5539814829826355, -0.36782950162887573, -0.8395609855651855, 0.2555430829524994, 0.55389893054962...
func NewAddEntriesBadRequest() *AddEntriesBadRequest { return &AddEntriesBadRequest{} }
[ -0.8464911580085754, -0.07688387483358383, -0.005789035931229591, 0.30139562487602234, -0.6270285844802856, -0.07689397037029266, -1.5687034130096436, -0.3131464719772339, -0.41428545117378235, -0.295608252286911, 0.329227477312088, 0.07131703943014145, -0.38277125358581543, 0.819372475147...
func NewAddEntriesUnauthorized() *AddEntriesUnauthorized { return &AddEntriesUnauthorized{} }
[ -0.7026414275169373, -0.2027389109134674, 0.0262113306671381, 0.19072718918323517, -1.1578642129898071, -0.15376773476600647, -0.783378541469574, 0.14565840363502502, -0.03546828404068947, -0.3447618782520294, -0.2148188352584839, 0.8571248650550842, -0.5232238173484802, 0.0817087665200233...
func NewAddEntriesForbidden() *AddEntriesForbidden { return &AddEntriesForbidden{} }
[ 0.22581832110881805, 0.07209759205579758, -0.2610420882701874, 0.42438018321990967, -0.7178477048873901, 0.17433692514896393, -0.3439565896987915, -1.0450645685195923, -0.35208067297935486, -0.306384414434433, -0.2699683606624603, 0.5975552797317505, -0.48197561502456665, -0.05564522370696...
func NewAddEntriesNotFound() *AddEntriesNotFound { return &AddEntriesNotFound{} }
[ 0.047031253576278687, -1.0561177730560303, -0.15361620485782623, -0.07673626393079758, -0.5597512722015381, 0.7825927734375, -0.3990651071071625, -0.7850536704063416, 0.20605933666229248, 0.18894122540950775, -0.4147016108036041, 0.26675906777381897, -0.5447134971618652, 0.5081884264945984...
func NewAddEntriesTooManyRequests() *AddEntriesTooManyRequests { return &AddEntriesTooManyRequests{} }
[ -1.0475527048110962, 0.15726327896118164, 0.06553558260202408, 0.20738652348518372, -0.18118816614151, -0.44362735748291016, -0.8566649556159973, -0.5892751216888428, 0.402988463640213, -0.0770893469452858, 0.333263099193573, -0.6458060145378113, -0.10368864238262177, 0.5412362217903137, ...
func (b *UseBus) PluginLoaded(plugin Plugin) { if bus, ok := plugin.(BusService); ok { b.buses = append(b.buses, bus) sort.Sort(ByPriority(b.buses)) } }
[ -0.3868015706539154, -0.8021932244300842, 0.5595446228981018, 0.4458186626434326, 0.29335007071495056, -0.2815099358558655, 0.3029601275920868, 0.2575170695781708, 1.0519508123397827, -0.12428606301546097, -1.2331792116165161, 0.03768919035792351, -1.1033923625946045, 0.0038201571442186832...
func (b *UseBus) BroadcastMessage(message interface{}) { for _, bus := range b.buses { bus.HandleBroadcast(message) } }
[ -0.5908603072166443, 0.515097975730896, 0.4834892153739929, 1.7385470867156982, 1.151837706565857, 0.10470984131097794, 1.1333578824996948, 0.5893155336380005, 0.25070297718048096, 0.03920399025082588, 0.4159940183162689, -0.3083661198616028, -1.4366724491119385, 1.3826911449432373, -0.3...
func (b *UseBus) SendMessage(uuid uuid.UUID, message interface{}) <-chan interface{} { for _, bus := range b.buses { resChannel, err := bus.HandleMessage(uuid, message) if err != nil { return nil } return resChannel } log.Printf("Cannot send message") return nil }
[ -1.0915127992630005, 0.21935385465621948, 0.5305072665214539, 0.979328453540802, 0.6522233486175537, 0.030902421101927757, 0.5392975211143494, 0.24188657104969025, -0.4161643087863922, 0.16759829223155975, 0.9474794864654541, -0.37779688835144043, -1.883920669555664, 0.5547459125518799, ...
func (df *DeploymentFragmentsObserver) ObserveOrganizationLevel( timeout time.Duration, status entities.DeploymentFragmentStatus, targetOrganizationId string, f func(*entities.DeploymentFragment) derrors.Error, callback func(string)) { log.Debug().Interface("observableItems", df.Ids).Msgf("started deployments fra...
[ -0.24681124091148376, -0.035996053367853165, 0.7829796075820923, -0.5342875719070435, 0.024976668879389763, -0.5408725142478943, 0.39512890577316284, -0.30867254734039307, -0.43042582273483276, 1.0783910751342773, 0.30270206928253174, 0.465055912733078, 0.28444260358810425, 0.5470212697982...
func (df *DeploymentFragmentsObserver) Observe( timeout time.Duration, status entities.DeploymentFragmentStatus, f func(*entities.DeploymentFragment) derrors.Error, callback func()) { log.Debug().Interface("observableItems", df.Ids).Msgf("started deployments fragment observer with %d "+ "pending observations", d...
[ -0.15704748034477234, -0.1818753182888031, 0.8348938822746277, -0.8722919821739197, -0.05844877287745476, -0.5581859946250916, -0.007887385785579681, -0.049910642206668854, -0.4259937107563019, 0.9396699070930481, 0.16435763239860535, 0.11862697452306747, 0.10639113932847977, 0.51453465223...
func init() { prometheus.MustRegister(logicTotal) prometheus.MustRegister(logicLatency) }
[ 1.275403618812561, 1.424063801765442, 0.472781240940094, -0.43438276648521423, 1.3189730644226074, 1.0317708253860474, -0.33174771070480347, 0.17243312299251556, -0.19842207431793213, -0.2030865103006363, -0.3736654818058014, 0.7570739388465881, 0.12630456686019897, 0.7873979210853577, 0...
func NewNetService(addr string, port, metricPort int, st storage.Storage) *NetService { srv := &NetService{ addr: addr, port: port, metricPort: metricPort, store: st, } //service init if _, err := st.Get(defaultNetSvcPath); err != nil { //create node st.Add(defaultNetSvcPath, []byte("ne...
[ -0.31216099858283997, -0.05662738159298897, 0.36812445521354675, 0.26712796092033386, 0.22551454603672028, 0.1520007699728012, 0.25636303424835205, -1.1186946630477905, -0.46698716282844543, -0.317182719707489, -0.3277266323566437, 0.1559755951166153, -0.3355570435523987, 0.951816976070404...
func (srv *NetService) createSelfNode() error { hostname, _ := os.Hostname() node := &bcstypes.NetServiceInfo{ ServerInfo: bcstypes.ServerInfo{ IP: srv.addr, Port: uint(srv.port), MetricPort: uint(srv.metricPort), Pid: os.Getpid(), HostName: hostname, Scheme: "https", ...
[ -0.19194309413433075, 0.038024064153432846, 0.6901904940605164, -0.6189966201782227, 0.324545681476593, 0.2125302106142044, 0.45719414949417114, -0.44409260153770447, 0.031297169625759125, -0.10359137505292892, -1.3015426397323608, 0.3372768759727478, -0.36453238129615784, 1.04724800586700...
func createWorkers(idleWorkers *chan *chan int) { for i := 0; i < WORKERS_SIZE; i++ { ch := make(chan int) go worker(&ch, idleWorkers) *idleWorkers <- &ch } }
[ -0.9366660118103027, 0.42938336730003357, 0.387778639793396, -0.9471330642700195, 1.7074272632598877, 0.4268563687801361, -0.2146146446466446, -0.809097170829773, -0.12754181027412415, 0.007796836085617542, -1.1989117860794067, 0.10672668367624283, -1.3231068849563599, 0.5366894006729126, ...
func main() { //Concurrency party starts here with initialization. We could use the "init" //function but we won't be able to unit test it correctly //idleWorkers is an queue of goroutines workers idleWorkers := make(chan *chan int, WORKERS_SIZE) //A channel to communicate to the job dispatcher jobsCh := make(c...
[ 0.9267509579658508, -0.10864304006099701, 0.8458409905433655, -0.48100584745407104, 0.8992843627929688, 0.3218264579772949, 0.10103565454483032, 1.1158087253570557, 0.1146644800901413, -1.0689234733581543, -0.6821296215057373, 0.34470435976982117, -0.839218020439148, -0.47361329197883606, ...
func dispatcher(c *chan int, idleWorkers *chan *chan int) { for { value := <-*c //Check if we don't have idle works so we discard the message if(len(*idleWorkers) == 0) { dropCall(value) continue } worker := <-*idleWorkers *worker <- value } }
[ -0.4313586950302124, 0.2601335644721985, 0.48771944642066956, -0.7915128469467163, 0.6950459480285645, 0.7230095267295837, -0.1835785061120987, -0.4598027169704437, -0.03280619904398918, 0.1328825056552887, -0.8675588369369507, -0.4425279498100281, -0.7400373220443726, 1.5406062602996826, ...
func worker(c *chan int, idleWorkers *chan *chan int) { for { value := <-*c doActuallyCall(value) time.Sleep(time.Millisecond * TIMEOUT_TIME_MILLISECONDS) *idleWorkers <- c } }
[ -0.856569766998291, 0.3844497501850128, 0.5231180191040039, -0.27937051653862, -0.1390601098537445, 0.2754071056842804, -0.43087953329086304, -0.23679128289222717, -0.19256488978862762, 0.35103294253349304, -1.095384120941162, -0.2069152295589447, -0.2894326150417328, 0.4923827648162842, ...
func NewLog(path string) (*Log, error) { bs, err := raftboltdb.NewBoltStore(path) if err != nil { return nil, fmt.Errorf("new bolt store: %s", err) } return &Log{bs}, nil }
[ 0.5250239968299866, 0.8503173589706421, 0.4751480221748352, 0.10737445205450058, -0.9403102993965149, 0.1691134124994278, 0.5453430414199829, -0.33657339215278625, -0.3857302665710449, -0.044221386313438416, -0.7618340849876404, 0.39031046628952026, -0.6241220235824585, -0.6323705911636353...
func (l *Log) Indexes() (uint64, uint64, error) { fi, err := l.FirstIndex() if err != nil { return 0, 0, fmt.Errorf("failed to get first index: %s", err) } li, err := l.LastIndex() if err != nil { return 0, 0, fmt.Errorf("failed to get last index: %s", err) } return fi, li, nil }
[ -1.0034804344177246, -0.18413636088371277, 0.49314725399017334, -0.0999550074338913, 0.8514842987060547, -1.0775938034057617, 0.027662942185997963, 0.5292148590087891, -0.244125097990036, -0.39608851075172424, -0.3386373817920685, 0.3182327449321747, -0.19988197088241577, 0.548297762870788...
func (l *Log) LastCommandIndex() (uint64, error) { fi, li, err := l.Indexes() if err != nil { return 0, fmt.Errorf("get indexes: %s", err) } // Check for empty log. if li == 0 { return 0, nil } var rl raft.Log for i := li; i >= fi; i-- { if err := l.GetLog(i, &rl); err != nil { return 0, fmt.Errorf("...
[ -0.7770548462867737, -0.016946449875831604, 1.090488314628601, -0.5369639992713928, 0.318320095539093, -0.4718244969844818, 0.8498889803886414, 0.24557559192180634, 0.17973515391349792, -0.6824687719345093, 0.3909896910190582, 0.2627032995223999, -1.3036775588989258, -0.2324182689189911, ...
func (o *Adjustablelivespeakerdetection) String() string { j, _ := json.Marshal(o) str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1)) return str }
[ 0.36953431367874146, -1.5626683235168457, 0.28448447585105896, -0.7017524242401123, -0.26912909746170044, 0.04103279113769531, 0.2008591592311859, -0.27305904030799866, 0.3089272081851959, 0.6739387512207031, -0.6235313415527344, 0.5969418287277222, -0.11293239891529083, -0.234101817011833...
func RenderStackTemplate(state *State) flaw.Flaw { fmt.Println(" rendering stack template...") // make new branch directory in artifacts branchName := filepath.Join( os.Getenv("DE_ARTIFACTS_PATH"), os.Getenv("DE_GIT_BRANCH"), ) err := os.MkdirAll(branchName, 0755) if err != nil { return flaw.From(err) } ...
[ 0.2586223781108856, 0.37233734130859375, 0.6756041646003723, -0.46190258860588074, 0.017072508111596107, -0.15597888827323914, 0.6882396936416626, -0.4575227200984955, -0.6758706569671631, 0.8826900124549866, -1.0417027473449707, 0.015079825185239315, -0.2154662162065506, -0.06471300125122...
func (api *TopicalAPI) TopicNew(w http.ResponseWriter, r *http.Request) { flashes, _ := api.session.GetFlashes(r, w) user, err := api.session.GetUser(r) if err != nil { api.session.SaveFlash("Log in to post a message", r, w) http.Redirect(w, r, "/topics", 302) return } payload := struct { User *models...
[ -0.1601731777191162, -0.10310152918100357, 0.425866961479187, 0.3976656496524811, -0.34169089794158936, 0.6931614279747009, 0.31113117933273315, -0.04482234641909599, -0.413569837808609, -0.13480010628700256, 0.5094613432884216, -0.07423778623342514, 0.9091217517852783, 0.1383088082075119,...
func (c *CloudConfig) LoadFromFile(filename string) *CloudConfig { yamlFile, _ := ioutil.ReadFile(filename) return c.LoadFromBytes(yamlFile) }
[ 0.5139603614807129, 0.35584205389022827, 0.37217697501182556, -0.3619413673877716, -1.0027742385864258, 0.33335432410240173, -0.31492337584495544, 0.3487336337566376, -1.3751763105392456, -0.15283121168613434, -1.0525617599487305, -0.45101016759872437, -0.32575106620788574, 0.5361216664314...
func (c *CloudConfig) LoadFromBytes(content []byte) *CloudConfig { err := yaml.Unmarshal(content, c) if err != nil { log.Fatalf("%s", err) } return c }
[ 0.6123978495597839, -0.07089131325483322, 0.15199409425258636, -1.2859299182891846, -0.7087772488594055, 0.39353111386299133, -0.6097927093505859, 0.36318403482437134, -0.02757018804550171, -0.09169613569974899, -0.9984021186828613, -0.5956639647483826, -0.4957564175128937, 0.5801853537559...
func NewServerConfig(configTmpl string, target *model.K3OSNode) (*[]byte, error) { tmpl := configTmpl if tmpl == "" { tmpl = ServerConfigTmpl } return generateConfig(tmpl, target) }
[ -0.2334732860326767, 0.2955387830734253, 0.4282531440258026, 0.08981935679912567, -0.9041159152984619, -0.7247047424316406, -0.7852944731712341, 1.1506524085998535, -0.25637030601501465, 1.1125537157058716, -1.6198865175247192, 0.5399740934371948, -0.331168532371521, 1.2943594455718994, ...
func NewAgentConfig(configTmpl string, target *model.K3OSNode) (*[]byte, error) { tmpl := configTmpl if tmpl == "" { tmpl = AgentConfigTmpl } return generateConfig(tmpl, target) }
[ -0.5137377381324768, -0.6526870131492615, 0.3566640615463257, -0.3677746653556824, -0.9585487246513367, -0.8927152752876282, -1.3046799898147583, 1.1132071018218994, 0.09335224330425262, 1.0200823545455933, -1.0180689096450806, 0.038323771208524704, 0.2664235830307007, 0.8679311871528625, ...
func (c *Client) UpdatePhoneNumber(ctx context.Context, params *UpdatePhoneNumberInput, optFns ...func(*Options)) (*UpdatePhoneNumberOutput, error) { if params == nil { params = &UpdatePhoneNumberInput{} } result, metadata, err := c.invokeOperation(ctx, "UpdatePhoneNumber", params, optFns, addOperationUpdatePhone...
[ -1.6716023683547974, -0.3013417422771454, 0.6248031854629517, 0.5310357213020325, -0.014931736513972282, -0.5550029277801514, 0.496806263923645, -0.6808143258094788, 1.2172471284866333, -0.13126365840435028, -0.6406970024108887, 1.0947059392929077, -0.459114670753479, -0.48042726516723633,...
func scramblePassword(scramble []byte, password []byte) []byte { if len(password) == 0 { return nil } // stage1Hash = SHA1(password) crypt := sha1.New() crypt.Write(password) stage1 := crypt.Sum(nil) // scrambleHash = SHA1(scramble + SHA1(stage1Hash)) // inner Hash crypt.Reset() crypt.Write(stage1) hash ...
[ 0.2604784667491913, 0.2736072540283203, 0.8505908846855164, 1.323976755142212, -0.5766974091529846, 0.05177942290902138, -0.4690949320793152, 0.8912540674209595, 0.6679588556289673, 0.413439005613327, -1.1791867017745972, 0.09132568538188934, -0.49783098697662354, -0.04924817755818367, -...
func Connect(cfg *Config) (*Connection, error) { d, err := gorm.Open(cfg.Driver, cfg.Args) if err != nil { return nil, err } c := &Connection{ C: d, log: logrus.WithField("context", "db"), } c.log.Info("connected to database") return c, nil }
[ -0.22835074365139008, 0.5399384498596191, 0.6217596530914307, 0.44572773575782776, 0.04187468811869621, 0.2859027683734894, 0.06984658539295197, 0.11467672884464264, -1.0404365062713623, 0.6188807487487793, 0.4530242681503296, -0.21074435114860535, -0.6847051978111267, 0.7172719836235046, ...
func (c *Connection) Migrate() error { c.log.Info("performing migrations...") return c.C.AutoMigrate( &User{}, &Account{}, &Schedule{}, &Suggestion{}, &QueueItem{}, &Tweet{}, &Vote{}, ).Error }
[ -1.3275216817855835, -0.06706928461790085, 0.3850138783454895, 1.540630578994751, 1.0487914085388184, -0.5788053274154663, -0.5472668409347534, -0.48954111337661743, -0.539188802242279, -0.23162853717803955, -0.356017529964447, -0.19225230813026428, -0.8149639368057251, 0.3543729782104492,...
func (c *Connection) Transaction(fn func(*Connection) error) error { d := c.C.Begin() if err := fn(&Connection{C: d, log: c.log}); err != nil { d.Rollback() return err } d.Commit() return nil }
[ 0.14989514648914337, 0.4658864438533783, 0.689588725566864, -0.022416217252612114, 0.9598888754844666, -0.2576751410961151, 0.614669919013977, 0.47204694151878357, -0.022129742428660393, 0.8253142237663269, -0.12588676810264587, -0.4672832190990448, 0.06171996518969536, -0.9665879607200623...
func (c *Connection) Close() { c.C.Close() }
[ 0.5178768634796143, -0.23942206799983978, 0.138827845454216, 0.19737789034843445, 0.3275330364704132, 0.3207395672798157, 0.19644440710544586, -0.3241736590862274, -1.3606868982315063, -1.0235430002212524, 0.810753345489502, -0.1259174793958664, -0.8695858716964722, 1.0565561056137085, 0...
func New(size int) *GCache { return NewWithType(size, gcache.TYPE_LRU) }
[ 0.5458586812019348, 0.076148122549057, 0.35755661129951477, -0.27065664529800415, -1.1707926988601685, -0.22124402225017548, -0.45356154441833496, -0.6974740028381348, -0.09481754899024963, -0.08925297111272812, -0.6491011381149292, 0.5526527762413025, -0.05248535796999931, 0.1531554609537...
func NewWithType(size int, tp string) *GCache { return &GCache{ db: gcache.New(size).EvictType(tp).Build(), } }
[ 0.4228289723396301, 0.5613377094268799, 0.29512301087379456, -0.05869169905781746, -0.7955715656280518, -0.2083761990070343, -0.5937193036079407, -0.7292371392250061, -0.11537129431962967, 1.3678364753723145, -0.6682195663452148, 0.11230719089508057, -0.6532846093177795, 0.3947989940643310...
func (g *GCache) Get(key string) any { val, _ := g.db.Get(key) return val }
[ -0.8081150054931641, 0.7262967824935913, 0.21996448934078217, 0.008814506232738495, -0.076153963804245, -0.3862799108028412, -1.3551108837127686, -0.7275197505950928, -1.1923470497131348, 0.29533258080482483, 0.020588159561157227, 0.19833584129810333, -0.7220257520675659, 0.412031710147857...
func (g *GCache) Set(key string, val any, ttl time.Duration) (err error) { return g.db.SetWithExpire(key, val, ttl) }
[ -0.7333646416664124, 0.6306923031806946, 0.2527121901512146, 0.17921830713748932, -0.6943521499633789, 0.5718746185302734, -1.6985139846801758, -0.64300137758255, -0.6906902194023132, 1.6653116941452026, -0.28194189071655273, -0.5044004917144775, -0.1288788765668869, 0.632463812828064, -...
func (g *GCache) Del(key string) error { g.db.Remove(key) return nil }
[ 0.33949750661849976, 0.8952531814575195, 0.17631548643112183, 0.1275317370891571, -0.9125075936317444, 1.243463397026062, -0.6901420950889587, 0.290189266204834, -0.40745213627815247, 0.8537353873252869, -0.5367120504379272, 0.05323297530412674, -0.6821334958076477, 0.3537944555282593, 0...
func (g *GCache) GetMulti(keys []string) map[string]any { data := make(map[string]any, len(keys)) for _, key := range keys { val, err := g.db.Get(key) if err == nil { data[key] = val } // TODO log error } return data }
[ -1.0700474977493286, 0.5139206647872925, 0.5481119751930237, 0.4377964437007904, -0.24552732706069946, -0.25469058752059937, -1.4804725646972656, -0.425631582736969, -1.1653474569320679, 0.5028716921806335, -0.9025054574012756, -0.3859521746635437, -0.07657169550657272, 0.5760865807533264,...
func (g *GCache) SetMulti(values map[string]any, ttl time.Duration) (err error) { for key, val := range values { err = g.db.SetWithExpire(key, val, ttl) } return }
[ -1.064781665802002, 0.3761964440345764, 0.5520243644714355, 0.7682352066040039, -0.38280946016311646, 0.4470646381378174, -1.39471435546875, -0.4023992717266083, -0.6432782411575317, 0.8219866752624512, -1.153031349182129, -1.184174656867981, 0.2971339225769043, 1.29691743850708, -0.7980...
func (g *GCache) DelMulti(keys []string) error { for _, key := range keys { g.db.Remove(key) } return nil }
[ -0.6707258224487305, 0.8812909722328186, 0.23424983024597168, 0.183892160654068, -0.45452138781547546, 0.7838494777679443, -1.2359974384307861, 0.43284469842910767, -0.6152607202529907, 0.9318363070487976, -0.641262412071228, -0.5336493253707886, -0.8365049958229065, 1.0962227582931519, ...
func (g *GCache) Db() gcache.Cache { return g.db }
[ -0.09651587158441544, 0.5607050061225891, 0.24204491078853607, 0.76498943567276, -0.4827667772769928, 0.663669228553772, -0.029528267681598663, -0.29778918623924255, 0.4265400469303131, 0.19415874779224396, 0.4092056453227997, 0.20174798369407654, -0.4764261841773987, 0.1685021072626114, ...
func New() *Node { return &Node{} }
[ -0.42914706468582153, -0.6617968678474426, -0.2586643695831299, -0.6321176886558533, -0.6928743720054626, -0.39084550738334656, -0.2527693808078766, 0.06423530727624893, -0.7588393688201904, -0.46360453963279724, -0.29424768686294556, 1.118584394454956, 0.5212582349777222, 0.12246669083833...
func (n *Node) Length() (l int) { if n == nil { return } cn := n for { if cn.next == nil { break } l++ cn = cn.next } return }
[ -0.02052568830549717, 0.8661153316497803, 0.12513355910778046, -0.2711572051048279, 0.553321361541748, -0.36007267236709595, 0.8416816592216492, 0.6653111577033997, 1.226548433303833, 0.24642489850521088, -0.6005423665046692, -0.16968630254268646, -0.003021515440195799, 1.2492841482162476,...
func (n *Node) Push(d interface{}) { nn := &Node{data: d, next: n.next} n.next = nn }
[ -1.0536366701126099, 1.690323829650879, 0.030684957280755043, -0.48264846205711365, -0.601882815361023, 0.11541718989610672, -0.08941669762134552, -0.3349514901638031, 0.5087985396385193, -0.27406883239746094, -0.5689869523048401, 1.3115652799606323, 0.22036147117614746, 0.852077305316925,...
func (n *Node) Add(d interface{}) { cn := n for { if cn.next == nil { cn.next = &Node{ data: d, } break } cn = cn.next } }
[ -1.3489043712615967, 1.0657140016555786, 0.20842576026916504, -0.845731258392334, 0.2302243560552597, 0.5841864943504333, -0.3566053807735443, -0.07052607089281082, 1.0432088375091553, -0.4276902973651886, 0.083836629986763, 0.875095784664154, 0.169826477766037, 1.4237735271453857, 0.084...
func (n *Node) String() string { buf := bytes.NewBuffer(nil) cn := n for { if cn.next == nil { break } if buf.Len() != 0 { fmt.Fprint(buf, ",") } else { fmt.Fprint(buf, "[") } fmt.Fprintf(buf, "%v", cn.next.data) cn = cn.next } fmt.Fprint(buf, "]") return buf.String() }
[ 0.22171509265899658, -0.3219296336174011, 0.2723020911216736, -1.5212688446044922, 0.1392000913619995, 0.1675371676683426, 0.0307737048715353, -1.3041791915893555, -0.2850896716117859, 0.22119568288326263, 0.13980726897716522, 1.3022838830947876, -0.09094758331775665, 0.34475886821746826, ...