text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func DisablePreloading() OptionsModifier {
return func(o *options) {
o.preload = false
}
} | [
-1.1290082931518555,
0.4134899079799652,
0.4188087582588196,
-0.21138706803321838,
-0.4015749990940094,
0.9729555249214172,
0.9203649759292603,
0.7243145108222961,
0.5884347558021545,
-0.3382079005241394,
-1.1358835697174072,
-1.5537588596343994,
-0.13855010271072388,
-0.20595316588878632,... |
func NewLogger(tag string, systemLog bool, stdout bool) (logger *Logger, err error) {
// Set up system logging, if enabled
syslogger := &syslog.Writer{}
if systemLog {
syslogger, err = syslog.New(syslog.LOG_LOCAL0, tag)
if err != nil {
return &Logger{}, fmt.Errorf("ec2macossystemmonitor: unable to create new ... | [
0.9464315176010132,
-0.32139018177986145,
0.41364148259162903,
0.23707625269889832,
-0.9064748287200928,
-0.6788576245307922,
-0.49951860308647156,
0.6770836114883423,
-0.2604368031024933,
-0.12795980274677277,
-0.1135789081454277,
-0.31994083523750305,
-0.30193859338760376,
1.680133104324... |
func (l *Logger) Info(v ...interface{}) {
if l.LogToStdout {
log.Print(v...)
}
if l.LogToSystemLog {
l.SystemLog.Info(fmt.Sprint(v...))
}
} | [
0.24931560456752777,
-0.1111026257276535,
0.4179442822933197,
0.39826318621635437,
-0.03716664016246796,
0.15388406813144684,
-0.15556833148002625,
-0.3258194327354431,
-1.0416557788848877,
0.15946950018405914,
0.41941770911216736,
0.26447317004203796,
0.686225414276123,
1.8807190656661987... |
func (l *Logger) Infof(format string, v ...interface{}) {
if l.LogToStdout {
log.Printf(format, v...)
}
if l.LogToSystemLog {
l.SystemLog.Info(fmt.Sprintf(format, v...))
}
} | [
0.578361988067627,
-0.357107937335968,
0.5757795572280884,
0.14129391312599182,
0.36577877402305603,
0.1993485689163208,
-0.09340386092662811,
0.3862749934196472,
-0.811303436756134,
-0.45043182373046875,
0.6449668407440186,
0.7377154231071472,
0.6775769591331482,
1.4853136539459229,
-0.... |
func (l *Logger) Warn(v ...interface{}) {
if l.LogToStdout {
log.Print(v...)
}
if l.LogToSystemLog {
l.SystemLog.Warning(fmt.Sprint(v...))
}
} | [
0.33620691299438477,
0.22965362668037415,
0.5161253213882446,
0.36782699823379517,
-0.33927613496780396,
-0.027002854272723198,
-0.6451175212860107,
-0.26076364517211914,
-0.5173397660255432,
-0.46124133467674255,
0.504021942615509,
0.7957634925842285,
0.7239386439323425,
1.350640773773193... |
func (l *Logger) Warnf(format string, v ...interface{}) {
if l.LogToStdout {
log.Printf(format, v...)
}
if l.LogToSystemLog {
l.SystemLog.Warning(fmt.Sprintf(format, v...))
}
} | [
0.6537409424781799,
0.016075845807790756,
0.46693092584609985,
0.2806522846221924,
-0.12634485960006714,
-0.06517095863819122,
-0.25159958004951477,
0.21947549283504486,
-0.9391733407974243,
-0.2576872408390045,
0.7492839097976685,
0.8414134383201599,
0.6809269189834595,
1.3065869808197021... |
func (l *Logger) Fatal(v ...interface{}) {
l.Error(v...)
os.Exit(1)
} | [
-0.0275536198168993,
-0.8031355142593384,
0.4637680649757385,
0.9763275384902954,
0.1041157990694046,
1.0051958560943604,
-0.590477705001831,
-0.2008831799030304,
-0.48989537358283997,
0.2009621560573578,
0.19805820286273956,
0.4010303020477295,
0.4186527132987976,
0.8992323279380798,
0.... |
func (l *Logger) Fatalf(format string, v ...interface{}) {
l.Errorf(format, v...)
os.Exit(1)
} | [
0.5532812476158142,
-0.9286580681800842,
0.5435758829116821,
0.7559796571731567,
0.07936681807041168,
0.5204150676727295,
-0.3035678565502167,
0.35620930790901184,
-0.021971018984913826,
0.011970761232078075,
0.16948340833187103,
0.4711965322494507,
0.5522986054420471,
0.8708415627479553,
... |
func (t *IntervalLogger) PushToInterval(i int, message string) (flushed bool) {
t.Counter = +i
t.Message = message
if t.Counter > t.LogInterval {
t.logger.Info(message)
t.Counter = 0
return true
}
return false
} | [
-0.7973565459251404,
0.655116081237793,
0.5368291735649109,
-0.8005809187889099,
-0.7653250694274902,
0.8473318815231323,
-0.07804878056049347,
-1.012632966041565,
-0.7392481565475464,
0.7027854919433594,
-0.5744780898094177,
-0.14678490161895752,
-1.3123077154159546,
-0.43614959716796875,... |
func (c *RCache) Increment(key string) (err error) {
conn := c.p.Get()
_, err = conn.Do("INCRBY", key, 1)
conn.Close()
return err
} | [
-1.4621264934539795,
0.5326472520828247,
0.4272630512714386,
0.3034580647945404,
-0.41732433438301086,
0.3756653666496277,
-0.21644197404384613,
-0.040068790316581726,
-0.07493659853935242,
0.33919158577919006,
-0.26185280084609985,
-0.23888620734214783,
-1.496417760848999,
-0.126788854598... |
func (c *RCache) Decrement(key string) (err error) {
conn := c.p.Get()
_, err = conn.Do("INCRBY", key, -1)
conn.Close()
return err
} | [
-0.7910192012786865,
0.6147539019584656,
0.7219496965408325,
0.19871173799037933,
-0.03921794891357422,
0.15998919308185577,
0.006014006678014994,
0.16933290660381317,
-0.09039870649576187,
0.11801421642303467,
-0.2187049388885498,
-0.5048001408576965,
-1.8345533609390259,
-0.0180702116340... |
func (c *RCache) ClearAll() (err error) {
conn := c.p.Get()
_, err = conn.Do("FLUSHDB")
conn.Close()
return err
} | [
0.15901648998260498,
0.027068426832556725,
0.6184525489807129,
1.1211111545562744,
-0.021693995222449303,
1.082443118095398,
-0.8139734864234924,
0.034747928380966187,
-0.4177197813987732,
0.7249166965484619,
0.3484223783016205,
0.7657103538513184,
-0.7753466367721558,
0.5338805317878723,
... |
func (c *RCache) GetJson(key string, val interface{}) error {
v, err := redis.String(c.Get(key))
if err != nil {
return err
}
return json.Unmarshal([]byte(v), val)
} | [
-0.6597777605056763,
0.43418657779693604,
0.6204507350921631,
-0.36727404594421387,
-0.927337646484375,
-0.5662086009979248,
-0.7101263403892517,
-0.31242698431015015,
0.26567578315734863,
1.098159909248352,
-0.1727776974439621,
1.230061650276184,
-0.5031831860542297,
-0.49141159653663635,... |
func (c *RCache) PutJson(key string, val interface{}, timeout time.Duration) error {
buf, err := json.Marshal(val)
if err != nil {
return err
}
return c.Put(key, string(buf), timeout)
} | [
-0.7435056567192078,
0.6811198592185974,
0.5455743670463562,
-0.4173993170261383,
-0.9635847806930542,
-0.10012655705213547,
-0.3612886071205139,
-0.024438703432679176,
0.1029898151755333,
1.9174928665161133,
-0.6302732825279236,
0.9636692404747009,
-0.915877640247345,
-0.04631165415048599... |
func ParseAddressSpec(addrSpec string) (string, string, error) {
rs := regexp.MustCompile(`^([^@]+)@([^@]+)$`).FindStringSubmatch(addrSpec)
if len(rs) < 1 {
return "", "", errors.New("RFC 5322 Address Spec not found.")
}
return rs[1], rs[2], nil
} | [
0.17915984988212585,
-0.7908598184585571,
0.46796512603759766,
-1.0816532373428345,
-0.6999304890632629,
-0.42810991406440735,
0.01768183521926403,
-0.20141075551509857,
0.011975347064435482,
1.4105751514434814,
-0.7274845838546753,
0.34684720635414124,
0.62310791015625,
0.0558593720197677... |
func NewVariableBackend(b *APIBackend) *VariableBackend {
return &VariableBackend{
HTTPErrorHandler: b.HTTPErrorHandler,
Logger: b.Logger.With(zap.String("handler", "variable")),
VariableService: b.VariableService,
LabelService: b.LabelService,
}
} | [
0.3251408636569977,
-1.2367055416107178,
0.2753715515136719,
0.2393922656774521,
-0.6367849111557007,
-0.3721969723701477,
-1.0606482028961182,
-0.32763779163360596,
0.16174399852752686,
0.6079051494598389,
-0.9875162839889526,
0.4172055721282959,
-0.8776818513870239,
0.3441993296146393,
... |
func NewVariableHandler(b *VariableBackend) *VariableHandler {
h := &VariableHandler{
Router: NewRouter(b.HTTPErrorHandler),
HTTPErrorHandler: b.HTTPErrorHandler,
Logger: b.Logger,
VariableService: b.VariableService,
LabelService: b.LabelService,
}
entityPath := fmt.Sprintf("%s/:id... | [
0.15600048005580902,
-0.7556344866752625,
0.7086448669433594,
-0.5238660573959351,
-0.05409615486860275,
0.032684486359357834,
-0.16294816136360168,
0.04222235828638077,
-0.31397923827171326,
-0.16059638559818268,
-0.13562583923339844,
-0.07383285462856293,
-0.21808376908302307,
0.06211568... |
func (s *VariableService) FindVariableByID(ctx context.Context, id platform.ID) (*platform.Variable, error) {
path := variableIDPath(id)
url, err := NewURL(s.Addr, path)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", url.String(), nil)
if err != nil {
return nil, err
}
SetToken(s.Tok... | [
0.03107222355902195,
-0.36366358399391174,
0.21858173608779907,
-0.3557536005973816,
-0.18999116122722626,
-0.5513893961906433,
-0.27368655800819397,
-1.4875539541244507,
-0.2916041910648346,
0.8363705277442932,
-0.7459809184074402,
0.5892828106880188,
-1.5576802492141724,
0.56243532896041... |
func (s *VariableService) FindVariables(ctx context.Context, filter platform.VariableFilter, opts ...platform.FindOptions) ([]*platform.Variable, error) {
url, err := NewURL(s.Addr, variablePath)
if err != nil {
return nil, err
}
query := url.Query()
if filter.OrganizationID != nil {
query.Add("orgID", filter... | [
-0.6865631341934204,
0.1294485330581665,
0.5696099400520325,
-0.012980562634766102,
-0.15858837962150574,
-0.18410250544548035,
-0.4434601962566376,
-0.9763537049293518,
-0.5688980221748352,
0.8591518402099609,
-0.42287397384643555,
0.8255977630615234,
-1.2565668821334839,
0.26022151112556... |
func (s *VariableService) CreateVariable(ctx context.Context, m *platform.Variable) error {
if err := m.Valid(); err != nil {
return &platform.Error{
Code: platform.EInvalid,
Err: err,
}
}
url, err := NewURL(s.Addr, variablePath)
if err != nil {
return err
}
octets, err := json.Marshal(m)
if err !... | [
-0.534237802028656,
-0.06147148832678795,
0.7547171711921692,
-0.15022052824497223,
-0.34358853101730347,
-0.3592037260532379,
-0.5814406871795654,
-0.8901222944259644,
-0.3014103174209595,
0.7616157531738281,
-0.5887188911437988,
0.23855282366275787,
-1.4474893808364868,
-0.15833778679370... |
func (s *VariableService) UpdateVariable(ctx context.Context, id platform.ID, update *platform.VariableUpdate) (*platform.Variable, error) {
u, err := NewURL(s.Addr, variableIDPath(id))
if err != nil {
return nil, err
}
octets, err := json.Marshal(update)
if err != nil {
return nil, err
}
req, err := http.... | [
-0.9375211000442505,
-0.7406535744667053,
0.5495175719261169,
-0.48096397519111633,
-0.788411021232605,
-0.40916526317596436,
-0.588480532169342,
-0.31797024607658386,
-0.31144949793815613,
0.5572367906570435,
-0.5937424898147583,
0.5349083542823792,
-1.6709551811218262,
-0.607046723365783... |
func (s *VariableService) ReplaceVariable(ctx context.Context, variable *platform.Variable) error {
u, err := NewURL(s.Addr, variableIDPath(variable.ID))
if err != nil {
return err
}
octets, err := json.Marshal(variable)
if err != nil {
return err
}
req, err := http.NewRequest("PUT", u.String(), bytes.NewR... | [
-1.0760562419891357,
-0.26731395721435547,
0.47475069761276245,
-1.2352237701416016,
0.013199612498283386,
-0.5603818297386169,
-0.3844474256038666,
-0.09794848412275314,
-0.36723220348358154,
0.4862072169780731,
-1.4267574548721313,
0.949536919593811,
-1.4960945844650269,
-0.1171491816639... |
func (s *VariableService) DeleteVariable(ctx context.Context, id platform.ID) error {
u, err := NewURL(s.Addr, variableIDPath(id))
if err != nil {
return err
}
req, err := http.NewRequest("DELETE", u.String(), nil)
if err != nil {
return err
}
SetToken(s.Token, req)
hc := NewClient(u.Scheme, s.InsecureSki... | [
-0.7637989521026611,
-0.014707459136843681,
0.3929022550582886,
-0.4031658172607422,
0.13422784209251404,
-0.2441529929637909,
-0.016914604231715202,
-0.9454782009124756,
-0.15492594242095947,
0.09664557874202728,
-0.696952223777771,
1.027118444442749,
-1.173240303993225,
0.243742734193801... |
func (s *Server) HandleMisses(vpcID uint32, miss <-chan transport.ForwardingMiss) {
ticker := time.Tick(10 * time.Second)
for {
select {
case <-ticker:
go s.handleEPPoll(uint32(vpcID))
break
case miss, ok := <-miss:
if !ok {
return
}
go s.handleMacLookup(uint32(vpcID), miss.HwAddr)
break
... | [
-0.23644469678401947,
0.2111203372478485,
0.41894984245300293,
-0.9522290229797363,
0.7871115803718567,
0.641716480255127,
-0.37996646761894226,
-0.8315726518630981,
0.2936231791973114,
-0.5123733282089233,
0.07845496386289597,
-0.5825048089027405,
-0.6219221949577332,
0.6603926420211792,
... |
func (s *Server) handleEPPoll(vpcID uint32) {
endpoints, err := s.sdn.BroadcastEndpoints(vpcID)
if err != nil {
log.Printf("VTEP linking failed: %s", err)
}
for _, endpoint := range endpoints {
hwaddr, _ := net.ParseMAC("00:00:00:00:00:00")
s.transport.AddForwardEntry(vpcID, hwaddr, endpoint)
}
} | [
-0.46762216091156006,
0.33858755230903625,
0.44674885272979736,
-0.9068412184715271,
1.3384523391723633,
0.8337159156799316,
-0.29440993070602417,
0.5834457278251648,
0.8743808269500732,
0.3623816668987274,
-0.3023483157157898,
-0.5836688280105591,
-0.24119621515274048,
0.22914528846740723... |
func (s *Server) handleMacLookup(vpcID uint32, mac net.HardwareAddr) {
gw, err := s.sdn.LookupMac(vpcID, mac)
if err != nil || gw == nil {
log.Printf("Failed to find VTEP for %s", mac)
return
}
s.transport.AddForwardEntry(vpcID, mac, gw)
} | [
0.3654846251010895,
0.593052864074707,
0.5245817303657532,
-0.5932772159576416,
0.09387180209159851,
0.530541718006134,
-0.5633386373519897,
0.2809959352016449,
0.1425609290599823,
0.3199719786643982,
0.7754021286964417,
-0.5053393244743347,
0.1376643031835556,
0.15743951499462128,
0.451... |
func (_m *HadolintPiperFileUtils) FileExists(filename string) (bool, error) {
ret := _m.Called(filename)
var r0 bool
if rf, ok := ret.Get(0).(func(string) bool); ok {
r0 = rf(filename)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(filename)
} e... | [
-1.2418767213821411,
-1.097462773323059,
0.5538231730461121,
-0.03913372382521629,
0.7937090396881104,
0.44270649552345276,
0.5596919059753418,
1.0367692708969116,
-0.8951529264450073,
0.4641970992088318,
0.1592339426279068,
0.012535092420876026,
-0.01478559523820877,
0.40467631816864014,
... |
func (_m *HadolintPiperFileUtils) FileWrite(filename string, data []byte, perm os.FileMode) error {
ret := _m.Called(filename, data, perm)
var r0 error
if rf, ok := ret.Get(0).(func(string, []byte, os.FileMode) error); ok {
r0 = rf(filename, data, perm)
} else {
r0 = ret.Error(0)
}
return r0
} | [
-0.024624867364764214,
-0.5725002884864807,
0.2549423575401306,
0.5300302505493164,
0.07419191300868988,
0.2833484709262848,
0.5207590460777283,
1.1505085229873657,
-0.9024942517280579,
-0.1333657056093216,
-0.04014957323670387,
0.146210715174675,
-0.666681170463562,
0.21343354880809784,
... |
func NewTexter(reallySend bool) (*Texter, error) {
var s, t, n string
var err error
if s, err = mustHaveEnv("TWILIO_ACCOUNT_SID"); err != nil {
return nil, err
}
if t, err = mustHaveEnv("TWILIO_AUTH_TOKEN"); err != nil {
return nil, err
}
if n, err = mustHaveEnv("TWILIO_SENDING_NUMBER"); err != nil {
retur... | [
0.2684912383556366,
-0.09358903020620346,
0.40413016080856323,
-0.14692676067352295,
-1.169370174407959,
-0.04118941351771355,
-0.7449932098388672,
-0.006987994536757469,
0.341728150844574,
0.5608717799186707,
-0.27661895751953125,
-0.17314036190509796,
-0.8259636163711548,
1.1452056169509... |
func (t *Texter) SendText(destination, message string) error {
reader := t.buildPayload(destination, message)
req, err := t.buildRequest(reader)
if err != nil {
return err
}
if t.reallySend {
if err := t.sendRequest(req); err != nil {
return err
}
} else {
log.Printf("Would have sent %s the following... | [
-0.8599808812141418,
0.39238619804382324,
0.47032788395881653,
0.33693695068359375,
-0.5828043818473816,
0.2907731831073761,
-1.0833258628845215,
0.0778527483344078,
-0.24488599598407745,
0.4816550612449646,
0.49826323986053467,
-0.058280233293771744,
-0.6708651781082153,
0.257042020559310... |
func FakeGetStackIDFromLabelFilter(args filters.Args) (string, bool) {
labelfilters := args.Get("label")
// there should only be 1 string here, anything else is not supported
if len(labelfilters) != 1 {
return "", false
}
// we now have a filter that is in one of two forms:
// SomeKey or SomeKey=SomeValue
// ... | [
-0.734672486782074,
0.2808401584625244,
0.5625340342521667,
0.12355812638998032,
-0.47104305028915405,
-0.29457888007164,
-0.27869993448257446,
-0.4071207642555237,
-0.48327380418777466,
0.44400879740715027,
-0.267340749502182,
0.11570484191179276,
-0.7390626668930054,
0.6967912316322327,
... |
func (this *MessageSet) Len() int {
return len(this.buffer)
} | [
0.4692789912223816,
-0.21337799727916718,
0.20571134984493256,
-1.4595366716384888,
0.4135735034942627,
-0.40460965037345886,
1.0862607955932617,
-0.4454302191734314,
0.32536202669143677,
-1.1222312450408936,
-0.9738233685493469,
0.9009041786193848,
-0.6541721820831299,
0.2691950798034668,... |
func (this *MessageSet) Len64() int64 {
return int64(this.Len())
} | [
0.026429885998368263,
0.020280465483665466,
0.3283327519893646,
-0.45428967475891113,
0.642136812210083,
-0.483031690120697,
-0.04092162847518921,
-0.3342602252960205,
0.1428612321615219,
-0.8144740462303162,
-0.16348138451576233,
0.17329013347625732,
-0.543840229511261,
0.7584326863288879... |
func CreateDB() {
_, err := db.Conn.Exec(fmt.Sprintf("CREATE DATABASE %s", config.DBName))
if err != nil {
log.Fatal(err)
}
} | [
0.7448378801345825,
0.6832318305969238,
0.545541524887085,
1.2913838624954224,
1.2215622663497925,
1.2064076662063599,
0.20803196728229523,
0.13084499537944794,
-0.6220665574073792,
-0.5236801505088806,
0.8471708297729492,
0.0817423015832901,
-0.21294696629047394,
0.6865728497505188,
1.0... |
func buildStorageInitCmd() *cobra.Command {
vars := initStorageVars{}
cmd := &cobra.Command{
Use: "init",
Short: "Creates a new AWS CloudFormation template for a storage resource.",
Long: `Creates a new AWS CloudFormation template for a storage resource.
Storage resources are stored in the Copilot addons dire... | [
0.3540697991847992,
-0.7638917565345764,
0.8872368931770325,
-0.04743891954421997,
0.7479973435401917,
-0.30430418252944946,
0.5133858919143677,
-0.11516623944044113,
-0.30032798647880554,
-0.4120979607105255,
-0.6214054822921753,
0.4225841760635376,
0.03677704930305481,
0.3201874196529388... |
func Register() {
nsqs.RegisterDefault("eth_erc20_from_new_user", syncERC20FromNewUser)
nsqs.RegisterDefault("eth_sync_block_erc20", syncERC20FromBlock)
} | [
0.5179545879364014,
0.34804147481918335,
0.3735899031162262,
0.5673587918281555,
0.9135825037956238,
-0.4667205810546875,
-0.6790497303009033,
-1.1713924407958984,
-0.4471125304698944,
-0.55125492811203,
-1.4983073472976685,
0.2939774692058563,
0.399515300989151,
0.5710151195526123,
0.54... |
func DiceScore(input, target *ts.Tensor) float64 {
// Flatten
iflat := input.MustView([]int64{-1}, false)
tflat := target.MustView([]int64{-1}, false)
p := iflat.MustGt(ts.FloatScalar(0.5), true)
t := tflat.MustGt(ts.FloatScalar(0.5), true)
ptMul := p.MustMul(t, false)
overlap := ptMul.MustSum(gotch.Double, true... | [
-0.5011821985244751,
0.023681575432419777,
0.4446195363998413,
-0.31590110063552856,
-0.16377584636211395,
0.5049600005149841,
0.42947378754615784,
0.4802885353565216,
-0.4147668182849884,
0.9222885370254517,
0.6332133412361145,
0.39631420373916626,
-0.172918900847435,
-0.2859576344490051,... |
func Accuracy(input, target *ts.Tensor) (tp, tn float64) {
iflat := input.MustView([]int64{-1}, false)
tflat := target.MustView([]int64{-1}, false)
p := iflat.MustGt(ts.FloatScalar(0.5), true)
t := tflat.MustGt(ts.FloatScalar(0.5), true)
ptMul := p.MustMul(t, false)
overlap := ptMul.MustSum(gotch.Double, true).Fl... | [
0.1665782928466797,
-0.3964875340461731,
0.6829055547714233,
-0.3828797936439514,
0.05403592810034752,
0.6982486844062805,
1.3793325424194336,
0.5770376920700073,
-0.3421735167503357,
1.1512413024902344,
0.3726242780685425,
0.33817070722579956,
0.7343257665634155,
-0.02586916647851467,
0... |
func (r *Resolver) GetUser(ctx context.Context, args struct{ ID graphql.ID }) (*UserResolver, error) {
id, err := util.GqlIDToUint(args.ID)
if err != nil {
return nil, errors.Wrap(err, "GetBook")
}
user := &models.User{}
if err = user.GetUser(ctx, id); err != nil {
return nil, errors.Wrap(err, "GetUser")
}
s... | [
-0.8454461097717285,
0.02573544718325138,
0.4981296956539154,
0.6274192929267883,
0.6228042244911194,
-0.10283101350069046,
0.44165271520614624,
-0.622900128364563,
-0.3988996744155884,
-0.610975444316864,
0.06136709079146385,
-0.16143903136253357,
-0.30168968439102173,
-0.0511293150484561... |
func (r *Resolver) GetBook(ctx context.Context, args struct{ ID graphql.ID }) (*BookResolver, error) {
id, err := util.GqlIDToUint(args.ID)
if err != nil {
return nil, errors.Wrap(err, "GetBook")
}
book := &models.Book{}
if err = book.GetBook(ctx, id); err != nil {
return nil, err
}
s := BookResolver{
m: b... | [
-0.8051736354827881,
0.4020335078239441,
0.5440672039985657,
0.4084545373916626,
0.993641197681427,
0.2548486292362213,
-0.03664218634366989,
-0.5956270694732666,
-0.676990807056427,
-0.44641515612602234,
0.3021928668022156,
-0.14878521859645844,
-0.4793968200683594,
-0.028358664363622665,... |
func (r *Resolver) GetTag(ctx context.Context, args struct{ Title string }) (*TagResolver, error) {
tag := &models.Tag{}
err := tag.GetTagBytTitle(ctx, args.Title)
if err != nil {
return nil, errors.Wrap(err, "GetTag")
}
s := TagResolver{
m: *tag,
}
return &s, nil
} | [
-0.30700191855430603,
0.07616111636161804,
0.367410272359848,
0.3258873522281647,
0.9977177381515503,
0.010314290411770344,
-0.3340267241001129,
-0.5942546725273132,
-1.2190974950790405,
-0.19605129957199097,
0.08454108983278275,
0.01213188748806715,
0.04670291393995285,
-0.029639026150107... |
func (r *Resolver) AddBook(ctx context.Context, args struct{ Book models.BookInput }) (*BookResolver, error) {
book := &models.Book{}
err := book.AddBook(ctx, args.Book)
if err != nil {
return nil, errors.Wrap(err, "AddBook")
}
s := BookResolver{
m: book,
}
return &s, nil
} | [
-1.2176737785339355,
0.3742673993110657,
0.544430673122406,
1.0662198066711426,
0.5789424777030945,
0.917305052280426,
-0.1439860612154007,
0.0887138620018959,
-0.6087319850921631,
-0.9682222008705139,
0.42426106333732605,
-0.9986134171485901,
-0.9992154240608215,
0.3767758309841156,
-0.... |
func (r *Resolver) UpdateBook(ctx context.Context, args struct{ Book models.BookInput }) (*BookResolver, error) {
book := &models.Book{}
err := book.UpdateBook(ctx, &args.Book)
if err != nil {
return nil, errors.Wrap(err, "UpdateBook")
}
s := BookResolver{
m: book,
}
return &s, nil
} | [
-1.8306314945220947,
-0.27777934074401855,
0.43495455384254456,
1.0252737998962402,
0.1913343369960785,
0.7291183471679688,
0.10566200315952301,
0.05287448316812515,
-0.6750279068946838,
-0.1114516481757164,
0.07410367578268051,
-0.4830469787120819,
-0.9044720530509949,
0.19257523119449615... |
func (r *Resolver) DeleteBook(ctx context.Context, args struct{ UserID, BookID graphql.ID }) (*bool, error) {
bookID, err := util.GqlIDToUint(args.BookID)
if err != nil {
return nil, errors.Wrap(err, "DeleteBook")
}
userID, err := util.GqlIDToUint(args.UserID)
if err != nil {
return nil, errors.Wrap(err, "Del... | [
-0.5137654542922974,
0.3686412572860718,
0.7423036694526672,
0.4928719103336334,
0.3295653462409973,
1.0281399488449097,
-0.1738305538892746,
-0.4380605220794678,
-0.3773293197154999,
-0.2849419414997101,
0.6538182497024536,
-0.28232067823410034,
-0.9162108302116394,
0.5827945470809937,
... |
func encodeCursor(i int) graphql.ID {
return graphql.ID(base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("cursor%d", i))))
} | [
-0.5181716680526733,
-0.6424680948257446,
0.26640886068344116,
-0.16276367008686066,
-0.8702974319458008,
0.2385568618774414,
-0.2257952094078064,
-0.7470163106918335,
0.5257965922355652,
0.6518660187721252,
-0.3722425699234009,
0.5428892970085144,
-0.4745866358280182,
-0.03359174728393555... |
func decodeCursor(s string) (int, error) {
b, err := base64.StdEncoding.DecodeString(s)
if err != nil {
return 0, err
}
i, err := strconv.Atoi(strings.TrimPrefix(string(b), "cursor"))
if err != nil {
return 0, err
}
return i, nil
} | [
-0.4949222207069397,
-0.9803555011749268,
0.49432429671287537,
0.13762685656547546,
-1.456990122795105,
-0.9393669962882996,
0.6882494688034058,
0.5868020057678223,
-0.006932942196726799,
-0.039551954716444016,
-0.2273627668619156,
0.46710750460624695,
-0.3624500334262848,
0.00286006717942... |
func SendSingleDevice() func(echo.Context) error {
return func(c echo.Context) error {
//TODO APP PUT IN CONTEXT?
app := libs.InitializeAppWithServiceAccount()
ctx := context.Background()
client, err := app.Messaging(ctx)
if err != nil {
msg := &Message{
Status: "0",
Message: err.Error(),
}
... | [
-0.9028757214546204,
0.3831259608268738,
0.9630665183067322,
0.24671050906181335,
0.19827716052532196,
-0.030495189130306244,
0.37769585847854614,
-0.6184134483337402,
0.21910016238689423,
0.17883487045764923,
-0.413578599691391,
0.8269030451774597,
-0.3866185247898102,
0.8494867086410522,... |
func NewWriter(dst io.Writer) *Writer {
z := new(Writer)
z.Reset(dst)
return z
} | [
-0.554878830909729,
0.625110387802124,
-0.02212647721171379,
0.9206259846687317,
-0.47401654720306396,
-0.5915839076042175,
0.847354531288147,
-0.045485466718673706,
-0.06074339896440506,
0.08721591532230377,
-0.7238354682922363,
0.1749095469713211,
0.835240364074707,
-0.19902293384075165,... |
func (z *Writer) WithConcurrency(n int) *Writer {
switch {
case n == 0 || n == 1:
z.c = nil
return z
case n < 0:
n = runtime.GOMAXPROCS(0)
}
z.c = make(chan chan zResult, n)
// Writer goroutine managing concurrent block compression goroutines.
go func() {
// Process next block compression item.
for c :... | [
0.5230674147605896,
-0.12313251197338104,
0.7745136618614197,
0.23250146210193634,
0.1073131188750267,
-1.4884783029556274,
1.0239956378936768,
-0.6698065400123596,
-0.22445900738239288,
0.011028281413018703,
-0.3561699390411377,
-1.1100724935531616,
-0.4668002128601074,
0.5703000426292419... |
func (z *Writer) newBuffers() {
bSize := z.Header.BlockMaxSize
buf := getBuffer(bSize)
z.data = buf[:bSize] // Uncompressed buffer is the first half.
} | [
0.3639512062072754,
-0.3697582483291626,
0.4553263783454895,
0.38525626063346863,
-0.3373812735080719,
-0.8508879542350769,
0.14464980363845825,
-0.5612539052963257,
-0.18368880450725555,
-0.40644729137420654,
-1.224909782409668,
0.10053040832281113,
-0.8176683187484741,
0.0815961211919784... |
func (z *Writer) freeBuffers() {
// Put the buffer back into the pool, if any.
putBuffer(z.Header.BlockMaxSize, z.data)
z.data = nil
} | [
1.043986439704895,
0.3435388505458832,
0.3423910140991211,
-0.6900324821472168,
-0.1836678832769394,
-0.6590557098388672,
0.8097532987594604,
-1.155619502067566,
0.10257888585329056,
-0.7097457051277161,
-1.1282272338867188,
-0.018792711198329926,
-1.9275115728378296,
0.09969152510166168,
... |
func (z *Writer) writeHeader() error {
// Default to 4Mb if BlockMaxSize is not set.
if z.Header.BlockMaxSize == 0 {
z.Header.BlockMaxSize = blockSize4M
}
// The only option that needs to be validated.
bSize := z.Header.BlockMaxSize
if !isValidBlockSize(z.Header.BlockMaxSize) {
return fmt.Errorf("lz4: invalid... | [
-0.07683669030666351,
-0.1394309252500534,
0.9706976413726807,
0.565293550491333,
0.017812397330999374,
-0.17598485946655273,
0.6048785448074341,
0.3357539474964142,
-0.1261763870716095,
-0.19948330521583557,
-0.9273000955581665,
0.3075505495071411,
-0.2877662181854248,
0.3998345732688904,... |
func (z *Writer) Write(buf []byte) (int, error) {
if !z.Header.done {
if err := z.writeHeader(); err != nil {
return 0, err
}
}
if debugFlag {
debug("input buffer len=%d index=%d", len(buf), z.idx)
}
zn := len(z.data)
var n int
for len(buf) > 0 {
if z.idx == 0 && len(buf) >= zn {
// Avoid a copy a... | [
-0.5030858516693115,
0.6052824854850769,
0.7477339506149292,
0.30709320306777954,
-0.30492115020751953,
-0.9411657452583313,
1.4995768070220947,
-0.22804559767246246,
-0.3958275020122528,
-0.3004743456840515,
-1.1082568168640137,
-0.10929953306913376,
-1.1748629808425903,
0.477912932634353... |
func (z *Writer) compressBlock(data []byte) error {
if !z.NoChecksum {
_, _ = z.checksum.Write(data)
}
if z.c != nil {
c := make(chan zResult)
z.c <- c // Send now to guarantee order
// get a buffer from the pool and copy the data over
block := getBuffer(z.Header.BlockMaxSize)[:len(data)]
copy(block, d... | [
0.12399113178253174,
0.22721600532531738,
1.0298712253570557,
0.6136089563369751,
0.09615880250930786,
-0.47490572929382324,
0.9330326914787292,
-0.2544412612915039,
0.005524174310266972,
-0.3892839848995209,
-0.5716813206672668,
0.0936276838183403,
-1.1004263162612915,
0.9489983916282654,... |
func (z *Writer) Flush() error {
if debugFlag {
debug("flush with index %d", z.idx)
}
if z.idx == 0 {
return nil
}
data := getBuffer(z.Header.BlockMaxSize)[:len(z.data[:z.idx])]
copy(data, z.data[:z.idx])
z.idx = 0
if z.c == nil {
return z.compressBlock(data)
}
if !z.NoChecksum {
_, _ = z.checksum.W... | [
0.4205740690231323,
0.3748435378074646,
0.44988813996315,
0.36318159103393555,
0.38970234990119934,
-0.5718755125999451,
0.9914128184318542,
-0.60868239402771,
0.15892015397548676,
-0.6865610480308533,
-0.4417423605918884,
0.7420961260795593,
-0.8687480092048645,
0.21983949840068817,
-0.... |
func (z *Writer) Close() error {
if !z.Header.done {
if err := z.writeHeader(); err != nil {
return err
}
}
if err := z.Flush(); err != nil {
return err
}
if err := z.close(); err != nil {
return err
}
z.freeBuffers()
if debugFlag {
debug("writing last empty block")
}
if err := z.writeUint32(0);... | [
0.3187037706375122,
0.02973048947751522,
0.9519416689872742,
0.04327339679002762,
-0.8307043313980103,
-0.30268362164497375,
1.144757628440857,
-0.9519923329353333,
-0.04651787132024765,
-0.4969322979450226,
0.12422442436218262,
-0.6759730577468872,
-1.5408837795257568,
0.731198251247406,
... |
func (z *Writer) Reset(w io.Writer) {
n := cap(z.c)
_ = z.close()
z.freeBuffers()
z.Header.Reset()
z.dst = w
z.checksum.Reset()
z.idx = 0
z.err = nil
// reset hashtable to ensure deterministic output.
for i := range z.hashtable {
z.hashtable[i] = 0
}
z.WithConcurrency(n)
} | [
-0.23233160376548767,
0.3823222815990448,
0.1348714828491211,
0.4631747901439667,
-0.06268923729658127,
-0.5194575786590576,
2.0492122173309326,
-0.6428188681602478,
-0.6341292262077332,
-0.10775217413902283,
-0.6871306896209717,
-0.19478470087051392,
0.0031511865090578794,
-0.062661439180... |
func (z *Writer) writeUint32(x uint32) error {
buf := z.buf[:4]
binary.LittleEndian.PutUint32(buf, x)
_, err := z.dst.Write(buf)
return err
} | [
-0.3312024176120758,
0.8315501809120178,
0.20716054737567902,
-0.9990124702453613,
0.19112065434455872,
0.7780466675758362,
-0.4599814713001251,
-0.31777510046958923,
-0.12196110934019089,
-0.5081307888031006,
-1.6276808977127075,
-0.676251232624054,
0.2536708116531372,
0.25387468934059143... |
func writerCompressBlock(c chan zResult, header Header, data []byte) {
zdata := getBuffer(header.BlockMaxSize)
// The compressed block size cannot exceed the input's.
var zn int
if level := header.CompressionLevel; level != 0 {
zn, _ = CompressBlockHC(data, zdata, level)
} else {
var hashTable [winSize]int
z... | [
0.04987170919775963,
-0.042505063116550446,
0.7706730365753174,
0.15350441634655,
0.00549330422654748,
-0.7211310267448425,
0.45035529136657715,
-0.06738907843828201,
-0.31224265694618225,
-0.54236900806427,
-1.0135960578918457,
0.1882973313331604,
-1.006403923034668,
0.7889975905418396,
... |
func New(cfg ...Config) (*x509.Certificate, crypto.Signer, error) {
cert, key, err := genCertAndKey(getConfig(cfg), true)
if err != nil {
return nil, nil, err
}
return cert, key, nil
} | [
-0.09930073469877243,
-0.7824907302856445,
0.48177435994148254,
0.6613568663597107,
-1.0778107643127441,
-0.21758458018302917,
-0.09569812566041946,
0.3858853876590729,
-1.3619674444198608,
0.4165314733982086,
-0.861155092716217,
-0.6666434407234192,
0.18623583018779755,
1.2021390199661255... |
func NewDER(cfg ...Config) (certificate []byte, key []byte, err error) {
cert, signerKey, err := genCertAndKey(getConfig(cfg), false)
if err != nil {
return nil, nil, err
}
certificate = cert.Raw
switch k := signerKey.(type) {
case *rsa.PrivateKey:
key, err = x509.MarshalPKCS8PrivateKey(k)
case *ecdsa.Pri... | [
-0.7894379496574402,
-0.7154072523117065,
0.9410149455070496,
0.5516565442085266,
-0.8463576436042786,
0.4854377806186676,
-0.6497799158096313,
-0.034526679664850235,
-0.5670674443244934,
0.2985040247440338,
-0.27198565006256104,
-0.20599889755249023,
-0.19483056664466858,
0.98086583614349... |
func NewPEM(cfg ...Config) (certificate []byte, key []byte, err error) {
certBytes, keyBytes, err := NewDER(getConfig(cfg))
if err != nil {
return nil, nil, err
}
c, err := pemEncodeCert(certBytes)
if err != nil {
return nil, nil, err
}
k, err := pemEncodeKey(keyBytes)
if err != nil {
return nil, nil, ... | [
-0.3922363817691803,
-0.13897545635700226,
0.6932321190834045,
0.9432550072669983,
-0.6628310084342957,
0.04667052626609802,
-0.19981007277965546,
0.3204970061779022,
-0.4211430251598358,
0.7223833203315735,
-0.9514657855033875,
-0.48715487122535706,
-0.292063444852829,
0.7121143937110901,... |
func Run(ctx context.Context, config *Config) error {
clientConfig, err := rest.InClusterConfig()
clientset, err := kubernetes.NewForConfig(clientConfig)
if err != nil {
return err
}
var namespace string
// A specific namespace is ignored if all-namespaces is provided
if config.AllNamespaces {
namespace = "... | [
0.3584490120410919,
-0.048354361206293106,
0.9573426842689514,
-0.458450585603714,
0.3480352759361267,
0.33402571082115173,
0.4864254891872406,
-0.20556890964508057,
0.09644780308008194,
-0.13889509439468384,
-0.7150543332099915,
0.9737858772277832,
-0.5421665906906128,
0.8016281723976135,... |
func NewTargets(c *Configuration) ([]*Target, error) {
for _, rule := range c.Rules {
err := rule.setup()
if err != nil {
return nil, err
}
rule.tags = c.Tags
}
targets := []*Target{}
for ruleName, addrs := range c.Targets {
rule, ok := c.Rules[ruleName]
if !ok {
return nil, fmt.Errorf("unknown r... | [
-0.6189854145050049,
-0.5991964936256409,
0.27319440245628357,
-0.2274748980998993,
1.4284555912017822,
-0.40619102120399475,
-0.8872959017753601,
0.11492054909467697,
-0.7053521871566772,
0.8334567546844482,
0.17091742157936096,
0.4963065981864929,
-0.06275472790002823,
0.7011852860450745... |
func New(seed uint64) hash.Hash64 {
xxh := &xxHash{seed: seed}
xxh.Reset()
return xxh
} | [
0.6001742482185364,
-0.31118515133857727,
0.10359279811382294,
1.021120309829712,
-0.7473230361938477,
0.010798480361700058,
-0.7200201749801636,
-0.15269096195697784,
-0.5108336210250854,
-0.45686817169189453,
0.083560511469841,
0.6261867880821228,
0.9613748788833618,
-0.17262883484363556... |
func (xxh xxHash) Sum(b []byte) []byte {
h64 := xxh.Sum64()
return append(b, byte(h64), byte(h64>>8), byte(h64>>16), byte(h64>>24), byte(h64>>32), byte(h64>>40), byte(h64>>48), byte(h64>>56))
} | [
-0.17263343930244446,
0.0825686901807785,
0.9218481183052063,
0.5824826955795288,
0.38445523381233215,
0.3499460220336914,
-0.4954412877559662,
0.04183858633041382,
0.29293933510780334,
0.4311031997203827,
-1.3575093746185303,
0.026101285591721535,
-0.8023560047149658,
-0.4198514223098755,... |
func (xxh *xxHash) Reset() {
xxh.v1 = xxh.seed + prime64_1 + prime64_2
xxh.v2 = xxh.seed + prime64_2
xxh.v3 = xxh.seed
xxh.v4 = xxh.seed - prime64_1
xxh.totalLen = 0
xxh.bufused = 0
} | [
-0.2436341941356659,
0.5857589244842529,
0.29344630241394043,
-0.1419871747493744,
0.3171917200088501,
0.5959886312484741,
0.36332833766937256,
-0.4768695533275604,
-0.13131342828273773,
-0.004138497170060873,
-1.0883760452270508,
0.4769478440284729,
-0.6879057288169861,
-0.484707981348037... |
func (xxh *xxHash) Size() int {
return 8
} | [
0.43087053298950195,
0.570910632610321,
0.4711689054965973,
-0.3112720847129822,
0.36931049823760986,
1.1610759496688843,
0.06058412790298462,
-0.6391783952713013,
0.548875093460083,
-0.281729131937027,
-0.6547607779502869,
-0.1959429681301117,
-0.9003236889839172,
-0.3857842683792114,
0... |
func (xxh *xxHash) BlockSize() int {
return 1
} | [
0.12829674780368805,
0.9696904420852661,
0.6124079823493958,
0.7156457901000977,
-0.17565451562404633,
0.5654890537261963,
0.518877387046814,
-0.23123954236507416,
0.06658241897821426,
-0.1956038773059845,
-0.5173687934875488,
-0.3322445750236511,
-1.34943687915802,
0.6858283877372742,
0... |
func (xxh *xxHash) Write(input []byte) (int, error) {
n := len(input)
m := xxh.bufused
xxh.totalLen += uint64(n)
r := len(xxh.buf) - m
if n < r {
copy(xxh.buf[m:], input)
xxh.bufused += len(input)
return n, nil
}
p := 0
if m > 0 {
// some data left from previous update
copy(xxh.buf[xxh.bufused:], i... | [
-0.46325644850730896,
-0.008697881363332272,
0.8245835304260254,
-0.086720310151577,
-0.10876762866973877,
0.3944714367389679,
0.6257550716400146,
0.08252106606960297,
0.9028432369232178,
-0.0767393633723259,
-0.7183395624160767,
-0.20631137490272522,
-0.9540835618972778,
-0.20417457818984... |
func (xxh *xxHash) Sum64() uint64 {
var h64 uint64
if xxh.totalLen >= 32 {
h64 = ((xxh.v1 << 1) | (xxh.v1 >> 63)) +
((xxh.v2 << 7) | (xxh.v2 >> 57)) +
((xxh.v3 << 12) | (xxh.v3 >> 52)) +
((xxh.v4 << 18) | (xxh.v4 >> 46))
xxh.v1 *= prime64_2
h64 ^= ((xxh.v1 << 31) | (xxh.v1 >> 33)) * prime64_1
h64 = ... | [
-0.7303772568702698,
0.34434667229652405,
0.9859288334846497,
0.3014622926712036,
-0.0252410639077425,
-0.11714334040880203,
0.4790230095386505,
-0.12214887142181396,
0.3564209043979645,
-0.2857028841972351,
-0.9868988990783691,
-0.4733763039112091,
-0.9413875937461853,
-0.0077054742723703... |
func Checksum(input []byte, seed uint64) uint64 {
n := len(input)
var h64 uint64
if n >= 32 {
v1 := seed + prime64_1 + prime64_2
v2 := seed + prime64_2
v3 := seed
v4 := seed - prime64_1
p := 0
for n := n - 32; p <= n; {
p64 := v1 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40... | [
-0.16890084743499756,
-0.06077625975012779,
0.8484867811203003,
0.3425486981868744,
-0.19912193715572357,
0.5900031924247742,
0.6397430300712585,
-0.2677968144416809,
1.180801510810852,
-0.11071382462978363,
-0.26465877890586853,
-0.2861202657222748,
-0.4200090169906616,
-0.003655232256278... |
func NewExtraTokenHandler(tokenStore sqlstore.TokenStore, notifyStore sqlstore.TokenNotifyStore, cache cache.Cache,
jwtClient jwt.BCSJWTAuthentication, clusterClient *cmanager.ClusterManagerClient, cmdbClient *cmdb.Client) *ExtraTokenHandler {
return &ExtraTokenHandler{
tokenStore: tokenStore,
notifyStore: n... | [
0.5332447290420532,
0.33842185139656067,
0.15587298572063446,
-0.5367050766944885,
-1.2784112691879272,
-0.05486389249563217,
-0.6534833908081055,
0.728603720664978,
0.3121465742588043,
-0.05248072370886803,
-0.7641461491584778,
0.7000202536582947,
-1.3610607385635376,
0.2559441030025482,
... |
func (t *ExtraTokenHandler) GetTokenByUserAndClusterID(request *restful.Request, response *restful.Response) {
username := request.Request.URL.Query().Get("username")
clusterID := request.Request.URL.Query().Get("cluster_id")
businessID := request.Request.URL.Query().Get("business_id")
start := time.Now()
if len(u... | [
0.3408214747905731,
-0.6153005957603455,
0.8077260255813599,
0.497275710105896,
-0.17269781231880188,
0.05430412292480469,
0.47388333082199097,
-0.2139381617307663,
-0.13384667038917542,
0.13264115154743195,
0.013522707857191563,
1.759897232055664,
-0.84708172082901,
0.8484815955162048,
... |
func EncodeLength(length uint64) []byte {
// The first bit is used to indicate whether this is the final byte
// encoding the length. So, if the first bit is 0, just return a one
// byte response containing the byte-encoded length.
if length <= 0x7f {
return []byte{byte(length)}
}
// If the length is bigger th... | [
-0.15214410424232483,
0.5079644918441772,
0.3730325400829315,
-0.0804276093840599,
-0.547124445438385,
-0.13269275426864624,
-0.13812056183815002,
-0.7028626203536987,
2.24127459526062,
-0.38829126954078674,
-0.7750512361526489,
-0.006717662792652845,
-0.651064932346344,
0.5622225999832153... |
func DecodeLength(toparse []byte) (uint64, int, error) {
// If the first bit is zero, the rest of the first byte indicates the length. Values up to 127 are encoded this way (unless you're using indefinite length, but we don't support that)
if toparse[0] == 0x80 {
return 0, 0, fmt.Errorf("we don't support indefinit... | [
-0.045793816447257996,
-0.49075573682785034,
0.5818145275115967,
-0.1992081105709076,
-0.14823836088180542,
0.0692024752497673,
0.2663590610027313,
0.40342286229133606,
0.5141903758049011,
-0.16950683295726776,
-0.08355526626110077,
-0.05822424963116646,
-0.2226414978504181,
0.696002662181... |
func DecodeInteger(toparse []byte) (int64, error) {
if len(toparse) > 8 {
return 0, fmt.Errorf("don't support more than 64 bits")
}
var val int64
for _, b := range toparse {
val = val<<8 | int64(b)
}
// Extend sign if necessary.
val <<= 64 - uint8(len(toparse))*8
val >>= 64 - uint8(len(toparse))*8
return v... | [
-1.36063551902771,
0.08359085023403168,
0.4766435921192169,
0.3606019616127014,
-0.411857545375824,
0.12183767557144165,
0.1644158661365509,
-0.021204320713877678,
-0.11066766083240509,
-0.21711893379688263,
-0.01711822859942913,
-0.2975805401802063,
-0.8244545459747314,
0.9459460973739624... |
func DecodeUInt(toparse []byte) (uint64, error) {
if len(toparse) > 8 {
return 0, fmt.Errorf("don't support more than 64 bits")
}
var val uint64
for _, b := range toparse {
val = val<<8 | uint64(b)
}
return val, nil
} | [
-1.3082356452941895,
-0.10492060333490372,
0.5038237571716309,
-0.2267318069934845,
0.4153931140899658,
0.4309416711330414,
-0.38923656940460205,
0.8426942229270935,
0.34413355588912964,
-0.6751059889793396,
-0.2002231776714325,
-0.27596670389175415,
-0.43426793813705444,
0.376364380121231... |
func EncodeInteger(toEncode int64) []byte {
// Calculate the length we'll need for the encoded value.
var l int64 = 1
if toEncode > 0 {
for i := toEncode; i > 255; i >>= 8 {
l++
}
} else {
for i := -toEncode; i > 255; i >>= 8 {
l++
}
// Ensure room for the sign if necessary.
if toEncode < 0 {
l... | [
-1.0108729600906372,
0.7392109632492065,
0.5181118249893188,
-0.0041177659295499325,
-0.9396247863769531,
-0.6028609275817871,
-0.5656518340110779,
-0.2402862310409546,
0.5327606201171875,
0.3743305802345276,
-0.3554714322090149,
0.23525385558605194,
-0.5744737982749939,
1.205090880393982,... |
func EncodeUInt(toEncode uint64) []byte {
// Calculate the length we'll need for the encoded value.
var l int64 = 1
for i := toEncode; i > 255; i >>= 8 {
l++
}
// Now create a byte array of the correct length and copy the value into it.
result := make([]byte, l)
for i := int64(0); i < l; i++ {
result[i] = b... | [
-0.9222578406333923,
0.6628149747848511,
0.4667727053165436,
-0.4934278130531311,
-0.058198511600494385,
-0.39144378900527954,
-0.898884117603302,
-0.06669775396585464,
1.0771464109420776,
-0.053525298833847046,
-1.0600770711898804,
0.47259047627449036,
0.0694868266582489,
0.35116001963615... |
func NewVotingWorker(config VotingWorkerConfig) Application {
c := new(votingWorker)
c.ironQueueName = config.IronQueueName
c.jsonDir = config.JSONDir
return c
} | [
-0.3990630805492401,
-0.8611133098602295,
0.248267263174057,
0.8034506440162659,
-0.4167625308036804,
0.4295620918273926,
-0.49312490224838257,
0.702328085899353,
-0.41317492723464966,
0.5295141935348511,
-1.3254258632659912,
0.012269983068108559,
-0.07653011381626129,
1.3630503416061401,
... |
func New(configVarResolver *providerconfig.ConfigVarResolver) cloudprovidertypes.Provider {
return &provider{configVarResolver: configVarResolver}
} | [
0.012137054465711117,
-0.21946173906326294,
-0.05165497586131096,
0.2974913716316223,
-0.18708868324756622,
0.26019856333732605,
0.5186862349510193,
0.011931498534977436,
-0.17328405380249023,
0.3088134527206421,
-0.6757109761238098,
-0.4513508379459381,
-0.23026001453399658,
0.73361599445... |
func getNamespace() string {
ns := os.Getenv("POD_NAMESPACE")
if ns == "" {
// Useful especially for ci tests.
ns = metav1.NamespaceSystem
}
return ns
} | [
0.08286624401807785,
0.21852487325668335,
0.11115510761737823,
1.267581582069397,
0.49212267994880676,
0.1371966153383255,
-0.05387698858976364,
-1.2223995923995972,
0.7085189819335938,
-0.6835537552833557,
0.9015999436378479,
0.9552172422409058,
-0.29894331097602844,
0.6230778098106384,
... |
func (p *provider) MigrateUID(_ context.Context, _ *zap.SugaredLogger, _ *clusterv1alpha1.Machine, _ types.UID) error {
return nil
} | [
-0.8117896914482117,
0.19130948185920715,
0.5249555110931396,
0.33968138694763184,
0.22114309668540955,
1.396352767944336,
0.2476777881383896,
0.4910826086997986,
0.9896942973136902,
0.029591327533125877,
-0.7374089956283569,
1.450057864189148,
-0.6375268697738647,
0.5995311141014099,
-0... |
func NewSockPair(name string) (parent *os.File, child *os.File, err error) {
fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_STREAM|syscall.SOCK_CLOEXEC, 0)
if err != nil {
return nil, nil, err
}
return os.NewFile(uintptr(fds[1]), name+"-p"), os.NewFile(uintptr(fds[0]), name+"-c"), nil
} | [
0.3459545373916626,
-0.2028931826353073,
0.7713698744773865,
-0.4329177737236023,
-1.2489920854568481,
-0.1733073592185974,
0.28233861923217773,
-0.8728070259094238,
-0.5277596116065979,
0.03925814852118492,
0.1173374205827713,
-0.2582617402076721,
-0.5211610198020935,
1.0224270820617676,
... |
func getUUIDRegex(version *int32) (string, error) {
if version == nil {
return "", nil
} else if *version < 0 || *version > 5 {
return "", fmt.Errorf("UUID version should be between 0-5, Got %d", *version)
} else if *version == 0 {
return fmt.Sprintf(uuidPattern, "1-5"), nil
} else {
return fmt.Sprintf(uuid... | [
-1.0692813396453857,
-0.16935113072395325,
0.644682765007019,
-0.6014532446861267,
-0.6769911646842957,
0.20083142817020416,
-0.153620183467865,
1.1572301387786865,
-0.20018088817596436,
0.1361633539199829,
-0.3714130222797394,
0.2273487001657486,
-0.33408284187316895,
-0.29399898648262024... |
func NewArticle() *Article {
a := Article{}
a.Date = time.Now()
return &a
} | [
-0.02934173122048378,
-1.3509860038757324,
0.4767490029335022,
0.46429240703582764,
-0.7498968243598938,
-0.3647744357585907,
0.13105300068855286,
0.11255177110433578,
-0.5214564800262451,
-0.49749940633773804,
-0.0024818386882543564,
0.21522803604602814,
-0.09415145218372345,
0.5223181843... |
func NewDB() (*DB, error) {
config := appconfig.Config.MySQL
connectionString := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local", config.User, config.Password, config.Host, config.Database)
db, err := gorm.Open("mysql", connectionString)
if err != nil {
return nil, err
}
if err = db.DB().P... | [
0.17487302422523499,
0.07527380436658859,
0.6493484377861023,
0.7153267860412598,
-0.3723960220813751,
0.6720457077026367,
-0.14162521064281464,
-0.10291776806116104,
-0.03430123254656792,
0.3358183801174164,
0.6086476445198059,
0.07517051696777344,
-0.6427600383758545,
0.38587698340415955... |
func (tq *TeamQuery) Where(ps ...predicate.Team) *TeamQuery {
tq.predicates = append(tq.predicates, ps...)
return tq
} | [
0.4605417847633362,
0.036865510046482086,
0.29158884286880493,
-0.7099425196647644,
-0.4512661397457123,
1.1939945220947266,
-0.4028840661048889,
-0.4225273132324219,
-1.2651746273040771,
-0.21445095539093018,
0.2749181389808655,
0.45671385526657104,
0.046613626182079315,
-0.42167457938194... |
func (tq *TeamQuery) Limit(limit int) *TeamQuery {
tq.ctx.Limit = &limit
return tq
} | [
-0.08348491042852402,
0.6750425696372986,
0.3861596882343292,
-0.6324523091316223,
-0.1741780936717987,
0.797389566898346,
0.3855476975440979,
-0.18709786236286163,
0.42776021361351013,
-0.37006163597106934,
0.6008889079093933,
0.2241998165845871,
-0.2538619339466095,
-1.1584519147872925,
... |
func (tq *TeamQuery) Offset(offset int) *TeamQuery {
tq.ctx.Offset = &offset
return tq
} | [
0.046571508049964905,
0.014682215638458729,
0.16660326719284058,
-0.9278597235679626,
-1.044046401977539,
2.1538033485412598,
0.6457443237304688,
0.20231615006923676,
0.532896101474762,
-0.25313714146614075,
0.307829886674881,
0.27551010251045227,
0.47742435336112976,
-0.4182170629501343,
... |
func (tq *TeamQuery) Unique(unique bool) *TeamQuery {
tq.ctx.Unique = &unique
return tq
} | [
0.005409589037299156,
0.3082455098628998,
0.19726374745368958,
-0.7983579635620117,
-0.190839946269989,
1.24088716506958,
0.8804559111595154,
0.29847991466522217,
0.15843403339385986,
-0.3436468839645386,
0.10556667298078537,
0.7045304179191589,
0.2666475176811218,
-0.649956464767456,
-2... |
func (tq *TeamQuery) Order(o ...OrderFunc) *TeamQuery {
tq.order = append(tq.order, o...)
return tq
} | [
-0.29446908831596375,
0.5005031228065491,
0.2282238006591797,
0.35107725858688354,
0.470869779586792,
0.49734753370285034,
-0.5339389443397522,
-0.4684465527534485,
-0.5591637492179871,
-0.06349313259124756,
-0.304342120885849,
-0.20197699964046478,
0.9497911334037781,
-0.03219842910766601... |
func (tq *TeamQuery) QueryTasks() *TaskQuery {
query := (&TaskClient{config: tq.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := tq.prepareQuery(ctx); err != nil {
return nil, err
}
selector := tq.sqlQuery(ctx)
if err := selector.Err(); err != nil {
re... | [
0.40572232007980347,
0.34094005823135376,
0.5006005764007568,
-0.1265525221824646,
-0.335925817489624,
0.013885117135941982,
0.8025996685028076,
-0.7111709117889404,
-0.6096124053001404,
-0.174829363822937,
0.03119567036628723,
0.09403703361749649,
0.44894203543663025,
-0.6253021359443665,... |
func (tq *TeamQuery) QueryUsers() *UserQuery {
query := (&UserClient{config: tq.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := tq.prepareQuery(ctx); err != nil {
return nil, err
}
selector := tq.sqlQuery(ctx)
if err := selector.Err(); err != nil {
re... | [
-0.25086095929145813,
0.054282307624816895,
0.40187886357307434,
-0.2530510127544403,
-0.7206702828407288,
-0.1859118938446045,
0.48112326860427856,
-0.464793860912323,
-0.5238831639289856,
-0.13276518881320953,
0.45488306879997253,
0.4133065342903137,
0.19162793457508087,
-0.6797041296958... |
func (tq *TeamQuery) FirstX(ctx context.Context) *Team {
node, err := tq.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return node
} | [
0.701418936252594,
0.7641941905021667,
0.36092543601989746,
-0.24124428629875183,
0.022104386240243912,
0.10195525735616684,
-0.9975754618644714,
-0.9531461000442505,
0.43510520458221436,
-0.2341345101594925,
0.8372045755386353,
0.03730539605021477,
0.09871403127908707,
-0.2396829575300216... |
func (tq *TeamQuery) FirstIDX(ctx context.Context) int {
id, err := tq.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return id
} | [
0.4765486419200897,
0.04802359640598297,
0.22438554465770721,
-0.6792663931846619,
-0.057550929486751556,
-0.048230402171611786,
-0.4481090307235718,
-0.7053359150886536,
0.22778740525245667,
-0.4773070514202118,
0.24156372249126434,
-0.13035209476947784,
-0.14369794726371765,
0.3451610803... |
func (tq *TeamQuery) OnlyX(ctx context.Context) *Team {
node, err := tq.Only(ctx)
if err != nil {
panic(err)
}
return node
} | [
0.06296326220035553,
1.245763897895813,
0.3320084512233734,
0.16890722513198853,
-0.7489376068115234,
0.8833605051040649,
-0.7438716292381287,
-0.2931710183620453,
0.7868000268936157,
0.08696599304676056,
0.9586263298988342,
0.47011512517929077,
-0.0696180909872055,
-0.33772018551826477,
... |
func (tq *TeamQuery) OnlyIDX(ctx context.Context) int {
id, err := tq.OnlyID(ctx)
if err != nil {
panic(err)
}
return id
} | [
-0.27190691232681274,
0.4556905925273895,
0.24736212193965912,
-0.20441383123397827,
-0.7734605669975281,
0.5928230285644531,
-0.41649335622787476,
0.18584582209587097,
0.6928318738937378,
-0.22753767669200897,
0.4972860813140869,
0.48120883107185364,
-0.8399189710617065,
-0.23994746804237... |
func (tq *TeamQuery) All(ctx context.Context) ([]*Team, error) {
ctx = setContextOp(ctx, tq.ctx, "All")
if err := tq.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*Team, *TeamQuery]()
return withInterceptors[[]*Team](ctx, tq, qr, tq.inters)
} | [
-0.04777073487639427,
-0.2698077857494354,
0.4514542818069458,
-0.21121442317962646,
0.22366729378700256,
0.5319787859916687,
-0.699849545955658,
-0.11145763099193573,
-0.3609650731086731,
-0.27329498529434204,
0.5696316957473755,
0.7439060807228088,
-0.22033217549324036,
0.023758761584758... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.