text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (o *ProductOK) WithPayload(payload *models.Product) *ProductOK {
o.Payload = payload
return o
} | [
0.1444873809814453,
-0.47928816080093384,
-0.08727904409170151,
0.8748632669448853,
-0.7852746248245239,
0.34147027134895325,
0.7174184322357178,
-0.7775509357452393,
0.4887238144874573,
0.32529789209365845,
-0.4959535002708435,
-0.9126752614974976,
0.8526198863983154,
-0.33466285467147827... |
func (o *ProductOK) SetPayload(payload *models.Product) {
o.Payload = payload
} | [
-0.11787670105695724,
0.012455737218260765,
0.000028309998015174642,
1.0998250246047974,
-0.4841949939727783,
0.8554503917694092,
0.5544483661651611,
-0.8311637043952942,
0.23386743664741516,
0.5599092245101929,
-0.8174401521682739,
-0.471546471118927,
0.1270291656255722,
0.251805514097213... |
func (o *ProductOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
} | [
-0.44824454188346863,
-0.6024144291877747,
0.23015005886554718,
0.8256903290748596,
0.7502104640007019,
-0.34846431016921997,
0.5679648518562317,
-0.43433529138565063,
0.6418977379798889,
0.6613477468490601,
0.0596507266163826,
-0.7539274096488953,
-0.28783363103866577,
-0.3354572653770447... |
func NewProductDefault(code int) *ProductDefault {
if code <= 0 {
code = 500
}
return &ProductDefault{
_statusCode: code,
}
} | [
-0.3803957998752594,
0.3505174517631531,
0.08821649849414825,
0.9038262963294983,
0.4308711886405945,
0.0234693456441164,
0.09966763108968735,
-0.006749709602445364,
0.81581050157547,
0.7306575179100037,
-1.3080329895019531,
0.21148745715618134,
-0.5576754808425903,
0.21675460040569305,
... |
func (o *ProductDefault) WithStatusCode(code int) *ProductDefault {
o._statusCode = code
return o
} | [
-0.08138968795537949,
-0.5434781312942505,
-0.11452343314886093,
0.9898181557655334,
0.5148155689239502,
-0.08226711302995682,
0.05376667156815529,
0.2851278781890869,
0.4998331069946289,
0.7960963845252991,
-1.2095712423324585,
-0.3679030239582062,
0.34856027364730835,
0.19712626934051514... |
func (o *ProductDefault) SetStatusCode(code int) {
o._statusCode = code
} | [
-0.345599502325058,
-0.26609593629837036,
0.13476236164569855,
1.221977710723877,
0.4451664984226227,
0.40360119938850403,
0.5499571561813354,
0.6346989274024963,
0.03682900592684746,
0.6399160623550415,
-1.3024919033050537,
-0.015618962235748768,
-0.2773435115814209,
0.30397531390190125,
... |
func (o *ProductDefault) WithPayload(payload *models.Error) *ProductDefault {
o.Payload = payload
return o
} | [
0.12588371336460114,
-0.02044944278895855,
-0.04041820764541626,
0.5293558239936829,
0.638757586479187,
-0.005999651271849871,
0.13859550654888153,
-0.7522975206375122,
0.47122880816459656,
0.15547271072864532,
-0.5914880633354187,
-0.45814839005470276,
0.1087116226553917,
-0.3119342327117... |
func (o *ProductDefault) SetPayload(payload *models.Error) {
o.Payload = payload
} | [
-0.13473132252693176,
0.18386410176753998,
0.025473689660429955,
0.8708420991897583,
1.0898609161376953,
0.43619585037231445,
0.1760924756526947,
-0.5779946446418762,
0.18913878500461578,
0.3484800159931183,
-0.7673275470733643,
-0.11581232398748398,
-0.38470563292503357,
-0.00795606058090... |
func (o *ProductDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
} | [
-0.5073662996292114,
-0.11949192732572556,
0.22605764865875244,
1.1023792028427124,
1.56600022315979,
-0.203388050198555,
0.3332703411579132,
-0.23546430468559265,
0.5461258888244629,
0.5303759574890137,
-0.29934096336364746,
-0.7334176301956177,
-0.5117038488388062,
-0.4425666034221649,
... |
func CleanupLogs() error {
currentDir := LogDir()
if currentDir == "" {
glog.Infof("Glog's log dir is not set, nothing to clean up")
return nil
}
glog.Infof("Will clean up logs in: %s", currentDir)
return removeFiles(currentDir, programName())
} | [
0.3051441013813019,
-0.3552875518798828,
0.509988009929657,
-0.14889129996299744,
-0.4641818404197693,
0.379530668258667,
0.7834266424179077,
-0.3660728633403778,
0.44831204414367676,
-0.09597950428724289,
0.6242215037345886,
0.8200429081916809,
-0.7699563503265381,
0.4465498924255371,
0... |
func isDir(path string) (bool, error) {
fi, err := os.Lstat(path)
if err != nil {
return false, err
}
return fi.IsDir(), nil
} | [
-0.04316152259707451,
0.09759272634983063,
0.6510515213012695,
0.2774202823638916,
-0.6866042017936707,
0.7256415486335754,
0.42390239238739014,
0.0962173119187355,
0.8347303867340088,
-1.1488637924194336,
0.10875377058982849,
-0.014017713256180286,
-0.22057297825813293,
0.772998034954071,... |
func programName() string {
return filepath.Base(os.Args[0])
} | [
-0.07329216599464417,
-0.920263409614563,
0.835181474685669,
0.13971242308616638,
-0.36214232444763184,
0.7698045372962952,
1.078732967376709,
0.06200430914759636,
-0.678259551525116,
0.7109000086784363,
0.561148464679718,
0.818118155002594,
0.33768028020858765,
0.3331642150878906,
0.325... |
func LogDir() string {
logDir := ""
flag.Visit(func(f *flag.Flag) {
if f.Name == "log_dir" {
logDir = f.Value.String()
}
})
return logDir
} | [
0.23238211870193481,
-0.3651233911514282,
0.4522871673107147,
0.44960999488830566,
-0.06677237898111343,
0.21483564376831055,
-0.2642695903778076,
-0.24554969370365143,
-0.10822692513465881,
-0.5700942277908325,
0.6999667286872864,
0.7450273633003235,
0.19429127871990204,
0.800149261951446... |
func removeFiles(logDir string, prefix string) error {
pattern := fmt.Sprintf("%s/%s*", logDir, prefix)
files, err := filepath.Glob(pattern)
if err != nil {
glog.Errorf("Failed to glob %s %s", pattern, err)
return err
} else {
glog.Infof("Found files matching %s: %v", pattern, files)
}
toSkip := make(map[... | [
0.2306627631187439,
0.17029686272144318,
0.8589375019073486,
-0.3681949973106384,
-0.17195278406143188,
-0.47554534673690796,
0.782233715057373,
1.232257604598999,
0.0043123094365000725,
0.15571536123752594,
0.6677801012992859,
0.13322550058364868,
-0.771000325679779,
0.4739850163459778,
... |
func (*StreamingRecognizeRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _StreamingRecognizeRequest_OneofMarshaler, _StreamingRecognizeRequest_OneofUnmarshaler, _St... | [
-0.9704334139823914,
0.4032955467700958,
0.5052102208137512,
-0.5393133759498596,
0.14861367642879486,
-0.9526628851890564,
0.5062763690948486,
-0.9377636313438416,
0.20135349035263062,
-0.8993480801582336,
-0.31659314036369324,
0.31468087434768677,
-0.33574849367141724,
0.8996965289115906... |
func (*RecognitionAudio) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _RecognitionAudio_OneofMarshaler, _RecognitionAudio_OneofUnmarshaler, _RecognitionAudio_OneofSizer, ... | [
-0.39403602480888367,
0.49580711126327515,
0.5770580768585205,
-0.5655916929244995,
0.2856266498565674,
-0.5582594871520996,
0.9581307172775269,
-1.0608080625534058,
0.23779286444187164,
-0.4365251362323761,
-0.5406272411346436,
-0.056111011654138565,
-0.15079514682292938,
0.74616396427154... |
func (suite *MaskTestSuite) getSensitiveFieldsPathsRegex() []*regexp.Regexp {
var regexpList []*regexp.Regexp
for _, sensitiveFieldPath := range []string{
// Path nested in a map
"^/Spec/Build/CodeEntryAttributes/password$",
// Path nested in an array
"^/Spec/Volumes\\[\\d+\\]/Volume/VolumeSource/FlexVolume/... | [
-0.16485388576984406,
-0.6706893444061279,
0.7090131640434265,
0.7701417207717896,
0.5208171606063843,
-0.14897897839546204,
0.29520341753959656,
0.5518983006477356,
0.19178631901741028,
-0.32805126905441284,
-0.9576221108436584,
0.19580323994159698,
-0.46995678544044495,
-0.48515284061431... |
func Writev(f *os.File, in [][]byte) (nw int, err error) {
iovec := make([]syscall.Iovec, len(in))
for i, slice := range in {
iovec[i] = syscall.Iovec{&slice[0], uint64(len(slice))}
}
nw, err = WritevRaw(uintptr(f.Fd()), iovec)
return
} | [
-0.6938864588737488,
0.18597738444805145,
0.6848058700561523,
0.1882862001657486,
0.5590223670005798,
-0.1042034700512886,
0.9398838877677917,
0.8392234444618225,
-0.17487189173698425,
0.027252783998847008,
-0.5829957127571106,
0.10818292945623398,
0.13268010318279266,
0.6228057146072388,
... |
func WritevRaw(fd uintptr, iovec []syscall.Iovec) (nw int, err error) {
nw_raw, _, errno := syscall.Syscall(syscall.SYS_WRITEV, fd, uintptr(unsafe.Pointer(&iovec[0])), uintptr(len(iovec)))
nw = int(nw_raw)
if errno != 0 {
err = errors.New(fmt.Sprintf("writev failed with error: %d", errno))
}
return
} | [
-1.2098256349563599,
-0.13142509758472443,
0.9394678473472595,
-0.12199632078409195,
-0.32264095544815063,
-0.5873847603797913,
0.8501747250556946,
-0.280103474855423,
-0.009490099735558033,
-0.25427141785621643,
-0.12170282751321793,
-0.0527680404484272,
0.0636528804898262,
0.595320343971... |
func (o *oomTrackerImpl) Clear(ctx context.Context) error {
return nil
} | [
-0.550563633441925,
-0.035624898970127106,
0.3546854555606842,
0.2792890667915344,
-0.195379376411438,
1.4552063941955566,
0.40682774782180786,
-1.4659982919692993,
0.5410733222961426,
-0.5098174810409546,
0.5195637345314026,
0.39983755350112915,
0.0645516961812973,
0.6131711602210999,
-... |
func FindConfig() (string, error) {
homePath := os.Getenv("HOME")
curPath, _ := os.Getwd()
roots := []string{homePath, curPath}
var files []os.FileInfo
var err error
for _, root := range roots {
files, err = ioutil.ReadDir(root)
if err != nil {
fmt.Println(err)
}
for _, f := range files {
if f.Name... | [
0.3381562829017639,
-0.6697890758514404,
1.070519208908081,
0.8132367730140686,
-0.11888930201530457,
-0.12917661666870117,
0.7160273194313049,
-0.06840984523296356,
-1.1735143661499023,
0.8698166608810425,
0.4953859746456146,
-0.40958473086357117,
-0.2506924867630005,
1.9585200548171997,
... |
func ParseConfig(fnm string) Config {
var config Config
configData, err := ioutil.ReadFile(fnm)
if err != nil {
fmt.Println("ERROR:", err)
}
err = yaml.Unmarshal(configData, &config)
if err != nil {
fmt.Println("ERROR:", err)
}
return config
} | [
0.2898748815059662,
-0.40544724464416504,
0.7692958116531372,
-0.4843771457672119,
-0.3960827589035034,
0.09061048924922943,
0.024677522480487823,
1.017410159111023,
-1.1485323905944824,
-0.0773739218711853,
0.20836670696735382,
0.2353571057319641,
0.5350379943847656,
0.6058812737464905,
... |
func CleanPath(s string) string {
r := strings.NewReplacer("/..", "", "\\..", "")
return r.Replace(s)
} | [
0.7748445868492126,
-1.2818565368652344,
0.22994181513786316,
0.5470771789550781,
-1.0161972045898438,
0.17761217057704926,
0.829952597618103,
-0.2982766628265381,
0.0631171464920044,
0.4305263161659241,
0.06249828264117241,
-0.046583257615566254,
-0.4118577837944031,
-0.3757131099700928,
... |
func AddRules(r lint.RuleRegistry) error {
return r.Register(
136,
httpBody,
httpMethod,
httpNameVariable,
httpParentVariable,
noPrepositions,
standardMethodsOnly,
uriSuffix,
verbNoun,
)
} | [
0.17829732596874237,
0.7831583023071289,
0.5729267597198486,
-0.14062276482582092,
0.444815456867218,
0.3476382791996002,
-0.3700588047504425,
-0.01123049482703209,
0.05427723750472069,
-0.5673291683197021,
-0.3955049216747284,
0.3594152331352234,
-1.1300565004348755,
1.222776174545288,
... |
func (parser *SpecParser) Parse(specText string, conceptDictionary *gauge.ConceptDictionary, specFile string) (*gauge.Specification, *ParseResult, error) {
tokens, errs := parser.GenerateTokens(specText, specFile)
spec, res, err := parser.CreateSpecification(tokens, conceptDictionary, specFile)
if err != nil {
ret... | [
0.435120165348053,
-0.4190024137496948,
0.40798646211624146,
-0.5348626375198364,
-0.3737834393978119,
0.09866698086261749,
0.17705775797367096,
0.42357054352760315,
-0.7353172898292542,
0.5525383353233337,
0.23280656337738037,
-0.5959457755088806,
-0.4128815233707428,
0.04851239174604416,... |
func (parser *SpecParser) ParseSpecText(specText string, specFile string) (*gauge.Specification, *ParseResult) {
tokens, errs := parser.GenerateTokens(specText, specFile)
spec, res := parser.createSpecification(tokens, specFile)
res.FileName = specFile
if len(errs) > 0 {
res.Ok = false
}
res.ParseErrors = appen... | [
0.4182819426059723,
-0.9581723809242249,
0.3010163903236389,
-0.5419080853462219,
-0.9326502680778503,
0.18452632427215576,
0.009474357590079308,
0.18301407992839813,
-0.4767937958240509,
0.936907947063446,
-0.5394513010978699,
-0.44588330388069153,
-0.45269232988357544,
-0.186065986752510... |
func (parser *SpecParser) CreateSpecification(tokens []*Token, conceptDictionary *gauge.ConceptDictionary, specFile string) (*gauge.Specification, *ParseResult, error) {
parser.conceptDictionary = conceptDictionary
specification, finalResult := parser.createSpecification(tokens, specFile)
if err := specification.Pro... | [
0.18480361998081207,
-0.43781164288520813,
0.4426474869251251,
-0.4229848384857178,
0.008855431340634823,
-0.0655735656619072,
0.059766072779893875,
0.5108874440193176,
-0.684963047504425,
0.8256201148033142,
-0.020292576402425766,
-0.8447681665420532,
-0.14517134428024292,
0.5578670501708... |
func CreateStepUsingLookup(stepToken *Token, lookup *gauge.ArgLookup, specFileName string) (*gauge.Step, *ParseResult) {
stepValue, argsType := extractStepValueAndParameterTypes(stepToken.Value)
if argsType != nil && len(argsType) != len(stepToken.Args) {
return nil, &ParseResult{ParseErrors: []ParseError{ParseErro... | [
-0.4114145040512085,
-0.4821985363960266,
0.633775532245636,
-0.3354685604572296,
0.2510157823562622,
-0.019819285720586777,
-0.20515230298042297,
0.20987564325332642,
-1.2898000478744507,
0.3679628372192383,
0.1170826405286789,
-0.35284218192100525,
0.16375823318958282,
0.5452945232391357... |
func init() {
// Up-converters
convert.RegisterConverter("0.1.0", supportedVersions, convertFrom02x)
convert.RegisterConverter("0.2.0", supportedVersions, convertFrom02x)
convert.RegisterConverter("0.3.0", supportedVersions, convertInternal)
convert.RegisterConverter("0.3.1", supportedVersions, convertInternal)
... | [
-1.0775221586227417,
-0.15630662441253662,
0.7637840509414673,
0.0984693393111229,
0.18468302488327026,
-0.005843265913426876,
-0.10706660896539688,
0.13601189851760864,
-0.5083624124526978,
-0.04888460412621498,
-0.9494338035583496,
-0.24088355898857117,
-0.010822958312928677,
0.291956394... |
func Int(v int) *int {
return &v
} | [
0.5303114652633667,
-0.2541566491127014,
-0.04597265645861626,
-1.4698021411895752,
-0.7667500972747803,
-0.0005155823309905827,
0.39185813069343567,
-0.33519917726516724,
0.5540379285812378,
-0.12793047726154327,
-0.028436576947569847,
1.4288197755813599,
0.3778587281703949,
-0.4789395332... |
func DefaultOptions(o *Options) {
o.MaxAttempts = DefaultMaxAttempts
o.DelayProvider = ConstantDelay(DefaultRetryDelay)
o.ShouldRetryProvider = func(_ error) bool { return true }
} | [
0.4053206741809845,
0.8744761943817139,
0.4601781666278839,
0.3762010633945465,
0.8382307291030884,
0.07749208807945251,
0.7109768390655518,
0.19389362633228302,
1.035172939300537,
-0.28763753175735474,
-0.6756078600883484,
-0.34179070591926575,
-0.6625236868858337,
-0.07492908090353012,
... |
func OptMaxAttempts(maxAttempts uint) Option {
return func(o *Options) { o.MaxAttempts = maxAttempts }
} | [
0.27149850130081177,
-0.33072784543037415,
0.36005768179893494,
-0.5227127075195312,
0.014631971716880798,
0.14746348559856415,
0.3679839074611664,
0.3401561677455902,
0.8213220238685608,
0.10219988226890564,
0.31282806396484375,
-0.12261701375246048,
0.025980887934565544,
0.13889473676681... |
func OptDelayProvider(delayProvider DelayProvider) Option {
return func(o *Options) { o.DelayProvider = delayProvider }
} | [
0.15298829972743988,
0.14983631670475006,
0.5328609943389893,
0.08004238456487656,
-0.3550833761692047,
1.314231514930725,
0.8678285479545593,
0.003655975917354226,
1.2837347984313965,
0.1508921980857849,
-0.5179823637008667,
-0.2611445486545563,
-0.057634081691503525,
-0.2687707543373108,... |
func OptConstantDelay(d time.Duration) Option {
return func(o *Options) { o.DelayProvider = ConstantDelay(d) }
} | [
0.012718903832137585,
0.4925145208835602,
0.5850128531455994,
-0.47990527749061584,
-0.20390324294567108,
1.3716977834701538,
-0.21487264335155487,
0.2619853913784027,
0.5346772074699402,
0.08689471334218979,
-0.2945602536201477,
0.16293613612651825,
0.6711732745170593,
0.17004887759685516... |
func OptExponentialBackoff(d time.Duration) Option {
return func(o *Options) { o.DelayProvider = ExponentialBackoff(d) }
} | [
0.17652170360088348,
0.3127530515193939,
0.3412744104862213,
-0.3916580080986023,
-0.786074697971344,
0.8278833627700806,
0.020076928660273552,
0.3125511109828949,
0.43276533484458923,
0.5597891211509705,
0.4535936415195465,
-0.2341354638338089,
0.2038303166627884,
-0.23454426229000092,
... |
func OptShouldRetryProvider(provider ShouldRetryProvider) Option {
return func(o *Options) { o.ShouldRetryProvider = provider }
} | [
-0.531967282295227,
0.03908104449510574,
0.4270736575126648,
0.09360884875059128,
0.22314903140068054,
1.0500737428665161,
0.2261192500591278,
-0.01594429276883602,
1.4650191068649292,
0.8182483315467834,
-0.7358254194259644,
0.6216302514076233,
0.6191554665565491,
-0.5193310976028442,
-... |
func TrailingSlashMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.String() != "/" {
r.URL.Path = strings.TrimSuffix(r.URL.Path, "/")
}
next.ServeHTTP(w, r)
})
} | [
0.8618294596672058,
-0.09588786214590073,
0.7367618083953857,
0.18667450547218323,
-0.6265885233879089,
0.34580737352371216,
0.09535466879606247,
0.4507255256175995,
0.3393719792366028,
-0.4719349443912506,
-0.39459869265556335,
0.08663739264011383,
-0.16494256258010864,
0.8038114905357361... |
func (c *Client) newHostgroup(hostgroup *Hostgroup) ([]byte, error) {
nagiosURL, err := c.buildURL("hostgroup", "POST", "", "", "", "")
if err != nil {
return nil, err
}
data := setURLParams(hostgroup)
body, err := c.post(data, nagiosURL)
if err != nil {
return nil, err
}
return body, nil
} | [
-0.5032311677932739,
0.7689181566238403,
0.3795830309391022,
0.5209625363349915,
-1.0095936059951782,
-0.37822845578193665,
-0.25519809126853943,
-0.3096016049385071,
-1.1389602422714233,
0.527241051197052,
-1.4160271883010864,
0.10194273293018341,
-1.4203969240188599,
1.556617259979248,
... |
func (a *App) getOrders(w http.ResponseWriter, r *http.Request) {
page, err := strconv.Atoi(r.URL.Query().Get("page"))
if err != nil {
helpers.RespondWithError(w, http.StatusBadRequest, "INVALID_PAGE_NUMBER")
return
}
limit, err := strconv.Atoi(r.URL.Query().Get("limit"))
if err != nil {
helpers.RespondWith... | [
-0.8437250256538391,
0.5094908475875854,
1.086984395980835,
0.07763500511646271,
0.9484507441520691,
-0.01747695729136467,
-0.417716383934021,
-0.30807048082351685,
0.03752348572015762,
0.27943429350852966,
0.9881191849708557,
0.18481376767158508,
-0.3489851951599121,
0.7373713850975037,
... |
func (a *App) createOrder(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
var trequest map[string][]string
err := decoder.Decode(&trequest)
if err != nil {
helpers.RespondWithError(w, http.StatusBadRequest, "INVALID_BODY")
return
}
origin := trequest["origin"]
if len(origin) == 0... | [
-0.6440716981887817,
-0.47028085589408875,
1.0431944131851196,
0.6245070695877075,
0.29989632964134216,
0.7417491674423218,
-0.7678313851356506,
0.17238256335258484,
-0.4878002405166626,
0.9254730939865112,
-0.28202372789382935,
-0.9260920882225037,
-0.19364964962005615,
0.8485194444656372... |
func (a *App) updateOrder(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id, err := strconv.Atoi(vars["id"])
if err != nil {
helpers.RespondWithError(w, http.StatusBadRequest, "INVALID_ORDER_ID")
return
}
decoder := json.NewDecoder(r.Body)
var trequest map[string]string
decerr := decoder.Deco... | [
-0.9985323548316956,
-0.8111259937286377,
0.7776949405670166,
0.5622977614402771,
0.02655402012169361,
-0.16669698059558868,
-0.4096907079219818,
0.022986089810729027,
0.1396971195936203,
0.5131334662437439,
-0.42723578214645386,
-0.06243867799639702,
-0.22307616472244263,
1.01582551002502... |
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } | [
0.0017501392867416143,
-0.48795756697654724,
0.11716366559267044,
0.41594451665878296,
-0.170012965798378,
-0.03253801167011261,
-0.6646475195884705,
0.6134193539619446,
0.6766958832740784,
-1.769515037536621,
-0.099466972053051,
-0.8924757242202759,
-0.0530250146985054,
0.1281633079051971... |
func (r *Resolver) Subscription() generated.SubscriptionResolver { return &subscriptionResolver{r} } | [
0.3154781460762024,
-0.6921377778053284,
0.11148623377084732,
0.7599321603775024,
-0.4622245728969574,
-0.13958702981472015,
-0.2094753533601761,
0.012252414599061012,
0.7208989262580872,
-1.8387863636016846,
-0.7991870045661926,
-0.682116687297821,
0.3739047348499298,
-0.15408647060394287... |
func (main) Main(diskpath string, forgetafter time.Duration) (circuit.XPerm, error) {
srv, err := New(diskpath, forgetafter)
if err != nil {
return nil, err
}
circuit.Daemonize(func() { <-(chan int)(nil) })
return circuit.PermRef(srv), nil
} | [
0.36486804485321045,
0.6716792583465576,
0.586470901966095,
0.23164010047912598,
-0.44286033511161804,
-0.2985699772834778,
-0.027851974591612816,
0.1553095430135727,
-0.47907814383506775,
0.4229200482368469,
0.6218291521072388,
0.6271306276321411,
-1.272566556930542,
-0.2859254777431488,
... |
func RegisterHandler(w http.ResponseWriter, r *http.Request) {
db := Connect()
defer db.Close()
account := &Account{
Key: uuid.NewV4().String(),
ConnectCode: ConnectCode(),
}
err := db.Insert(account)
if err != nil {
panic(err)
}
accountResponse := &AccountResponse{
AccountId: account.Id,
... | [
-0.5108224153518677,
0.26307108998298645,
0.6440940499305725,
-0.013605817221105099,
0.8389429450035095,
0.05136833339929581,
0.31668180227279663,
0.14100931584835052,
-0.11532893776893616,
0.1461864709854126,
-0.2129376381635666,
-0.669693112373352,
-0.7285303473472595,
0.2068360596895218... |
func ConnectHandler(w http.ResponseWriter, r *http.Request) {
db := Connect()
defer db.Close()
canAccess, account := ValidateAuth(db, r, w)
if !canAccess {
return
}
var args ConnectArguments
err := GetFromReq(w, r, &args)
if err != nil {
http.Error(w, "invalid request", http.StatusBadRequest)
return
}
... | [
-0.4930208623409271,
-0.22847557067871094,
0.805108904838562,
0.1342017948627472,
0.07662154734134674,
0.19236502051353455,
0.7841143608093262,
-0.3643788695335388,
0.3336394727230072,
0.36818698048591614,
0.7931526899337769,
-0.8637313842773438,
-0.43787193298339844,
0.7204717993736267,
... |
func DisconnectHandler(w http.ResponseWriter, r *http.Request) {
db := Connect()
defer db.Close()
canAccess, account := ValidateAuth(db, r, w)
if !canAccess {
return
}
err := UnlinkAnyConnection(db, account, 0)
if err != nil {
log.Printf("UnlinkAnyConnection failed: %s", err)
http.Error(w, "could not unl... | [
-0.5823508501052856,
-0.3977321684360504,
0.6994214653968811,
0.019058534875512123,
-0.18264363706111908,
-0.35230228304862976,
0.3134237229824066,
0.23511287569999695,
0.675422191619873,
0.5245019197463989,
0.5199723243713379,
-1.045098066329956,
-0.6334025859832764,
0.17053823173046112,
... |
func QueryHandler(w http.ResponseWriter, r *http.Request) {
db := Connect()
defer db.Close()
canAccess, account := ValidateAuth(db, r, w)
if !canAccess {
return
}
connection, err := GetConnection(db, account.Id)
if err != nil {
if isBadConn(err, false) {
panic(err);
return;
}
stateResponse := &St... | [
-0.057731758803129196,
-0.36106011271476746,
0.6930241584777832,
-0.3819515109062195,
-0.539772629737854,
0.29055801033973694,
-0.32078149914741516,
-0.30642610788345337,
0.41347187757492065,
0.5581455230712891,
0.5087173581123352,
-0.977550208568573,
-0.43962669372558594,
0.28569445013999... |
func AcceptHandler(w http.ResponseWriter, r *http.Request) {
db := Connect()
defer db.Close()
canAccess, actorAccount := ValidateAuth(db, r, w)
if !canAccess {
return
}
var args AcceptArguments
err := GetFromReq(w, r, &args)
if err != nil {
http.Error(w, "invalid request", http.StatusBadRequest)
return
... | [
-1.0717318058013916,
-0.523907482624054,
0.6097174882888794,
-0.43353888392448425,
-0.48310327529907227,
0.29704391956329346,
0.26972609758377075,
0.33175918459892273,
0.006913482211530209,
0.24211756885051727,
0.8439028859138489,
-0.6165739893913269,
-0.3943219482898712,
0.887981593608856... |
func SetPictureHandler(w http.ResponseWriter, r *http.Request) {
db := Connect()
defer db.Close()
canAccess, actorAccount := ValidateAuth(db, r, w)
if !canAccess {
return
}
// This was a previous attempt when we uploaded via a form (the Moya code in the iOS client still does this).
// However, on iOS, to use... | [
-0.1045425534248352,
-0.17342419922351837,
0.9854013919830322,
0.26499804854393005,
0.23844990134239197,
-0.017821403220295906,
0.7794345021247864,
-0.15313223004341125,
-0.031515933573246,
0.45037662982940674,
-0.453127920627594,
-0.28038787841796875,
-0.15874500572681427,
0.6947615146636... |
func BackgroundPtr() Ptr {
return backgroundPtr
} | [
1.6516817808151245,
-0.8142934441566467,
0.3681882917881012,
0.553848147392273,
-0.864661455154419,
0.9888983964920044,
0.4010608196258545,
-0.9367082715034485,
0.3572239875793457,
0.8024581074714661,
1.1643952131271362,
0.7094844579696655,
-1.8631768226623535,
-0.053464025259017944,
0.7... |
func TODOPtr() Ptr {
return todoPtr
} | [
-0.39475634694099426,
0.4308302104473114,
0.4883667528629303,
-0.602764904499054,
-0.5196122527122498,
0.1450064778327942,
0.2257612943649292,
-0.6819545030593872,
0.11145216226577759,
0.4214392602443695,
0.4350101053714752,
-0.7546999454498291,
-0.15452517569065094,
-1.160251498222351,
... |
func deepCopy(copy, orig interface{}) error {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
dec := gob.NewDecoder(&buf)
err := enc.Encode(orig)
if err != nil {
return err
}
return dec.Decode(copy)
} | [
0.04560485854744911,
0.10238849371671677,
0.7724844217300415,
0.6878513693809509,
-1.175723671913147,
0.25522860884666443,
-0.36680278182029724,
0.33328863978385925,
-0.5987383723258972,
0.6393642425537109,
-0.25533920526504517,
0.8861603736877441,
-0.7517009973526001,
-0.7563894987106323,... |
func shortCmd(ctx context.Context, operate op, alias, link string) (err error) {
s, err := newStore(conf.Store)
if err != nil {
err = fmt.Errorf("cannot create a new alias: %w", err)
return
}
defer s.Close()
defer func() {
if err != nil {
err = fmt.Errorf("cannot %v alias to data store: %w", operate, err... | [
0.4093886911869049,
-0.5677378177642822,
0.9243545532226562,
0.12007603049278259,
0.16233889758586884,
0.9253532290458679,
0.4284224808216095,
0.23811404407024384,
0.6307771801948547,
-0.3166274428367615,
0.37935391068458557,
0.4932147264480591,
0.6252431273460388,
0.3417561948299408,
0.... |
func (s *server) shortHandler(kind aliasKind) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
var err error
defer func() {
if err != nil {
// Just tell the user we could not find the record rather than
// throw 50x. The server should be able to... | [
-0.02560233324766159,
0.15863877534866333,
0.8152868747711182,
0.45681989192962646,
-0.47913500666618347,
0.6654752492904663,
0.5883941054344177,
0.08138963580131531,
0.6959761381149292,
0.1738772988319397,
1.225964903831482,
-0.08230795711278915,
0.601956844329834,
0.27811017632484436,
... |
func (s *server) checkdb(ctx context.Context, alias string) (string, error) {
raw, err := s.db.FetchAlias(ctx, alias)
if err != nil {
return "", err
}
c := arecord{}
err = json.Unmarshal(str2b(raw), &c)
if err != nil {
return "", err
}
return c.URL, nil
} | [
-0.6442714333534241,
0.7153419256210327,
0.7889222502708435,
0.036276206374168396,
-0.11679707467556,
0.6439570784568787,
-0.3436741232872009,
0.14389462769031525,
-0.010647010058164597,
1.2065273523330688,
0.7876598834991455,
0.6026216745376587,
-0.8241992592811584,
0.550630509853363,
0... |
func (s *server) checkvcs(ctx context.Context, alias string) (string, error) {
// construct the try path and make the request to vcs
repoPath := conf.X.RepoPath
if strings.HasSuffix(repoPath, "/*") {
repoPath = strings.TrimSuffix(repoPath, "/*")
}
tryPath := fmt.Sprintf("%s/%s", repoPath, alias)
resp, err := h... | [
-0.5320638418197632,
0.17748074233531952,
0.7180494070053101,
-0.42505568265914917,
-0.4018365442752838,
-0.0527840293943882,
-0.3860322833061218,
-0.5804597735404968,
0.4489631950855255,
0.3723151385784149,
0.5823938250541687,
0.03885572403669357,
-0.8095874786376953,
-0.1552010029554367,... |
func InitModels() {
// TODO: Use model tags to ensure indices/constraints.
index := mgo.Index{
Key: []string{"globalid"},
Unique: true,
}
db.EnsureIndex(mongoCollectionName, index)
// Index the logo collection
index = mgo.Index {
Key: []string{"globalid"},
Unique: true,
}
db.EnsureIndex(logoColle... | [
-0.7818197011947632,
0.6377982497215271,
0.4994880259037018,
0.08248821645975113,
0.8246933817863464,
0.5746989250183105,
0.6679656505584717,
-0.051128044724464417,
-0.5657531023025513,
0.3644566237926483,
-1.0262229442596436,
-0.678135335445404,
0.08083285391330719,
-0.16206181049346924,
... |
func getLogoCollection(session *mgo.Session) *mgo.Collection {
return db.GetCollection(session, logoCollectionName)
} | [
0.03271075710654259,
-0.4651639759540558,
0.41041362285614014,
-0.7441847920417786,
-0.678299069404602,
-0.5741912722587585,
-0.5012213587760925,
-1.0886415243148804,
0.32565632462501526,
0.17939193546772003,
-0.16353218257427216,
0.7526372671127319,
0.9620702862739563,
-0.3370246291160583... |
func getLast2FACollection(session *mgo.Session) *mgo.Collection {
return db.GetCollection(session, last2FACollectionName)
} | [
-0.5983323454856873,
-1.046204686164856,
0.529190719127655,
-0.29470786452293396,
0.005227015353739262,
-0.8938421607017517,
0.11562609672546387,
-0.8621206283569336,
-0.13182277977466583,
-0.5804119110107422,
-0.2743512690067291,
0.05385869741439819,
0.6972559094429016,
0.2979325354099273... |
func NewManager(r *http.Request) *Manager {
session := db.GetDBSession(r)
return &Manager{
session: session,
collection: getCollection(session),
}
} | [
-0.8720559477806091,
-0.8624379634857178,
0.2819921374320984,
0.41339999437332153,
-0.34779566526412964,
0.02836310677230358,
-0.452835351228714,
-0.6946936249732971,
0.8446143269538879,
-0.5851541757583618,
0.32723236083984375,
0.055530574172735214,
-0.16745518147945404,
1.687789916992187... |
func NewLogoManager(r *http.Request) *LogoManager {
session := db.GetDBSession(r)
return &LogoManager{
session: session,
collection: getLogoCollection(session),
}
} | [
-1.2143534421920776,
-1.1602569818496704,
0.1697060763835907,
-0.3547819256782532,
-0.8912405371665955,
-0.7580518126487732,
-1.2526044845581055,
-0.6680855751037598,
1.0690345764160156,
-0.4386202096939087,
-0.9737393260002136,
0.225664883852005,
-0.2005978226661682,
1.2872374057769775,
... |
func NewLast2FAManager(r *http.Request) *Last2FAManager {
session := db.GetDBSession(r)
return &Last2FAManager{
session: session,
collection: getLast2FACollection(session),
}
} | [
-1.2003345489501953,
-1.4920945167541504,
0.2858857214450836,
-0.10912948846817017,
-0.2299940437078476,
-0.8465184569358826,
-0.1434587985277176,
-0.3940940201282501,
0.4048798978328705,
-1.1531155109405518,
-0.6191023588180542,
0.019344152882695198,
0.31397318840026855,
1.213850259780883... |
func (m *Manager) GetOrganizations(organizationIDs []string) ([]Organization, error) {
var organizations []Organization
err := m.collection.Find(bson.M{"globalid": bson.M{"$in": organizationIDs}}).All(&organizations)
return organizations, err
} | [
-0.7990732789039612,
0.9602228999137878,
0.5189481377601624,
1.3160951137542725,
0.705806314945221,
0.46787798404693604,
0.33039140701293945,
-0.8773647546768188,
-0.3163827359676361,
0.8429021835327148,
0.7473357915878296,
0.22364766895771027,
-1.1908950805664062,
0.8812794089317322,
-0... |
func (m *Manager) IsOwner(globalID, username string) (isowner bool, err error) {
matches, err := m.collection.Find(bson.M{"globalid": globalID, "owners": username}).Count()
isowner = (matches > 0)
return
} | [
-0.7217530012130737,
-0.10638803243637085,
0.31190168857574463,
1.059653878211975,
-0.0032620213460177183,
0.6422908902168274,
0.6752710938453674,
0.3026670217514038,
-0.4394175410270691,
0.22075878083705902,
0.2254607230424881,
0.20976413786411285,
-1.208585262298584,
0.8009926080703735,
... |
func (m *Manager) IsMember(globalID, username string) (ismember bool, err error) {
matches, err := m.collection.Find(bson.M{"globalid": globalID, "members": username}).Count()
ismember = (matches > 0)
return
} | [
-0.4173876941204071,
0.0745057687163353,
0.15940707921981812,
0.3783710300922394,
0.34784048795700073,
0.6312664747238159,
-0.044890936464071274,
0.7470366954803467,
-0.21471716463565826,
0.41373100876808167,
-0.1374981552362442,
0.7819894552230835,
-2.0309009552001953,
0.7305535674095154,... |
func (m *Manager) AllByUser(username string) ([]Organization, error) {
var organizations []Organization
//TODO: handle this a bit smarter, select only the ones where the user is owner first, and take select only the org name
//do the same for the orgs where the username is member but not owners
//No need to pull in... | [
0.021042024716734886,
0.13368703424930573,
0.559290885925293,
1.036639928817749,
-0.3859316408634186,
0.15454648435115814,
0.34204021096229553,
0.2561338245868683,
-0.46934229135513306,
-0.14698655903339386,
0.23558926582336426,
-0.028128743171691895,
-0.17052976787090302,
0.86075288057327... |
func (m *Manager) Get(id string) (*Organization, error) {
var organization Organization
objectID := bson.ObjectIdHex(id)
if err := m.collection.FindId(objectID).One(&organization); err != nil {
return nil, err
}
return &organization, nil
} | [
-0.7337191700935364,
-0.12427142262458801,
0.3821216821670532,
0.12186579406261444,
0.7344970703125,
-0.022404661402106285,
-0.20656818151474,
-0.5717881917953491,
0.31025391817092896,
0.051983073353767395,
-0.146888867020607,
0.5376543402671814,
-0.18062390387058258,
-0.36950865387916565,... |
func (m *Manager) GetByName(globalID string) (organization *Organization, err error) {
err = m.collection.Find(bson.M{"globalid": globalID}).One(&organization)
return
} | [
0.10865181684494019,
0.7454907894134521,
0.3052748143672943,
-0.025477303192019463,
0.12820284068584442,
-0.23113517463207245,
0.6889461278915405,
-0.49399811029434204,
-0.5123552083969116,
0.8377470374107361,
-0.3653353452682495,
0.5452122092247009,
-1.1420005559921265,
0.0659013837575912... |
func (m *Manager) Exists(globalID string) bool {
count, _ := m.collection.Find(bson.M{"globalid": globalID}).Count()
return count == 1
} | [
-0.9256181716918945,
0.2619408369064331,
0.5131484866142273,
-0.4613664150238037,
0.659998893737793,
1.0653984546661377,
-0.2305431067943573,
0.3626566231250763,
-0.37248340249061584,
0.16021503508090973,
-0.5219394564628601,
-0.11005858331918716,
-1.2992563247680664,
1.0019402503967285,
... |
func (m *LogoManager) Exists(globalID string) bool {
count, _ := m.collection.Find(bson.M{"globalid": globalID}).Count()
return count == 1
} | [
-1.069629430770874,
0.11381582915782928,
0.5595411658287048,
-0.906620979309082,
0.30731886625289917,
0.6426506638526917,
-0.13175560534000397,
-0.06750918179750443,
-0.13915474712848663,
0.3205934166908264,
-0.6720255017280579,
0.016230342909693718,
-0.9014431834220886,
1.1128522157669067... |
func (m *Last2FAManager) Exists(globalID string, username string) bool {
condition := []interface{}{
bson.M{"globalid": globalID},
bson.M{"username": username},
}
count, _ := m.collection.Find(bson.M{"$and": condition}).Count()
return count == 1
} | [
-1.2091940641403198,
-0.05322545766830444,
0.5585670471191406,
0.2402283400297165,
0.42232227325439453,
0.3608003258705139,
0.2937625050544739,
0.9481785297393799,
-0.6156143546104431,
-0.05486322194337845,
-0.11044055223464966,
0.06007488816976547,
-0.904195249080658,
0.4244806170463562,
... |
func (m *Manager) Create(organization *Organization) error {
// TODO: Validation!
err := m.collection.Insert(organization)
if mgo.IsDup(err) {
return db.ErrDuplicate
}
return err
} | [
-0.9945344924926758,
0.7324931621551514,
0.44990429282188416,
0.9743698835372925,
0.652079701423645,
0.9359592795372009,
0.305433988571167,
-0.68097984790802,
-0.24920371174812317,
0.6724160313606262,
-0.30611276626586914,
-0.6634238958358765,
-0.4266945719718933,
0.790349543094635,
-0.3... |
func (m *LogoManager) Create(organization *Organization) error {
var orgLogo OrganizationLogo
orgLogo.Globalid = organization.Globalid
err := m.collection.Insert(orgLogo)
if mgo.IsDup(err) {
return db.ErrDuplicate
}
return err
} | [
-0.16029268503189087,
0.6811739802360535,
0.5300595164299011,
0.06835001707077026,
0.1730526089668274,
0.8531065583229065,
0.24370090663433075,
-0.6079509258270264,
-0.5286691784858704,
1.0032532215118408,
-0.705398678779602,
-0.4464118778705597,
-0.4310605525970459,
0.7868386507034302,
... |
func (m *Manager) SaveMember(organization *Organization, username string) error {
return m.collection.Update(
bson.M{"globalid": organization.Globalid},
bson.M{"$addToSet": bson.M{"members": username}})
} | [
-0.949930727481842,
0.28314611315727234,
0.20787788927555084,
0.17232683300971985,
0.4255809187889099,
1.4524363279342651,
0.2590881586074829,
0.5876874327659607,
-0.723686695098877,
1.2182285785675049,
-1.4315528869628906,
0.3068539798259735,
-1.7954821586608887,
0.5487722754478455,
1.2... |
func (m *Manager) SaveOwner(organization *Organization, owner string) error {
return m.collection.Update(
bson.M{"globalid": organization.Globalid},
bson.M{"$addToSet": bson.M{"owners": owner}})
} | [
-0.7337549924850464,
-0.2123788446187973,
0.4632159471511841,
0.6738455891609192,
0.3402518033981323,
0.8648021817207336,
0.4294954538345337,
0.2612951993942261,
-0.44263070821762085,
0.9788690209388733,
-1.0742853879928589,
0.008338987827301025,
-0.9489875435829163,
0.5290201306343079,
... |
func (m *Manager) Remove(globalid string) error {
return m.collection.Remove(bson.M{"globalid": globalid})
} | [
-0.3569725751876831,
0.5756983160972595,
0.07966217398643494,
-0.1406506448984146,
-0.6626209020614624,
0.9635034799575806,
0.3713698983192444,
0.8176944255828857,
-0.3124142289161682,
0.8713783025741577,
-0.6237155795097351,
0.1930195391178131,
-2.185098171234131,
0.9999417662620544,
0.... |
func (m *LogoManager) Remove(globalid string) error {
return m.collection.Remove(bson.M{"globalid": globalid})
} | [
-0.420208215713501,
0.3390747606754303,
0.22785048186779022,
-0.4893759787082672,
-1.169414758682251,
0.5956129431724548,
0.41185933351516724,
0.410997211933136,
0.022785339504480362,
0.8497666716575623,
-0.6099328398704529,
0.27722394466400146,
-1.6062320470809937,
1.0159356594085693,
0... |
func (m *Last2FAManager) RemoveByOrganization(globalid string) error {
_, err := m.collection.RemoveAll(bson.M{"globalid": globalid})
return err
} | [
-0.7033859491348267,
0.015359466895461082,
0.42869383096694946,
0.1577932983636856,
0.004833810962736607,
-0.280842661857605,
1.4953887462615967,
0.39083588123321533,
-0.3049231767654419,
0.8227672576904297,
-0.8217883706092834,
-0.3532331883907318,
-1.0033921003341675,
0.34946441650390625... |
func (m *Last2FAManager) RemoveByUser(username string) error {
_, err := m.collection.RemoveAll(bson.M{"username": username})
return err
} | [
-0.9267163276672363,
0.09371466189622879,
0.4064425826072693,
0.16634050011634827,
-0.7779468894004822,
-0.4307483732700348,
1.5626152753829956,
0.7783078551292419,
-0.7500637769699097,
-0.34841662645339966,
-1.3512464761734009,
-0.44552746415138245,
-0.9629546999931335,
0.1317635327577591... |
func (m *Manager) UpdateMembership(globalid string, username string, oldrole string, newrole string) error {
qry := bson.M{"globalid": globalid}
pull := bson.M{
"$pull": bson.M{oldrole: username},
}
push := bson.M{
"$addToSet": bson.M{newrole: username},
}
err := m.collection.Update(qry, pull)
if err != nil ... | [
-1.1061193943023682,
-0.721973717212677,
0.5809919238090515,
-0.30357375741004944,
0.028934603556990623,
0.6982260942459106,
-0.1998058706521988,
0.5533413290977478,
-0.16890475153923035,
1.5998941659927368,
0.035492055118083954,
-0.09477140754461288,
-1.0486174821853638,
0.032384548336267... |
func (m *Manager) CountByUser(username string) (int, error) {
qry := bson.M{"owners": username}
return m.collection.Find(qry).Count()
} | [
-0.22179479897022247,
0.29020124673843384,
0.48585423827171326,
0.3400154113769531,
-0.35054945945739746,
0.3260788321495056,
1.296439290046692,
-0.10960187017917633,
-1.246364951133728,
-0.2663003206253052,
-0.9321786761283875,
-0.44604647159576416,
-0.48349130153656006,
0.530140578746795... |
func (m *Manager) RemoveUser(globalId string, username string) error {
qry := bson.M{"globalid": globalId}
update := bson.M{"$pull": bson.M{"owners": username, "members": username}}
return m.collection.Update(qry, update)
} | [
-1.0800951719284058,
-0.07867290824651718,
0.2422419786453247,
0.28312060236930847,
-0.04218430072069168,
0.7254769206047058,
0.2861502170562744,
0.8736381530761719,
-0.4381103217601776,
0.046341899782419205,
-0.5643875598907471,
-0.07593080401420593,
-1.4913413524627686,
-0.15029636025428... |
func (m *Manager) GetValidity(globalId string) (int, error) {
var org *Organization
err := m.collection.Find(bson.M{"globalid": globalId}).One(&org)
seconds := org.SecondsValidity
if seconds == -1 { //special value to avoid confusion with mongo null
return 0, err
} else if seconds == 0 { //mongo null for i... | [
-0.019099438562989235,
0.6765922904014587,
0.8350094556808472,
0.6130905747413635,
0.6259196996688843,
-0.10519757866859436,
0.5066933035850525,
-0.05062928795814514,
-0.07566484808921814,
0.6299693584442139,
0.023563651368021965,
0.13509801030158997,
-1.1225541830062866,
0.73610520362854,... |
func (m *LogoManager) SaveLogo(globalId string, logo string) (*mgo.ChangeInfo, error) {
return m.collection.Upsert(
bson.M{"globalid": globalId},
bson.M{"$set": bson.M{"logo": logo}})
} | [
-0.11526694893836975,
0.27281782031059265,
0.6157873868942261,
-0.16075043380260468,
-0.21983252465724945,
0.665738046169281,
-0.1372121125459671,
0.48239225149154663,
-0.5975490808486938,
1.5216854810714722,
-2.0420114994049072,
-0.3386819660663605,
-0.8166576623916626,
0.5369225740432739... |
func(m *LogoManager) GetLogo(globalId string) (string, error) {
var org *OrganizationLogo
err := m.collection.Find(bson.M{"globalid": globalId}).One(&org)
if err != nil {
return "", err
}
return org.Logo, err
} | [
0.44357752799987793,
0.7528371810913086,
0.5189828276634216,
0.35688111186027527,
-0.16465537250041962,
0.4602009654045105,
0.5254152417182922,
-0.325501024723053,
-0.3835819363594055,
1.0995373725891113,
-0.3036738932132721,
0.03999599069356918,
-0.41842547059059143,
0.6229762434959412,
... |
func (m *LogoManager) RemoveLogo(globalId string) error {
qry := bson.M{"globalid": globalId}
update := bson.M{"$unset": bson.M{"logo": 1}}
return m.collection.Update(qry, update)
} | [
-0.0077701760455966,
0.3305492699146271,
0.34048736095428467,
-0.10558097064495087,
-0.9424583911895752,
0.2884860336780548,
0.6865649819374084,
1.059597134590149,
-0.504067599773407,
1.0628924369812012,
-0.865605890750885,
-0.14039601385593414,
-0.8003360033035278,
0.4810331463813782,
0... |
func (m *Last2FAManager) SetLast2FA(globalId string, username string) error {
now := time.Now()
condition := []interface{}{
bson.M{"globalid": globalId},
bson.M{"username": username},
}
_, err := m.collection.Upsert(
bson.M{"$and": condition},
bson.M{"$set": bson.M{"last2fa": now}})
return err
} | [
-1.3645579814910889,
-0.5109002590179443,
0.7649520039558411,
-0.3299406170845032,
0.015953196212649345,
0.21053418517112732,
0.8255693316459656,
0.447176992893219,
-0.8315865993499756,
0.5437269806861877,
-1.122755765914917,
0.014730146154761314,
-0.9586014747619629,
0.3217334747314453,
... |
func (m *Last2FAManager) GetLast2FA(globalId string, username string) (db.DateTime, error) {
var l2fa *UserLast2FALogin
condition := []interface{}{
bson.M{"globalid": globalId},
bson.M{"username": username},
}
err := m.collection.Find(bson.M{"$and": condition}).One(&l2fa)
return l2fa.Last2FA, err
} | [
-0.7384370565414429,
-0.6200780272483826,
0.7220346927642822,
0.14691831171512604,
-0.40342167019844055,
-0.270192414522171,
0.16506367921829224,
-0.025466520339250565,
-0.7094585299491882,
-0.07393654435873032,
-0.26272526383399963,
0.7016609907150269,
-0.9072343111038208,
0.2204595357179... |
func (m *Last2FAManager) RemoveLast2FA(globalId string, username string) error {
condition := []interface{}{
bson.M{"globalid": globalId},
bson.M{"username": username},
}
return m.collection.Remove(bson.M{"$and": condition})
} | [
-1.276878833770752,
-0.7962654232978821,
0.47568947076797485,
-0.184038445353508,
-1.0061488151550293,
-0.027285946533083916,
0.574252724647522,
1.2948824167251587,
-0.6958979964256287,
0.30764079093933105,
-0.4630458652973175,
0.2021137923002243,
-1.4102100133895874,
0.0748705342411995,
... |
func JoinModelExternalRef(model interface{}) func(*gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
mScope := db.NewScope(model)
quotedTableName := mScope.QuotedTableName()
joinField, ok := mScope.FieldByName("ExternalReferences")
if !ok {
panic("ExternalReferences field not found")
}
if joinFi... | [
-0.5300611853599548,
-0.18582651019096375,
0.8504543900489807,
-0.3921715021133423,
-0.784313440322876,
0.8043097257614136,
0.14605197310447693,
-0.16989709436893463,
-0.5223482847213745,
0.913576066493988,
-0.0035829241387546062,
-0.23896922171115875,
-0.6581864953041077,
0.20899094641208... |
func GetModelByExternalRef(db *gorm.DB, service, identifier string, out interface{}) (bool, error) {
err := db.Scopes(JoinModelExternalRef(out)).
Where("er.service = ? AND er.identifier = ?", service, identifier).
Take(out).Error
return commaOkGORMErr(err)
} | [
-0.6687260866165161,
0.08736288547515869,
0.5677667260169983,
-0.06390044093132019,
-0.4829114079475403,
0.9246559739112854,
-0.5076487064361572,
-0.01205828320235014,
-0.1639043241739273,
0.7472873330116272,
0.09764769673347473,
0.4493461549282074,
-0.5513182878494263,
0.31712061166763306... |
func GetModelByExternalRefs(db *gorm.DB, out interface{}, refs []ExternalRef) (bool, error) {
db = db.Scopes(JoinModelExternalRef(out))
for _, ref := range refs {
err := db.Take(out, "er.service = ? AND er.identifier = ?", ref.Service, ref.Identifier).Error
if err == nil {
return true, nil
} else if gorm.Is... | [
-0.8609455823898315,
0.3300186097621918,
0.8676950335502625,
-0.19223178923130035,
-0.01038929633796215,
0.9274376630783081,
-0.39415839314460754,
-0.15824353694915771,
-0.4103259742259979,
0.2808796465396881,
0.537358820438385,
-0.2889927923679352,
-0.8686694502830505,
0.37307652831077576... |
func GetPermittedMethods(cert *x509.Certificate) (map[string]struct{}, error) {
return getPermittedMethods(cert)
} | [
-0.19740363955497742,
0.44632282853126526,
0.5580214858055115,
1.4032918214797974,
-1.0232445001602173,
-0.07005459815263748,
0.05224115028977394,
-0.6578105688095093,
0.18537744879722595,
-0.04919388145208359,
-0.4391185939311981,
0.09505210071802139,
-0.5944387912750244,
0.19077147543430... |
func GetUsername(cert *x509.Certificate) (string, error) {
return getUsername(cert)
} | [
0.023606175556778908,
0.22738519310951233,
0.3736255168914795,
1.8020066022872925,
-0.9104304909706116,
-0.29338812828063965,
-0.1371086984872818,
-0.32665833830833435,
-0.20414870977401733,
0.6039771437644958,
-0.7081965208053589,
0.031231088563799858,
0.11161385476589203,
-0.009514781646... |
func Info() VersionInfo {
return VersionInfo{
Version: version,
GoVersion: goVersion,
Commit: commit,
BuildDate: buildDate,
}
} | [
0.19900986552238464,
-1.1414344310760498,
0.022675251588225365,
0.23113735020160675,
-0.3651563227176666,
0.5411874055862427,
-0.40211185812950134,
-0.16431869566440582,
-0.9255113005638123,
0.2477722465991974,
-1.3371859788894653,
0.16788750886917114,
0.15586261451244354,
0.67655903100967... |
func FanOut3[A any, B any, C any](
a func() (A, error),
b func() (B, error),
c func() (C, error),
) (A, B, C, error) {
ch1 := lo.Async2(a)
ch2 := lo.Async2(b)
ch3 := lo.Async2(c)
var zero1 A
var zero2 B
var zero3 C
r1, err := (<-ch1).Unpack()
if err != nil {
return zero1, zero2, zero3, err
}
r2, err :=... | [
0.4359145760536194,
0.32883724570274353,
0.8294544219970703,
0.36598214507102966,
-0.07682161778211594,
-0.46854084730148315,
-0.1412600427865982,
0.029119083657860756,
-0.3653254508972168,
-0.14612479507923126,
-0.8080365061759949,
-0.4487060308456421,
-0.8248513340950012,
-0.308652520179... |
func (ma *MessageAccumulator) WithPrefix(format string, args ...interface{}) *MessageAccumulator {
ma.initialize()
return &MessageAccumulator{
msgs: ma.msgs,
prefix: ma.prefix + fmt.Sprintf(format, args...),
}
} | [
0.5326294898986816,
-0.3348667025566101,
0.5450243353843689,
-0.563556432723999,
-0.3396850526332855,
-0.8880428075790405,
-0.2325742095708847,
-0.6510747075080872,
0.2906818985939026,
-0.8691530227661133,
0.9775601625442505,
1.0795137882232666,
1.1875237226486206,
1.0635167360305786,
0.... |
func (ma *MessageAccumulator) Add(msg string) {
ma.initialize()
*ma.msgs = append(*ma.msgs, ma.prefix+msg)
} | [
0.5427199602127075,
0.24577277898788452,
0.4492388665676117,
-0.729148805141449,
0.07210838049650192,
0.04365000128746033,
0.1364918351173401,
-0.003912137821316719,
0.9630392789840698,
-1.1492170095443726,
0.7890079617500305,
0.9834387302398682,
-0.16751636564731598,
1.7024246454238892,
... |
func (ma *MessageAccumulator) Addf(format string, args ...interface{}) {
ma.Add(fmt.Sprintf(format, args...))
} | [
0.7572911977767944,
0.22218452394008636,
0.571853756904602,
0.13246291875839233,
0.604351818561554,
-0.006074387114495039,
-0.044076692312955856,
-0.01544476579874754,
-0.38763943314552307,
-1.2944471836090088,
1.0834400653839111,
0.4631522595882416,
0.44249966740608215,
1.2355549335479736... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.