text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (buf *Buffer) oldestLiveLease() (oldest *Batch) {
for lb := range buf.liveLeases {
if oldest == nil || lb.id < oldest.id {
oldest = lb
}
}
return
} | [
1.6653434038162231,
-1.9287960529327393,
0.5335183143615723,
-0.5003897547721863,
0.11705505102872849,
-0.11574263870716095,
-0.8993322849273682,
-0.09261777997016907,
0.09110777825117111,
-0.9458540081977844,
-0.18082962930202484,
0.1252351701259613,
-0.6598281860351562,
1.033302664756775... |
func (buf *Buffer) dropOldest() (dropped *Batch) {
unleased, unleasedIdx := buf.unleased.Oldest()
leased := buf.oldestLiveLease()
switch {
case unleased != nil && (leased == nil || unleased.id < leased.id):
buf.unleased.RemoveAt(unleasedIdx)
buf.stats.del(unleased, categoryUnleased)
return unleased
case le... | [
0.8246600031852722,
-0.9740248918533325,
0.7206442356109619,
-0.6109883189201355,
0.23968172073364258,
0.4102762043476105,
-0.20225125551223755,
-0.49524036049842834,
-0.17409271001815796,
-0.6774994730949402,
-0.036201585084199905,
0.20164498686790466,
-0.4049285352230072,
0.2509971559047... |
func (buf *Buffer) AddNoBlock(now time.Time, item any, itemSize int) (dropped *Batch, err error) {
if err = buf.opts.checkItemSize(itemSize); err != nil {
return
}
okToInsert, dropBatch := buf.opts.FullBehavior.ComputeState(buf.stats)
if !okToInsert {
return nil, ErrBufferFull
}
// All error checks done above... | [
-0.17313483357429504,
0.3054312765598297,
1.0147390365600586,
-0.26433444023132324,
0.08538016676902771,
-0.0560087226331234,
0.42289209365844727,
-0.5225851535797119,
0.44965869188308716,
-0.8275172710418701,
-0.5140218138694763,
0.3224479854106903,
-0.23519006371498108,
0.438786894083023... |
func (buf *Buffer) Flush(now time.Time) {
batch := buf.currentBatch
if batch == nil {
return
}
batch.nextSend = now // immediately make available to send
buf.unleased.PushBatch(batch)
buf.batchItemsGuess.record(batch.countedItems)
buf.currentBatch = nil
return
} | [
0.3222249448299408,
-0.49800577759742737,
0.3048856556415558,
-0.22209608554840088,
0.6605637669563293,
0.6165939569473267,
0.4744819104671478,
0.2722128927707672,
-0.9100670218467712,
-1.1056456565856934,
-0.9158421158790588,
1.0454496145248413,
-0.13840164244174957,
1.627021074295044,
... |
func (buf *Buffer) NextSendTime() time.Time {
ret := time.Time{}
if next := buf.unleased.Peek(); next != nil {
ret = next.nextSend
}
if buf.currentBatch != nil {
if ns := buf.currentBatch.nextSend; ret.IsZero() || ns.Before(ret) {
ret = ns
}
}
return ret
} | [
0.01555238664150238,
-0.010928020812571049,
0.6788753867149353,
-0.24998454749584198,
-1.5132325887680054,
0.17622247338294983,
-0.5438594222068787,
-0.5546042919158936,
0.18603366613388062,
0.22531363368034363,
-0.49998190999031067,
0.08633861690759659,
-1.250523328781128,
1.5598168373107... |
func (buf *Buffer) Stats() Stats {
return buf.stats
} | [
0.4267854690551758,
-0.7207051515579224,
0.08423247933387756,
-0.5841148495674133,
0.5703972578048706,
0.14159834384918213,
0.10843132436275482,
-1.2789751291275024,
0.7128021121025085,
-1.729390025138855,
-0.9039245247840881,
0.31840890645980835,
-0.5607625246047974,
0.1823725402355194,
... |
func (buf *Buffer) CanAddItem() bool {
okToInsert, _ := buf.opts.FullBehavior.ComputeState(buf.stats)
return okToInsert
} | [
0.34698909521102905,
0.24081917107105255,
0.5008291006088257,
0.8267207741737366,
-0.1187998577952385,
1.3959460258483887,
0.867081880569458,
-0.27124762535095215,
-0.37160390615463257,
-0.2577105462551117,
-0.1309863030910492,
0.012328175827860832,
-0.7978439331054688,
0.4819977879524231,... |
func (buf *Buffer) LeaseOne(now time.Time) (leased *Batch) {
cur, next := buf.currentBatch, buf.unleased.Peek()
switch {
case len(buf.unAckedLeases) == int(buf.opts.MaxLeases):
// too many outstanding leases
return
case next != nil && !now.Before(next.nextSend):
// next unleased batch is fine to use
case ... | [
0.12950360774993896,
-0.014081569388508797,
0.8754032850265503,
-0.3408641517162323,
-0.4538671672344208,
0.42849740386009216,
-0.2531941831111908,
0.5051780343055725,
-0.07975860685110092,
-0.2595337927341461,
-0.4776826500892639,
-0.1714898645877838,
-0.605198860168457,
0.829557895660400... |
func (buf *Buffer) forceLeaseOne() (leased *Batch) {
if buf.unleased.Len() == 0 {
return nil
}
leased = buf.unleased.PopBatch()
buf.unAckedLeases[leased] = struct{}{}
buf.liveLeases[leased] = struct{}{}
buf.stats.mv(leased, categoryUnleased, categoryLeased)
return
} | [
0.477394163608551,
0.08231757581233978,
0.6258509755134583,
-0.35635095834732056,
0.84217369556427,
0.10882584005594254,
-0.23694883286952972,
0.018761534243822098,
-0.13499248027801514,
-0.3601688742637634,
-0.9097172021865845,
0.1802160143852234,
-0.25256237387657166,
0.7820895314216614,... |
func (buf *Buffer) ForceLeaseAll() []*Batch {
if buf.unleased.Len() == 0 {
return nil
}
ret := make([]*Batch, 0, buf.unleased.Len())
for buf.unleased.Len() > 0 {
ret = append(ret, buf.forceLeaseOne())
}
return ret
} | [
0.682043731212616,
-0.5042662024497986,
0.5539186000823975,
0.7160799503326416,
0.7965347170829773,
0.10655132681131363,
-0.734091579914093,
-0.20182739198207855,
0.4837557077407837,
-0.562562108039856,
-0.6572396755218506,
0.5739830136299133,
-0.8166331052780151,
1.9168717861175537,
0.0... |
func (buf *Buffer) ACK(leased *Batch) {
buf.removeLease(leased)
} | [
1.5259075164794922,
-0.6835441589355469,
0.32823067903518677,
-0.2589312493801117,
-0.34027808904647827,
1.1271817684173584,
0.8433972001075745,
1.137640357017517,
-0.19874313473701477,
0.21793442964553833,
-0.610374927520752,
0.9409373998641968,
0.3061080873012543,
0.5719987750053406,
-... |
func (buf *Buffer) NACK(ctx context.Context, err error, leased *Batch) {
if live := buf.removeLease(leased); !live {
return
}
// TODO(iannucci): decouple retry from context (pass in 'now' instead)
switch toWait := leased.retry.Next(ctx, err); {
case toWait == retry.Stop:
return
default:
leased.nextSend = c... | [
0.6085678935050964,
-0.039510056376457214,
0.47344887256622314,
-0.06460674852132797,
0.005146161653101444,
0.47639402747154236,
0.781893789768219,
-0.28584232926368713,
0.005939214024692774,
-0.23482434451580048,
-0.19341818988323212,
0.36748284101486206,
0.46607306599617004,
0.5231179594... |
func (rtte *RichTextTypeEnum) SetValue(s string) {
if rtte != nil {
*rtte = RichTextTypeEnum(s)
}
} | [
-0.316022664308548,
0.08614178001880646,
0.38099271059036255,
-0.09181591123342514,
0.5039353370666504,
-0.014176073484122753,
0.5044518709182739,
-0.1253957599401474,
0.7226506471633911,
0.6841199398040771,
-0.9377638697624207,
-0.016898268833756447,
-0.43975552916526794,
0.45482501387596... |
func (rtte *RichTextTypeEnum) IsValidEnum() bool {
return rtte != nil && isValidEnum(string(*rtte), RichTextTypeEnumText, RichTextTypeEnumMention, RichTextTypeEnumEquation)
} | [
-0.7658633589744568,
-0.8833985924720764,
0.4493862986564636,
0.30622902512550354,
0.29135650396347046,
-0.4466744363307953,
0.5764499306678772,
-0.6086013913154602,
1.0789504051208496,
-0.3531259000301361,
-0.883566677570343,
-0.30083712935447693,
-0.8478640913963318,
0.3126146197319031,
... |
func (rtte *RichTextTypeEnum) UnmarshalJSON(b []byte) error {
return unmarshalEnum(b, rtte)
} | [
-0.8117906451225281,
-0.1747003048658371,
0.3626039922237396,
-1.234902262687683,
-0.10039955377578735,
-0.1907871812582016,
0.848107099533081,
0.05075819790363312,
0.032588984817266464,
0.4947263300418854,
-1.536952018737793,
-0.031059833243489265,
-1.106545090675354,
0.2607617974281311,
... |
func (ace *AnnotationColorEnum) SetValue(s string) {
if ace != nil {
*ace = AnnotationColorEnum(s)
}
} | [
-0.3562149703502655,
0.33193811774253845,
0.3159938156604767,
-0.03113412670791149,
0.6146045327186584,
0.564814031124115,
0.39470383524894714,
0.2993597984313965,
0.5430581569671631,
0.7234060168266296,
-0.2719048261642456,
0.4061000943183899,
0.44624075293540955,
0.8786142468452454,
0.... |
func (ace *AnnotationColorEnum) IsValidEnum() bool {
return ace != nil && isValidEnum(string(*ace), AnnotationColorEnumDefault,
AnnotationColorEnumGray,
AnnotationColorEnumBrown,
AnnotationColorEnumOrange,
AnnotationColorEnumYellow,
AnnotationColorEnumGreen,
AnnotationColorEnumBlue,
AnnotationColorEnumPu... | [
-0.45064374804496765,
-0.3697284162044525,
0.8393985629081726,
-0.6194506287574768,
0.5968685150146484,
-0.3236028552055359,
0.6303059458732605,
0.19099557399749756,
1.6065008640289307,
-0.6746561527252197,
-0.5110556483268738,
0.18808463215827942,
0.13055238127708435,
0.8332929015159607,
... |
func (ace *AnnotationColorEnum) UnmarshalJSON(b []byte) error {
return unmarshalEnum(b, ace)
} | [
-1.198724627494812,
-0.0726962462067604,
0.23817569017410278,
-1.0237057209014893,
-0.22806386649608612,
0.020082101225852966,
0.5704402923583984,
-0.18728603422641754,
0.1030784547328949,
0.556331217288971,
-0.5128738284111023,
0.2704324424266815,
-0.10445474088191986,
0.9185686707496643,... |
func (t *Text) GetURL() *url.URL {
if t == nil || t.Link == nil {
return nil
}
u := url.URL(t.Link.URL)
return &u
} | [
0.6971114873886108,
-0.2438056915998459,
0.14415669441223145,
0.2722598612308502,
-0.29083025455474854,
-0.32714566588401794,
0.3026871681213379,
1.3966306447982788,
0.7734505534172058,
-0.42696303129196167,
0.17137262225151062,
0.049021098762750626,
-0.5978270173072815,
-0.028229596093297... |
func (l *Link) MarshalJSON() ([]byte, error) {
if l == nil {
return nil, nil
}
return json.Marshal(map[string]interface{}{
"type": "url",
"url": l.URL,
})
} | [
-0.39697232842445374,
0.047891706228256226,
0.1425965428352356,
-0.28850477933883667,
0.31927385926246643,
-0.23109954595565796,
0.06913034617900848,
1.09898042678833,
0.8359832763671875,
-0.9802809357643127,
-0.877589762210846,
1.220536470413208,
-0.3562605679035187,
1.0728520154953003,
... |
func (mte *MentionTypeEnum) SetValue(s string) {
if mte != nil {
*mte = MentionTypeEnum(s)
}
} | [
-0.2206788808107376,
0.08093052357435226,
0.5568030476570129,
0.2113853543996811,
0.7997053265571594,
0.6095957159996033,
0.3032870292663574,
0.13344545662403107,
0.10130465030670166,
0.8336807489395142,
0.04419761523604393,
0.25825023651123047,
-0.4190853238105774,
1.2525705099105835,
0... |
func (mte *MentionTypeEnum) IsValidEnum() bool {
return mte != nil && isValidEnum(string(*mte), MentionTypeEnumUser, MentionTypeEnumPage, MentionTypeEnumDatabase, MentionTypeEnumData)
} | [
-0.7649179100990295,
-0.5345250368118286,
0.44336265325546265,
0.689186155796051,
0.7074282765388489,
0.14518122375011444,
0.6680425405502319,
0.06033775955438614,
0.6841474771499634,
-0.26848888397216797,
-0.31169769167900085,
0.22493427991867065,
-0.9761837124824524,
1.0168201923370361,
... |
func (mte *MentionTypeEnum) UnmarshalJSON(b []byte) error {
return unmarshalEnum(b, mte)
} | [
-0.7980082035064697,
0.0057349661365151405,
0.5541171431541443,
-0.9616294503211975,
0.13415667414665222,
0.16093091666698456,
0.7605470418930054,
0.0827602967619896,
-0.08370689302682877,
0.6264832615852356,
-0.543543815612793,
0.13229511678218842,
-0.7440806031227112,
1.305528163909912,
... |
func (m *mention) getType() string {
if m == nil {
return ""
}
return string(m.Type)
} | [
0.8635922074317932,
0.2960803210735321,
0.21632641553878784,
0.5022035837173462,
1.3557043075561523,
0.2285442054271698,
0.4402061700820923,
-0.5799513459205627,
0.6088860034942627,
0.2608392834663391,
0.6727221608161926,
0.5436075329780579,
-1.5960185527801514,
0.9352453947067261,
0.918... |
func (m *mention) fieldsToExpand() []string {
return []string{"user", "id", "date"}
} | [
-0.36955806612968445,
0.6539202332496643,
0.5210344195365906,
-0.9407289624214172,
0.5890215039253235,
0.9963645935058594,
-0.11192575842142105,
-0.12929831445217133,
0.3146510124206543,
-0.20836390554904938,
-0.12447918951511383,
0.4352584779262543,
-0.8793221712112427,
0.0438052564859390... |
func (m *Mention) UnmarshalJSON(b []byte) error {
mm := new(mention)
if err := unmarshalJSONFlattenByType(b, mm); err != nil {
return err
}
*m = Mention(*mm)
return nil
} | [
0.16633695363998413,
-0.7336448431015015,
0.5645991563796997,
-0.5926080942153931,
-0.0974128246307373,
0.05329722538590431,
0.7752467393875122,
0.13886351883411407,
0.3684598207473755,
1.102888584136963,
-0.24387265741825104,
0.7438614368438721,
-1.3181716203689575,
1.3915901184082031,
... |
func (m *Mention) MarshalJSON() ([]byte, error) {
mm := mention(*m)
return marshalJSONExpandByType(&mm)
} | [
0.353403776884079,
-0.6979588866233826,
0.3661923408508301,
0.49987801909446716,
-0.34047383069992065,
-0.009946009144186974,
0.23613303899765015,
0.011678551323711872,
0.8852996230125427,
0.8053085207939148,
-0.14635957777500153,
1.3152111768722534,
-1.0438117980957031,
1.2877943515777588... |
func getRepo(repos []config.Repository, repoName string) (config.Repository, bool) {
for _, repo := range repos {
if repo.Name == repoName {
return repo, true
}
}
return config.Repository{}, false
} | [
-0.24321402609348297,
0.881385326385498,
0.5446121692657471,
0.4197826087474823,
-0.07532041519880295,
-0.9035032987594604,
-0.8837888836860657,
0.4606572389602661,
0.184456005692482,
0.6298949718475342,
-0.36665427684783936,
-0.5455725789070129,
-0.0720505490899086,
-0.5474838018417358,
... |
func matchHook(data *domain.Data, hook config.Hook) (bool, error) {
if hook.If.Empty() {
return true, nil
}
return hook.If.Run(data.Convert()) //nolint:wrapcheck
} | [
0.14596904814243317,
0.636203408241272,
0.5619184374809265,
0.5823309421539307,
0.1640215665102005,
0.4251420497894287,
-0.045125290751457214,
0.40817198157310486,
0.3391345143318176,
-0.031158018857240677,
-0.18896237015724182,
-0.33159083127975464,
-0.02029927633702755,
0.306034773588180... |
func getHook(data *domain.Data, repo config.Repository) (config.Hook, bool, error) {
for _, hook := range repo.Hooks {
f, err := matchHook(data, hook)
if err != nil {
return config.Hook{}, false, err
}
if f {
return hook, true, nil
}
}
return config.Hook{}, false, nil
} | [
-0.015312118455767632,
0.7544994354248047,
0.5619519948959351,
0.511004626750946,
0.8688647747039795,
0.3993103802204132,
0.034430697560310364,
0.33460748195648193,
-0.30049142241477966,
0.5055345296859741,
0.3074638843536377,
0.11896013468503952,
-0.025024818256497383,
0.06681675463914871... |
func (t *Task) Stop() {
defer func() { recover() }()
close(*t.Stopper)
<-*t.Done
} | [
-0.9009571671485901,
0.10307551920413971,
0.26916006207466125,
0.0884634330868721,
-0.03395698219537735,
0.43088385462760925,
0.8766630291938782,
-0.20238451659679413,
-1.4594446420669556,
-0.09114841371774673,
-1.178701400756836,
-0.8195405006408691,
0.16141055524349213,
-0.13025696575641... |
func (t *Task) StopWithTimeout(timeout time.Duration) error {
defer func() { recover() }()
close(*t.Stopper)
select {
case <-*t.Done:
return nil
case <-time.After(timeout):
return goerr.Wrap(&ErrStoppingTaskTimeout{})
}
} | [
-0.7640228271484375,
-0.39627981185913086,
0.31932443380355835,
-0.024135051295161247,
-1.3057689666748047,
0.2495710253715515,
-0.7102251052856445,
-0.5260422229766846,
-0.6670204997062683,
1.0359715223312378,
-0.5590553283691406,
-0.9678702354431152,
0.3558097779750824,
0.025650670751929... |
func (t *Task) Result() (interface{}, error) {
<-*t.Done
return t.value, t.err
} | [
-1.2547647953033447,
0.7883688807487488,
0.4032479524612427,
-0.021928071975708008,
-0.3317774534225464,
0.057982880622148514,
0.5027117133140564,
-0.431021511554718,
-0.2519710659980774,
0.019533058628439903,
-1.105857491493225,
0.11143500357866287,
0.5324044823646545,
0.09273941069841385... |
func (t *Task) MustResult() interface{} {
v, e := t.Result()
goerr.Check(e)
return v
} | [
-0.4633989632129669,
0.9759290814399719,
0.40816518664360046,
0.7125771641731262,
-0.03496404364705086,
0.2033240646123886,
-0.3572724461555481,
-0.7802807688713074,
0.3783434331417084,
-0.28501182794570923,
-0.16522522270679474,
-0.2856362462043762,
-0.5204339027404785,
-0.054344572126865... |
func (t *Task) ResultWithTimeout(runtime, stoptime time.Duration) (interface{}, error) {
select {
case <-*t.Done:
return t.value, t.err
case <-time.After(runtime):
if err := t.StopWithTimeout(stoptime); err != nil {
return nil, goerr.Wrap(err, "result took too long to be returned and failed to stop in a timel... | [
-0.7244470715522766,
0.1333465278148651,
0.42142799496650696,
0.07456804066896439,
-0.8793697357177734,
-0.42867931723594666,
-0.43653222918510437,
-1.0312596559524536,
-0.5372586846351624,
0.026959383860230446,
-0.08219675719738007,
-0.31524068117141724,
0.018293680623173714,
0.0220393929... |
func (t *Task) MustResultWithTimeout(runtime, stoptime time.Duration) interface{} {
v, e := t.ResultWithTimeout(runtime, stoptime)
goerr.Check(e)
return v
} | [
-0.9791172742843628,
0.1183364987373352,
0.23207160830497742,
0.5689582824707031,
-0.44022852182388306,
0.48106783628463745,
-1.167012095451355,
-1.096501111984253,
-0.3837261497974396,
-0.16522416472434998,
-0.0770803913474083,
-0.4143841862678528,
-0.36461469531059265,
0.5785477757453918... |
func (t *Task) Wait() error {
<-*t.Done
if t.err != nil {
return goerr.Wrap(t.err)
}
return nil
} | [
-0.09669941663742065,
0.7627090811729431,
0.1107429713010788,
-0.3903616666793823,
1.0941578149795532,
0.3318857252597809,
0.11923325806856155,
0.015522236935794353,
-0.7538935542106628,
-0.26759809255599976,
-0.8127238750457764,
0.2044103741645813,
0.6824469566345215,
0.7050014734268188,
... |
func (t *Task) MustWait() {
goerr.Check(t.Wait())
} | [
0.8857054114341736,
0.8648251891136169,
0.36714327335357666,
0.5362459421157837,
0.7986098527908325,
1.6215014457702637,
-0.6645849943161011,
0.21125918626785278,
-0.5947522521018982,
-0.006187581457197666,
0.01871112734079361,
-0.12587730586528778,
0.8995925784111023,
0.3294677734375,
-... |
func (t *Task) IsCompleted() bool {
return t.doneValue
} | [
-0.40202465653419495,
0.18315346539020538,
0.37597477436065674,
0.4055592119693756,
-0.17487159371376038,
0.1739753633737564,
0.5959547162055969,
0.15418954193592072,
-0.3784785270690918,
-0.06479982286691666,
-1.3543697595596313,
-0.05634503439068794,
0.5662050843238831,
0.345575630664825... |
func (i *Internal) Resolve(v interface{}) {
i.Resolver <- v
} | [
-0.8119648098945618,
0.08030451834201813,
0.4552622437477112,
0.10574141144752502,
0.22552944719791412,
-0.15144164860248566,
-0.1010863184928894,
-0.11244754493236542,
-0.7016395926475525,
-0.8781982064247131,
-1.0235093832015991,
-0.41000425815582275,
-0.8400539755821228,
0.9997829794883... |
func (i *Internal) Reject(err interface{}, messages ...string) {
i.Rejector <- goerr.Trace(1, err, messages...)
} | [
-0.8690722584724426,
1.1646441221237183,
0.29989513754844666,
0.45672276616096497,
-0.416940838098526,
0.8026981353759766,
0.24263952672481537,
-0.27116140723228455,
-0.10257487744092941,
-0.03841273486614227,
-0.14175669848918915,
-0.37756839394569397,
-1.0442246198654175,
0.4088624715805... |
func (i *Internal) ShouldStop() bool {
select {
case <-*i.Stopper:
return true
default:
return false
}
} | [
-1.49810791015625,
0.9375857710838318,
0.5516226291656494,
0.6496360898017883,
0.1188059151172638,
0.8097112774848938,
-0.3610421419143677,
-0.07418462634086609,
-0.4568215012550354,
-0.19913047552108765,
-0.1898370385169983,
-1.2627153396606445,
-0.6632925868034363,
-0.7420342564582825,
... |
func (i *Internal) CancelableCtx() context.Context {
ctx, cancel := context.WithCancel(context.Background())
go func() {
select {
case <-*i.done:
case <-*i.Stopper:
cancel()
}
}()
return ctx
} | [
0.49617668986320496,
-0.7336858510971069,
0.4710189402103424,
0.2231857031583786,
-1.2503589391708374,
0.836616039276123,
0.14943675696849823,
-0.31603503227233887,
-0.17531204223632812,
0.5943820476531982,
0.5716291666030884,
-1.3554120063781738,
-0.042627718299627304,
-0.5329651832580566... |
func New(fn interface{}) *Task {
// Spin up some channels
done := make(chan struct{}, 1)
stopper := make(chan struct{}, 1)
tResolver := make(chan interface{}, 1)
tRejector := make(chan error, 1)
tiResolver := make(chan interface{}, 1)
tiRejector := make(chan error, 1)
// Create our task object
t := &Task{
R... | [
-0.3942221999168396,
-0.10712414979934692,
0.6853207945823669,
-0.2874106168746948,
-0.48103803396224976,
-0.6094396710395813,
0.149977907538414,
-0.4874414801597595,
-0.8006537556648254,
-0.420705646276474,
0.06929033249616623,
-0.4621744453907013,
0.5642866492271423,
-0.19183431565761566... |
func Resolved(v interface{}) *Task {
done := make(chan struct{}, 1)
close(done)
resolver := make(chan interface{}, 1)
resolver <- v
rejector := make(chan error, 1)
return &Task{
Resolver: resolver,
Rejector: rejector,
Stopper: &done,
Done: &done,
}
} | [
0.03493700176477432,
0.5720164775848389,
0.7252764701843262,
-0.003978529013693333,
-0.2792052924633026,
-0.3893333971500397,
0.522512674331665,
-0.39487290382385254,
-0.010370360687375069,
-0.8619363307952881,
-1.7421247959136963,
-0.25695449113845825,
0.3740953207015991,
-0.0212617255747... |
func Rejected(e error) *Task {
done := make(chan struct{}, 1)
close(done)
resolver := make(chan interface{}, 1)
rejector := make(chan error, 1)
rejector <- e
return &Task{
Resolver: resolver,
Rejector: rejector,
Stopper: &done,
Done: &done,
}
} | [
-0.34387391805648804,
0.8839654326438904,
0.6241624355316162,
0.2639636695384979,
-1.2121813297271729,
-0.003930982667952776,
0.447908878326416,
-0.24140998721122742,
-0.12856027483940125,
-0.7948141694068909,
-0.9975939989089966,
-0.25348538160324097,
0.4064495265483856,
-0.10662119090557... |
func (r *redisSessionRegistry) SessionRegistry(userId, clientId, sessionId string, lifeTime int) error {
registry := registryObject{
UserId: userId,
ClientId: clientId,
SessionId: sessionId,
}
return redisUtil.SetObjectWithExpire(r.getRegistryKey(userId), ®istry, lifeTime)
} | [
-0.47278064489364624,
0.1858019083738327,
0.4138127863407135,
-0.3326825797557831,
-0.054937608540058136,
-0.32433679699897766,
-0.10547620058059692,
-0.6832176446914673,
1.4066804647445679,
0.7121074795722961,
-0.9501563906669617,
0.9850817918777466,
0.18746741116046906,
-0.38089710474014... |
func (r *redisSessionRegistry) GetUserSession(userId string) (string, string, error) {
redisKey := r.getRegistryKey(userId)
var sessionRegistry registryObject
if err := redisUtil.GetObject(redisKey, &sessionRegistry); err != nil {
Log.Error("Failed to Get User Session Registry", With("userId", userId), WithError(e... | [
-0.9698970913887024,
0.03263239189982414,
0.6791030168533325,
-0.13696448504924774,
-0.9688935279846191,
-0.26611047983169556,
0.8820018768310547,
-1.4089680910110474,
1.1983720064163208,
1.059161901473999,
-0.9797091484069824,
0.6520360112190247,
-0.19181972742080688,
0.9025132656097412,
... |
func initFileLog(cfg *FileLogConfig, logger *log.Logger) error {
if st, err := os.Stat(cfg.Filename); err == nil {
if st.IsDir() {
return errors.New("can't use directory as log file name")
}
}
if cfg.MaxSize == 0 {
cfg.MaxSize = DefaultLogMaxSize
}
// use lumberjack to logrotate
output := &lumberjack.Lo... | [
0.6483919024467468,
-0.00894021987915039,
0.5917831063270569,
-0.04489454627037048,
-0.5395284295082092,
-0.24231430888175964,
0.09304375946521759,
0.6140475273132324,
-0.4711572527885437,
-0.013159826397895813,
-0.6007211208343506,
-0.13006140291690826,
0.2683696448802948,
0.8700869083404... |
func InitLogger(cfg *LogConfig) error {
log.SetLevel(stringToLogLevel(cfg.Level))
if cfg.Format == "" {
cfg.Format = defaultLogFormat
}
formatter := stringToLogFormatter(cfg.Format, cfg.DisableTimestamp)
log.SetFormatter(formatter)
if len(cfg.File.Filename) != 0 {
if err := initFileLog(&cfg.File, nil); err ... | [
-0.15260174870491028,
-0.7036789059638977,
0.6350683569908142,
-0.08257556706666946,
-0.11171842366456985,
-0.12641264498233795,
-0.24737870693206787,
1.3685394525527954,
-0.7055899500846863,
0.23409521579742432,
-0.22859102487564087,
0.06653223931789398,
0.0951635017991066,
2.600578308105... |
func (Account) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "accounts"},
}
} | [
0.3319316804409027,
0.5170835256576538,
0.32863849401474,
0.49259859323501587,
0.3127119839191437,
-0.23508647084236145,
-0.09265363961458206,
0.27485740184783936,
0.9199634790420532,
-0.06387623399496078,
-0.7808562517166138,
-0.20663610100746155,
0.8479117155075073,
0.10750162601470947,
... |
func (Account) Fields() []ent.Field {
return []ent.Field{
field.UUID("id", uuid.UUID{}).Default(uuid.New),
field.String("provider").NotEmpty(),
field.String("email").Unique().NotEmpty(),
field.String("password").NotEmpty().Sensitive().MinLen(8),
field.Bool("locked").Default(false),
field.Bool("confirmed")... | [
-0.6647077202796936,
0.16375577449798584,
0.5922104716300964,
-0.8225876688957214,
0.37023308873176575,
-0.13672961294651031,
-0.02214292623102665,
-0.4292606711387634,
0.7354565858840942,
0.518154501914978,
-0.38955673575401306,
0.4433545470237732,
0.29346963763237,
-0.20588745176792145,
... |
func Unveil (path string, flags string) {
err := unix.Unveil(path, flags)
if err != nil {
panic("path= " + path + " --- error= " + err.Error())
}
} | [
1.441047191619873,
0.11458463221788406,
0.25325730443000793,
0.10396210104227066,
0.18905006349086761,
0.28850609064102173,
0.046808045357465744,
0.7457013130187988,
-1.1013638973236084,
-0.10977140814065933,
-1.0674927234649658,
0.8809630870819092,
-0.0025213195476680994,
-0.2187607437372... |
func (s *Service) remoteServerConnection() error {
cbkServer := make(map[string]func(genericNetwork.Client, genericNetwork.Message))
cbkServer["/write/switch/"+s.mac+"/setup/config"] = s.onSetup
cbkServer["/write/switch/"+s.mac+"/update/settings"] = s.onUpdateSetting
cbkServer["/remove/switch/"+s.mac+"/update/setti... | [
-0.855900228023529,
-0.5707264542579651,
0.6261895298957825,
0.7308477759361267,
-0.5012128949165344,
-0.43960198760032654,
0.7117514610290527,
-0.23312009871006012,
-0.2641330361366272,
0.7160366177558899,
-1.264527440071106,
-0.22250325977802277,
-1.0758023262023926,
1.0981976985931396,
... |
func (v TransactionsSinceIDRequest) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel(&w, v)
return w.Buffer.BuildBytes(), w.Error
} | [
-0.07743679732084274,
1.0437071323394775,
0.39540284872055054,
-0.6258383393287659,
-0.8047835230827332,
-0.9982730746269226,
0.6570855379104614,
0.4317619502544403,
-0.17135754227638245,
0.059009402990341187,
-0.3262977600097656,
0.02193838357925415,
-0.6002668142318726,
0.171790674328804... |
func (v TransactionsSinceIDRequest) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel(w, v)
} | [
-0.09329550713300705,
0.8543961048126221,
0.397051066160202,
-1.0641052722930908,
-0.4287213981151581,
-1.4533683061599731,
0.38790589570999146,
-0.2388765513896942,
0.23787395656108856,
-0.08943942934274673,
-0.5332176685333252,
0.04869812726974487,
-0.10304652154445648,
0.752293288707733... |
func (v *TransactionsSinceIDRequest) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel(&r, v)
return r.Error()
} | [
-0.07332216948270798,
1.1789741516113281,
0.43554210662841797,
-1.3372509479522705,
-0.9324013590812683,
-0.8455784916877747,
0.18985186517238617,
0.28065064549446106,
-0.06959587335586548,
0.07707599550485611,
-0.11161437630653381,
-0.32100909948349,
-0.6439874768257141,
0.011339862830936... |
func (v *TransactionsSinceIDRequest) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel(l, v)
} | [
0.16502833366394043,
0.9709639549255371,
0.4285462200641632,
-1.2929073572158813,
-0.5589659810066223,
-1.5423542261123657,
0.43496960401535034,
0.3477059006690979,
0.1338205188512802,
-0.12841427326202393,
-0.5604321956634521,
-0.204660102725029,
-0.2598855495452881,
0.33983510732650757,
... |
func (v TransactionsResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel1(&w, v)
return w.Buffer.BuildBytes(), w.Error
} | [
0.4488019347190857,
0.15781092643737793,
0.1634618043899536,
-0.9214909076690674,
-0.4032442569732666,
-1.4042414426803589,
0.7560123801231384,
-0.12340977042913437,
0.5322329998016357,
0.36352911591529846,
-0.7456305623054504,
-0.35658544301986694,
-0.658486545085907,
-0.40030425786972046... |
func (v TransactionsResponse) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel1(w, v)
} | [
0.30814218521118164,
0.1328866183757782,
0.2913235127925873,
-1.3665351867675781,
-0.10998780280351639,
-1.7919588088989258,
0.6309572458267212,
-0.751713216304779,
0.7261168360710144,
0.14299838244915009,
-0.8992477655410767,
-0.43739089369773865,
-0.13800226151943207,
0.12875227630138397... |
func (v *TransactionsResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel1(&r, v)
return r.Error()
} | [
0.4677443206310272,
0.2668086290359497,
0.23939470946788788,
-1.7327853441238403,
-0.5950695872306824,
-1.340590238571167,
0.6833267211914062,
-0.19822658598423004,
0.3860619366168976,
0.3102017641067505,
-0.4610362946987152,
-0.6973633170127869,
-0.6708899140357971,
-0.6284088492393494,
... |
func (v *TransactionsResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel1(l, v)
} | [
0.6583979725837708,
0.16164498031139374,
0.34456175565719604,
-1.6087417602539062,
-0.13603317737579346,
-2.0803537368774414,
0.9272158145904541,
0.0024933249223977327,
0.502381443977356,
0.21460963785648346,
-0.9049878120422363,
-0.5999816656112671,
-0.2041509449481964,
-0.169458523392677... |
func (v TransactionsRequest) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel2(&w, v)
return w.Buffer.BuildBytes(), w.Error
} | [
-0.3422551155090332,
0.6419902443885803,
0.3395957946777344,
-0.6712690591812134,
-0.5600175857543945,
-1.168814778327942,
0.05280844122171402,
-0.1982131004333496,
-0.1311335563659668,
0.11804648488759995,
-0.06081033870577812,
0.367535799741745,
-0.14968061447143555,
0.150050088763237,
... |
func (v TransactionsRequest) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel2(w, v)
} | [
-0.5007006525993347,
0.607529878616333,
0.41990384459495544,
-1.1611498594284058,
-0.1860496997833252,
-1.724966287612915,
-0.061610039323568344,
-0.8789992928504944,
0.11526717245578766,
-0.12311968952417374,
-0.38455092906951904,
0.14032629132270813,
0.28625988960266113,
0.75010991096496... |
func (v *TransactionsRequest) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel2(&r, v)
return r.Error()
} | [
-0.34564006328582764,
0.7241832613945007,
0.3688511848449707,
-1.5940282344818115,
-0.6932188272476196,
-1.1295031309127808,
-0.25147750973701477,
-0.3266604542732239,
-0.24773399531841278,
0.11619456112384796,
0.21589569747447968,
-0.09217707812786102,
-0.1706230789422989,
0.0389270819723... |
func (v *TransactionsRequest) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel2(l, v)
} | [
-0.16696317493915558,
0.5779940485954285,
0.4098679721355438,
-1.4329874515533447,
-0.25095534324645996,
-1.9748775959014893,
-0.004042851272970438,
-0.1470339149236679,
-0.1122395247220993,
-0.09671250730752945,
-0.32097217440605164,
-0.135043203830719,
0.24330554902553558,
0.378689676523... |
func (v TransactionsPagesResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel3(&w, v)
return w.Buffer.BuildBytes(), w.Error
} | [
0.5428694486618042,
0.4681127667427063,
0.031879913061857224,
-1.0045866966247559,
-0.48226189613342285,
-0.8396584987640381,
0.06876776367425919,
-0.219874307513237,
0.8009109497070312,
0.9027935862541199,
-0.07012185454368591,
-0.8185024857521057,
-0.42454537749290466,
0.0795804336667060... |
func (v TransactionsPagesResponse) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel3(w, v)
} | [
0.21752741932868958,
0.3317602276802063,
0.23901760578155518,
-1.4721786975860596,
-0.2449817955493927,
-1.3408560752868652,
0.1385725885629654,
-0.8239853978157043,
1.0374945402145386,
0.5560486912727356,
-0.31409481167793274,
-0.7145880460739136,
-0.043322835117578506,
0.4051256179809570... |
func (v *TransactionsPagesResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel3(&r, v)
return r.Error()
} | [
0.3235231041908264,
0.6478073596954346,
0.12345262616872787,
-1.7697371244430542,
-0.7531212568283081,
-0.7487562298774719,
-0.024210575968027115,
-0.24265103042125702,
0.6434034109115601,
0.7203189134597778,
0.026936152949929237,
-1.0015349388122559,
-0.47342705726623535,
-0.1762085705995... |
func (v *TransactionsPagesResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel3(l, v)
} | [
0.4827324450016022,
0.4685595631599426,
0.23507395386695862,
-1.710305094718933,
-0.32010379433631897,
-1.4333187341690063,
0.31628963351249695,
-0.028367619961500168,
0.7639566659927368,
0.5552476644515991,
-0.4723359942436218,
-0.9221527576446533,
-0.05771186202764511,
0.1461613625288009... |
func (v TransactionsIDRangeRequest) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel4(&w, v)
return w.Buffer.BuildBytes(), w.Error
} | [
-0.7584224343299866,
0.599277913570404,
0.14624658226966858,
-0.902503490447998,
-0.45478326082229614,
-1.0673400163650513,
-0.004883097484707832,
-0.4444942772388458,
-0.2954716980457306,
0.07405983656644821,
-0.28834617137908936,
0.4945264458656311,
-0.45676282048225403,
0.41542297601699... |
func (v TransactionsIDRangeRequest) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel4(w, v)
} | [
-0.7840836048126221,
0.4579889178276062,
0.20023882389068604,
-1.2442301511764526,
-0.13635021448135376,
-1.634922981262207,
-0.07429603487253189,
-0.9585514664649963,
0.20253202319145203,
-0.03200802952051163,
-0.4328164756298065,
0.25751635432243347,
-0.11883530020713806,
0.8057301044464... |
func (v *TransactionsIDRangeRequest) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel4(&r, v)
return r.Error()
} | [
-0.6438169479370117,
0.5121347904205322,
0.14898772537708282,
-1.4965269565582275,
-0.6710188984870911,
-0.9939117431640625,
-0.168458491563797,
-0.44059187173843384,
-0.23717786371707916,
0.08590696007013321,
-0.05271851643919945,
-0.10734756290912628,
-0.4354122579097748,
0.1705344617366... |
func (v *TransactionsIDRangeRequest) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel4(l, v)
} | [
-0.44485577940940857,
0.43544676899909973,
0.15693695843219757,
-1.372071385383606,
-0.22952403128147125,
-1.7811123132705688,
0.05803417041897774,
-0.3613353967666626,
0.06907835602760315,
-0.03410967066884041,
-0.510051429271698,
-0.1714402139186859,
-0.18022221326828003,
0.4098546206951... |
func (v TransactionResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel5(&w, v)
return w.Buffer.BuildBytes(), w.Error
} | [
0.26815497875213623,
0.020220328122377396,
0.022874202579259872,
-0.7687188982963562,
-0.3869132399559021,
-1.2700021266937256,
0.6736476421356201,
-0.22459323704242706,
0.254570335149765,
0.5996686816215515,
-1.1399765014648438,
-0.40913453698158264,
-0.9439616799354553,
-0.33071243762969... |
func (v TransactionResponse) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonE82c8e88EncodeGithubComKamaiuOandaGoModel5(w, v)
} | [
0.09710720181465149,
0.08536343276500702,
0.23125432431697845,
-1.1736775636672974,
-0.09271073341369629,
-1.6298044919967651,
0.5635268688201904,
-0.9002940654754639,
0.3991950452327728,
0.289071649312973,
-1.272701621055603,
-0.45281529426574707,
-0.46092623472213745,
0.22317089140415192... |
func (v *TransactionResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel5(&r, v)
return r.Error()
} | [
0.32234954833984375,
0.1717653125524521,
0.21602500975131989,
-1.6290196180343628,
-0.672256350517273,
-1.1128485202789307,
0.6356430053710938,
-0.1874702423810959,
0.13879983127117157,
0.5392851829528809,
-0.7779119610786438,
-0.7200261950492859,
-1.0413039922714233,
-0.5100604891777039,
... |
func (v *TransactionResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel5(l, v)
} | [
0.5279228687286377,
0.1253044754266739,
0.33012568950653076,
-1.4229426383972168,
-0.23315821588039398,
-1.8587368726730347,
0.8474623560905457,
-0.08289989829063416,
0.18500478565692902,
0.3509485423564911,
-1.2573456764221191,
-0.5865527391433716,
-0.522128164768219,
-0.09652762860059738... |
func ShouldTrace(key string) bool {
if key = strings.TrimSpace(key); key == "" {
return false
}
parts := strings.Split(key, ".")
// If key.subkey is defined, return its value
if len(parts) >= 2 {
setting, ok := settings[parts[0]][parts[1]]
if ok {
return setting
}
}
// If key is defined and there is ... | [
-0.10227541625499725,
0.9228911995887756,
0.9845041632652283,
0.3701910972595215,
-0.2882882356643677,
0.10437234491109848,
-0.4918285608291626,
-0.28640252351760864,
0.10707820951938629,
0.7229141592979431,
-0.050032392144203186,
0.17721714079380035,
-0.7726271748542786,
0.399185627698898... |
func SignOut() error {
defer tokens.Delete()
tks := new(tokens.Tokens)
if err := tks.Read(); err != nil {
ui.Debug("%+v", errors.Wrap(err, "we were unable to revoke tokens in the server"))
return nil
}
client := new(clients.Client)
if err := client.Read(); err != nil {
ui.Debug("%+v", err)
return nil
}... | [
0.7472131252288818,
-0.16340135037899017,
0.5684338212013245,
-0.2492971569299698,
0.05656161531805992,
-0.4033902883529663,
0.053326692432165146,
0.1730295568704605,
0.09787540137767792,
0.026198511943221092,
0.03258185833692551,
0.9302918314933777,
-0.7090610265731812,
-0.017280779778957... |
func (m *JarDetails_Jar) GetEntry() []*analysis_go_proto.FileInfo {
if m != nil {
return m.Entry
}
return nil
} | [
0.9602308869361877,
-0.43441566824913025,
0.2797911465167999,
0.8773410320281982,
1.7890125513076782,
0.05715066194534302,
1.0734623670578003,
-0.47241610288619995,
0.19396455585956573,
-0.6520723104476929,
-0.0765061303973198,
0.27961626648902893,
-0.7788328528404236,
1.0209182500839233,
... |
func spiralOrder(matrix [][]int) []int {
if len(matrix) == 0 || len(matrix[0]) == 0 {
return nil
}
m, n := len(matrix), len(matrix[0])
next := nextFunc(m, n)
//fmt.Println(next)
res := make([]int, m*n)
for i := range res {
x, y := next()
fmt.Println(x, y)
res[i] = matrix[x][y]
}
fmt.Println(res)
r... | [
0.32520291209220886,
-0.24137526750564575,
0.6333822011947632,
0.2045801728963852,
-0.7106035947799683,
-0.8509557843208313,
0.4722519516944885,
-0.22691833972930908,
0.6805089116096497,
-0.21848414838314056,
-0.24824507534503937,
0.5356270670890808,
-0.4514690339565277,
0.7837085723876953... |
func (repo Repository) String() string {
var uri string
if repo.RemoteURI != "" {
uri = ", points to " + repo.RemoteURI
} else {
uri = ""
}
return repo.ID + " ('" + repo.Name + "'){ " +
repo.Type + ", " + repo.Format + " format, " +
repo.Policy + " policy" + uri + " }"
} | [
-0.16645784676074982,
-0.9542097449302673,
0.35935086011886597,
-1.1664071083068848,
-0.21230946481227875,
0.831881046295166,
-1.0904406309127808,
-0.31276047229766846,
-0.08132773637771606,
0.37849631905555725,
-0.09790059924125671,
0.20791108906269073,
-0.11393726617097855,
-0.3917331397... |
func (r *repos) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var payload struct {
Data []struct {
ID string `xml:"id"`
Name string `xml:"name"`
Type string `xml:"repoType"`
Policy string `xml:"repoPolicy"`
Format string `xml:"format"`
RemoteURI string `xml:"re... | [
-0.7385737299919128,
0.9914557933807373,
0.34538814425468445,
-1.142680287361145,
-0.4851371645927429,
0.08386959880590439,
-0.5967874526977539,
0.37058568000793457,
-0.028323378413915634,
0.1625720113515854,
-0.36424413323402405,
-0.6586716175079346,
-0.675007164478302,
-0.333952844142913... |
func machineContainerName(cluster, machine string) string {
if strings.HasPrefix(machine, cluster) {
return machine
}
return fmt.Sprintf("%s-%s", cluster, machine)
} | [
-0.004833397921174765,
-0.6256789565086365,
0.5212935209274292,
0.06416051834821701,
-0.89492267370224,
0.4111444354057312,
-0.7190550565719604,
-0.3902270793914795,
-0.8980766534805298,
0.4900718629360199,
0.7368834614753723,
0.7946316003799438,
0.5231403708457947,
1.4233521223068237,
0... |
func fileOnHost(path string) (*os.File, error) {
if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil {
return nil, err
}
return os.Create(path) //nolint:gosec // No security issue: path is safe.
} | [
0.8591794967651367,
-0.36679840087890625,
0.49660536646842957,
0.2728509306907654,
-0.8069841265678406,
0.9016189575195312,
0.22668027877807617,
-0.14326924085617065,
-1.047385573387146,
-0.37361833453178406,
-0.4088839888572693,
-0.5473718047142029,
0.4088535010814667,
-0.1935960650444030... |
func (m *RetrieveUserInfoCacheStatusResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLastUpdatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateNamespace(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeV... | [
0.9923128485679626,
-0.06009644642472267,
-0.14967648684978485,
-0.04768170416355133,
-0.40353137254714966,
-0.5284023284912109,
0.11432316154241562,
-0.32186371088027954,
0.12141286581754684,
-0.6014887690544128,
-0.2559216320514679,
-0.11585929244756699,
-0.49301159381866455,
0.349671453... |
func NewUserServer(dao *mysql.DAO) *UserSrv {
return &UserSrv{
dao: dao,
}
} | [
-0.690011739730835,
-0.39741918444633484,
0.21431061625480652,
0.30525943636894226,
-1.1803947687149048,
-0.1508825123310089,
0.3845926821231842,
0.011227594688534737,
0.9240390658378601,
-0.505081057548523,
-1.5619395971298218,
0.41134801506996155,
0.07888085395097733,
0.10496878623962402... |
func (u *UserSrv) CreateUser(ctx context.Context, req *pb.CreateUserReq) (*pb.CreateUserRes, error) {
// 1. Validate request
if !u.isValidUserRequest(req.GetReq()) {
return nil, errs.New(errs.ECInvalidMessage)
}
// 2. Check if user with that email exists
email := req.GetUser().GetEmail()
user, _ := u.dao.FindO... | [
-0.6252806186676025,
-0.018749509006738663,
1.0473153591156006,
0.7012948989868164,
0.8042595386505127,
0.7231014966964722,
0.6880967020988464,
-0.27166271209716797,
0.17200806736946106,
-0.1176024004817009,
-0.648446261882782,
-1.0393797159194946,
-0.8723629713058472,
0.29635414481163025,... |
func (u *UserSrv) ReadUser(ctx context.Context, req *pb.ReadUserReq) (*pb.ReadUserRes, error) {
// 1. Validate request
if !u.isValidUserRequest(req.GetReq()) {
return nil, errs.New(errs.ECInvalidMessage)
}
// 2. Find user by ID or Email
user := new(models.User)
switch req.GetReq().GetMessage() {
case pb.Mess... | [
-0.9503893256187439,
-0.14287087321281433,
1.0348228216171265,
0.5137968063354492,
-0.04795214906334877,
0.3874112069606781,
0.8940050005912781,
-0.22546136379241943,
-0.0026022784877568483,
-0.4125676155090332,
0.5661055445671082,
-0.18188484013080597,
-0.8186244368553162,
0.3676840662956... |
func (u *UserSrv) UpdateUser(ctx context.Context, req *pb.UpdateUserReq) (*pb.UpdateUserRes, error) {
// 1. Validate request
if !u.isValidUserRequest(req.GetReq()) {
return nil, errs.New(errs.ECInvalidMessage)
}
// 2. Update user
user := models.ConvertPbUserToUser(req.GetUser())
err := u.dao.WithTransaction(fu... | [
-1.402421236038208,
-0.39164116978645325,
0.9843567609786987,
0.7914225459098816,
-0.26010391116142273,
0.33919426798820496,
0.6525269746780396,
0.036853402853012085,
0.468928724527359,
-0.21204131841659546,
-0.6085624098777771,
-0.3020872473716736,
-0.6932793855667114,
0.22468192875385284... |
func (u *UserSrv) ChangePwd(ctx context.Context, req *pb.ChangePwdReq) (*pb.ChangePwdRes, error) {
// 1. Validate request
if !u.isValidUserRequest(req.GetReq()) {
return nil, errs.New(errs.ECInvalidMessage)
}
// 2. Update user
user := models.ConvertPbUserToUser(req.GetUser())
err := u.dao.WithTransaction(func(... | [
-0.6593225598335266,
-0.16435620188713074,
1.1777443885803223,
-0.38739919662475586,
-0.855270504951477,
0.36231598258018494,
0.5759795904159546,
0.3075394332408905,
-0.24173690378665924,
0.5971314311027527,
-0.09485002607107162,
0.31594181060791016,
-0.9882935285568237,
1.1177489757537842... |
func TestDROStructuralValidatorNotObject(t *testing.T) {
validator := NewDROStructuralValidator(newMockRepository(nil))
err := validator.ValidateResource(testResource("bs646cd8717.json"))
assert.Nil(t, err)
} | [
-0.3449462354183197,
-0.4451114237308502,
0.48574361205101013,
-0.008052929304540157,
0.028803469613194466,
0.8767442107200623,
0.37261515855789185,
-0.48636624217033386,
-0.2905867397785187,
-1.0401484966278076,
-0.7016391754150391,
-0.4898986220359802,
0.231412872672081,
0.17064751684665... |
func TestDROStructuralValidatorWrongType(t *testing.T) {
collection := testResource("bs646cd8717.json")
validator := NewDROStructuralValidator(newMockRepository(collection))
obj := testObjectResource([]string{collection.ID()})
err := validator.ValidateResource(obj)
assert.NotNil(t, err)
} | [
-0.20792792737483978,
-0.00777340866625309,
0.577769935131073,
0.031176676973700523,
0.5516554713249207,
1.0599148273468018,
0.27127906680107117,
-0.7432253360748291,
-0.2527407705783844,
-0.4173332452774048,
-0.5636438727378845,
-0.058611076325178146,
0.0892706885933876,
0.647950291633606... |
func TestDROStructuralValidatorMemberNotFound(t *testing.T) {
validator := NewDROStructuralValidator(newMockRepository(nil))
obj := testObjectResource([]string{"NotfindableID"})
err := validator.ValidateResource(obj)
assert.NotNil(t, err)
} | [
0.6148961186408997,
-0.2857972979545593,
0.4592910408973694,
0.260388046503067,
0.7834311127662659,
0.996157169342041,
0.17189833521842957,
-0.4745813012123108,
-0.24928918480873108,
-0.9724958539009094,
-0.41104817390441895,
-0.33415892720222473,
-0.5178428292274475,
0.13122893869876862,
... |
func TestDROStructuralValidatorNoMemberAssertion(t *testing.T) {
json := datautils.JSONObject{
"@type": "http://sdr.sul.stanford.edu/models/sdr3-image.jsonld",
"structural": map[string]interface{}{}}
obj := datautils.NewResource(json)
validator := NewDROStructuralValidator(newMockRepository(nil))
err := va... | [
-0.4751533269882202,
-0.4026128649711609,
0.45189690589904785,
-0.5758445858955383,
-0.46609607338905334,
0.8989291787147522,
0.2908267378807068,
-0.1675848513841629,
-0.19756503403186798,
-1.5309890508651733,
-0.5040388107299805,
-0.18402795493602753,
-0.4548609256744385,
0.57991659641265... |
func (in *CommandsIter) DeepCopy() *CommandsIter {
if in == nil {
return nil
}
out := new(CommandsIter)
in.DeepCopyInto(out)
return out
} | [
-0.7328304052352905,
0.18220125138759613,
0.20930302143096924,
0.9411356449127197,
-0.8603742718696594,
-0.2612869441509247,
-0.3070995807647705,
-0.5113181471824646,
-0.643359363079071,
-0.6993024349212646,
0.15136128664016724,
-0.28324589133262634,
-0.7501099109649658,
0.0422968454658985... |
func (in *Condition) DeepCopy() *Condition {
if in == nil {
return nil
}
out := new(Condition)
in.DeepCopyInto(out)
return out
} | [
0.301680326461792,
-0.15301963686943054,
0.30453255772590637,
1.0888190269470215,
-0.8622695207595825,
0.2912931442260742,
1.1533203125,
0.48108094930648804,
0.3109358847141266,
-0.06928292661905289,
0.22574810683727264,
-0.12403234094381332,
-0.7235293984413147,
-0.5456617474555969,
-0.... |
func (in *Dependent) DeepCopyInto(out *Dependent) {
*out = *in
return
} | [
0.34363889694213867,
-0.08859048783779144,
0.5263015627861023,
-0.10332153737545013,
-1.6762014627456665,
1.1566109657287598,
0.3185768723487854,
0.555020272731781,
-1.4280445575714111,
-0.32188406586647034,
-1.1477395296096802,
1.3991657495498657,
0.23565898835659027,
-0.29828083515167236... |
func (in *Dependent) DeepCopy() *Dependent {
if in == nil {
return nil
}
out := new(Dependent)
in.DeepCopyInto(out)
return out
} | [
-0.4327254593372345,
0.26385343074798584,
0.4325209856033325,
0.8966490030288696,
-1.3499934673309326,
0.8548781275749207,
0.8873129487037659,
-0.3878709673881531,
-0.6036527752876282,
-0.4323027729988098,
-0.7888998985290527,
0.5378260016441345,
-0.35698625445365906,
-0.8386567234992981,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.