text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (pc *ProcedureCache) Get(dbName, procedureName string, numOfParams int) *Procedure {
dbName = strings.ToLower(dbName)
procedureName = strings.ToLower(procedureName)
if procMap, ok := pc.dbToProcedureMap[dbName]; ok {
if procedures, ok := procMap[procedureName]; ok {
if procedure, ok := procedures[numOfPara... | [
0.05467836186289787,
0.35549861192703247,
0.7554078698158264,
-0.566571831703186,
0.01460934616625309,
-0.7454087734222412,
-0.43891388177871704,
-0.3188691735267639,
-0.19470199942588806,
0.3825874924659729,
0.5271745324134827,
0.7013089060783386,
-0.7400121688842773,
-0.08565781265497208... |
func (pc *ProcedureCache) AllForDatabase(dbName string) []*Procedure {
dbName = strings.ToLower(dbName)
var proceduresForDb []*Procedure
if procMap, ok := pc.dbToProcedureMap[dbName]; ok {
for _, procedures := range procMap {
for _, procedure := range procedures {
proceduresForDb = append(proceduresForDb, p... | [
-0.2802233397960663,
-0.08603037893772125,
0.8158674240112305,
-0.4379931390285492,
-0.06923416256904602,
0.050400711596012115,
-0.467750608921051,
-0.6258704662322998,
0.3263145387172699,
0.21101272106170654,
-0.14751321077346802,
0.42109546065330505,
-0.5924365520477295,
1.16201233863830... |
func (pc *ProcedureCache) Register(dbName string, procedure *Procedure) error {
dbName = strings.ToLower(dbName)
paramLen := len(procedure.Params)
if procedure.HasVariadicParameter() {
paramLen = math.MaxInt
}
if procMap, ok := pc.dbToProcedureMap[dbName]; ok {
if procedures, ok := procMap[strings.ToLower(proc... | [
-0.8226726055145264,
0.5897385478019714,
0.6507331728935242,
-0.5890540480613708,
-0.2052619308233261,
-0.3815297782421112,
-0.31277477741241455,
-0.1009870320558548,
0.2033454030752182,
0.3172837793827057,
-0.27121269702911377,
0.2860429584980011,
-0.48531121015548706,
0.5933697819709778,... |
func (o *GetaspecificBillingFeeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetaspecificBillingFeeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
retu... | [
0.030633684247732162,
-0.6810652017593384,
0.5592047572135925,
0.41875988245010376,
0.2826847434043884,
-1.2152886390686035,
0.06103811785578728,
-0.09518465399742126,
0.49026885628700256,
0.2054835855960846,
0.6686260104179382,
-0.3073369860649109,
-0.4477807581424713,
0.28734803199768066... |
func NewGetaspecificBillingFeeOK() *GetaspecificBillingFeeOK {
return &GetaspecificBillingFeeOK{}
} | [
0.25179731845855713,
0.12059450149536133,
0.29778459668159485,
0.7824761271476746,
0.35413840413093567,
-0.789374589920044,
0.7287790179252625,
0.7510150074958801,
-0.44161632657051086,
-0.5355423092842102,
-0.35688257217407227,
-0.07617378234863281,
0.9540761709213257,
0.6136875748634338,... |
func (v SmsBulkStatus) Ptr() *SmsBulkStatus {
return &v
} | [
1.1906291246414185,
-0.0068968781270086765,
-0.0057444642297923565,
-0.1231335774064064,
-0.7450970411300659,
0.7039457559585571,
-0.6248545050621033,
-0.564522385597229,
0.556087076663971,
-0.26728782057762146,
0.3232814073562622,
0.3454169034957886,
-0.654380202293396,
0.6798731684684753... |
func (m *DashboardGroup) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLinks(formats); err != nil {
res = append(res, err)
}
if err := m.validateDashboardEntries(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...... | [
-0.24590466916561127,
1.3046513795852661,
-0.045079849660396576,
-0.23478998243808746,
-0.2283107042312622,
-0.7323088645935059,
0.7806214690208435,
0.18054720759391785,
-1.3025343418121338,
-0.8055720925331116,
0.3421408534049988,
-0.21387843787670135,
-1.1161761283874512,
0.9986773729324... |
func NewEcrHandler(client kubernetes.Interface, nsExclud []string, secretName string) *EcrHandler {
/*user, err := aws.GetIamUser()
if err != nil {
log.Fatal("Failure to get IAM user for ECR handler")
}
*/
var name string
if secretName != "" {
name = secretName
} else {
name = "ecr"
}
return &EcrHandler... | [
0.14398090541362762,
0.09931030124425888,
0.2669965922832489,
-0.44362497329711914,
-0.5506550669670105,
0.8348072171211243,
-0.49252575635910034,
-0.0684947520494461,
0.10499493032693863,
0.0800224170088768,
-0.08678509294986725,
0.3241935968399048,
-1.2891782522201538,
0.3403353989124298... |
func (h *EcrHandler) ifSkip(namespace string) bool {
found, _ := lc.InArray(namespace, h.ExcludeNamespaces)
return found
} | [
-0.7734065651893616,
0.694533109664917,
0.4885813593864441,
-0.3597843647003174,
-0.5940089225769043,
0.3275343179702759,
-0.5817165374755859,
-0.5591643452644348,
1.023561716079712,
0.4719299376010895,
-0.24900034070014954,
-1.0807042121887207,
-0.9483506083488464,
0.5813268423080444,
-... |
func (h *EcrHandler) Upsert(obj interface{}) error {
ns := obj.(*v1.Namespace)
// Don't process if excluded
if skip := h.ifSkip(ns.GetName()); skip {
// If exist, delete from excluded namespace
if s, err := lc.GetSecret(h.client, ns.GetName(), h.SecretName, metav1.GetOptions{}); s.Name != "" {
err = lc.Delet... | [
0.3686787784099579,
0.23247450590133667,
0.9959357380867004,
-0.5713762044906616,
0.47341132164001465,
0.21860143542289734,
-0.5224591493606567,
-0.5473118424415588,
0.6013059020042419,
0.5437256097793579,
-1.0131666660308838,
-0.03503000736236572,
-0.46532171964645386,
0.8509957194328308,... |
func (h *EcrHandler) Create(obj interface{}) error {
return h.Upsert(obj)
} | [
-0.12578338384628296,
0.9097059369087219,
0.2729475200176239,
0.27093347907066345,
0.6850279569625854,
1.000766396522522,
0.6649413108825684,
-0.3295446038246155,
-0.23661360144615173,
0.17321644723415375,
-0.9053767323493958,
-1.5518006086349487,
-0.6197930574417114,
0.292092889547348,
... |
func (h *EcrHandler) Delete(obj interface{}) error {
return nil
} | [
0.45070353150367737,
0.23411616683006287,
0.3174556791782379,
-0.011359333992004395,
0.868131697177887,
0.873550534248352,
1.291917085647583,
0.575408399105072,
0.862687349319458,
-0.3054431676864624,
-0.7851415872573853,
-0.417012482881546,
-0.9652785062789917,
0.2207615226507187,
-0.10... |
func (c Client) Users(rq *RequestQuery, us *[]data.User) (*ClientResponse, error) {
ur, err := c.RequestUsers(rq)
if err != nil {
return nil, err
}
for _, u := range ur.Users {
*us = append(*us, u)
}
cr := ClientResponse{
Pagination: ur.Pagination,
}
return &cr, nil
} | [
-1.7812377214431763,
0.23338106274604797,
0.47692641615867615,
0.06569620966911316,
0.1872241497039795,
-0.4553281366825104,
-0.14660370349884033,
-0.3787573277950287,
0.4716936945915222,
-0.47825729846954346,
0.4530653953552246,
0.14383399486541748,
0.07177546620368958,
0.1831017881631851... |
func (c Client) User(id int) (*data.User, error) {
url := fmt.Sprintf("%v%v/%v", c.BaseURL, "users", fmt.Sprint(id))
userResponse := data.User{}
err := c.getResponse(url, &userResponse)
if err != nil {
return nil, err
}
return &userResponse, nil
} | [
-1.452570915222168,
-0.4075797200202942,
0.4656534790992737,
0.011043368838727474,
0.15182645618915558,
-0.7265337109565735,
0.3057931363582611,
-0.9276639819145203,
0.7508835196495056,
-0.9708479642868042,
-1.02383553981781,
0.39799734950065613,
-0.42871126532554626,
0.029602104797959328,... |
func (c Client) Events(rq *RequestQuery, es *[]data.Event) (*ClientResponse, error) {
er, err := c.RequestEvents(rq)
if err != nil {
return nil, err
}
for _, e := range er.Events {
*es = append(*es, e)
}
cr := ClientResponse{
Pagination: er.Pagination,
}
return &cr, nil
} | [
-1.0940966606140137,
0.11714530736207962,
0.5120726227760315,
-0.13371196389198303,
0.5117489695549011,
-0.6296043395996094,
-0.2352757751941681,
-0.29302701354026794,
0.7187669277191162,
-0.3964148759841919,
0.4681633412837982,
-0.17642013728618622,
0.09319630265235901,
-0.026352135464549... |
func (c Client) Event(id int) (*data.Event, error) {
url := fmt.Sprintf("%v%v/%v", c.BaseURL, "events", fmt.Sprint(id))
eventResponse := data.Event{}
err := c.getResponse(url, &eventResponse)
if err != nil {
return nil, err
}
return &eventResponse, nil
} | [
-0.7486596703529358,
0.2809027433395386,
0.32552576065063477,
0.03492331877350807,
0.3997000753879547,
-0.3232874870300293,
0.0413719080388546,
-0.2582542598247528,
0.6940667629241943,
-0.39350706338882446,
-0.8858079314231873,
0.8380956053733826,
-0.6428529024124146,
0.0003933132684323936... |
func (c Client) RequestUsers(rq *RequestQuery) (*UsersResponse, error) {
v, _ := query.Values(rq)
url := fmt.Sprintf("%v%v?%v", c.BaseURL, "users", v.Encode())
usersResponse := UsersResponse{}
err := c.getResponse(url, &usersResponse)
if err != nil {
return nil, err
}
return &usersResponse, nil
} | [
-1.6282975673675537,
-0.20862442255020142,
0.3304632008075714,
0.36868032813072205,
0.10157261043787003,
-0.7735280394554138,
-0.5943022966384888,
-0.9745227098464966,
0.9378905296325684,
-0.7778962850570679,
0.538374662399292,
0.20754195749759674,
-1.4686996936798096,
0.6438982486724854,
... |
func (c Client) RequestEvents(rq *RequestQuery) (*EventsResponse, error) {
v, _ := query.Values(rq)
url := fmt.Sprintf("%v%v?%v", c.BaseURL, "events", v.Encode())
eventsResponse := EventsResponse{}
err := c.getResponse(url, &eventsResponse)
if err != nil {
return nil, err
}
return &eventsResponse, nil
} | [
-1.286775827407837,
-0.14720074832439423,
0.4669874906539917,
0.4603153169155121,
0.5805304646492004,
-1.054342269897461,
-0.3937617540359497,
-0.7842001914978027,
1.2899597883224487,
-0.8066677451133728,
0.2171967774629593,
0.022032123059034348,
-1.6472960710525513,
0.3945162892341614,
... |
func Initiate() {
// By default, sends and receives block until the other side is ready.
// This allows goroutines to synchronize without explicit locks or condition variables.
go func() {
for {
for i := 0; i < len(IPList); i++ {
channel <- IPList[i]
}
}
}()
} | [
-0.5633779168128967,
1.030936360359192,
0.4885222017765045,
-1.3706297874450684,
0.43163371086120605,
-0.3019580841064453,
0.011036518029868603,
0.0461789146065712,
-1.2659581899642944,
0.11981993913650513,
-0.8458201289176941,
0.31202852725982666,
-0.43302664160728455,
0.6625702977180481,... |
func Take() string {
return <-channel
} | [
0.6881376504898071,
-0.3231644630432129,
0.23356454074382782,
-0.8730877637863159,
-0.1120927482843399,
0.12034344673156738,
0.1266777366399765,
-0.8806812167167664,
-0.26358339190483093,
-0.7764710783958435,
0.052394311875104904,
0.5242660045623779,
-0.8256138563156128,
-0.349882215261459... |
func ResetIPList(list []string) {
IPList = list
Take()
} | [
-1.329635500907898,
-0.1072673574090004,
0.12401952594518661,
0.15448828041553497,
-0.22712326049804688,
-0.26283881068229675,
-0.6072487235069275,
1.2677314281463623,
0.32701072096824646,
1.3930481672286987,
-1.269572138786316,
-0.21664667129516602,
-0.5931171774864197,
-0.867291867733001... |
func New(configFile string) *Config {
c, err := ioutil.ReadFile(configFile)
if err != nil {
log.Panicf("Read config file %s failed: %s", configFile, err.Error())
}
cfg := &Config{}
if err := yaml.Unmarshal(c, cfg); err != nil {
log.Panicf("yaml.Unmarshal config file %s failed: %s", configFile, err.Error())
}
... | [
0.47842878103256226,
-0.8649840354919434,
0.39730414748191833,
0.003113326383754611,
-0.9162256121635437,
-0.05574773624539375,
-0.04811299964785576,
0.9366011619567871,
-1.5531200170516968,
0.2234593778848648,
-0.11545335501432419,
-0.27904629707336426,
0.5294008851051331,
0.5352962017059... |
func InsertSortInt(a []int, ascending bool) {
if ascending {
insertSortAscendingInt(a)
} else {
insertSortDescendingInt(a)
}
} | [
-0.2406502217054367,
0.9329074621200562,
0.6295552849769592,
-0.8055844306945801,
-0.28280770778656006,
0.7926037907600403,
0.012217288836836815,
-0.5776357650756836,
-0.6290275454521179,
0.7173082232475281,
-0.4579916000366211,
-0.2086307406425476,
-1.0590842962265015,
0.25220608711242676... |
func insertSortAscendingInt(a []int) {
for i := 0; i < len(a); i++ {
// Move search left while it is greater than the item to its left
for j := i; j > 0; j-- {
if a[j] > a[j-1] {
break
}
x := a[j]
a[j] = a[j - 1]
a[j - 1] = x
}
}
} | [
-0.2499871850013733,
0.5337586998939514,
0.8391139507293701,
-0.5683621764183044,
-0.40577125549316406,
0.4774019718170166,
0.32147130370140076,
-0.9115309119224548,
-0.3556166887283325,
1.1785489320755005,
-0.5641707181930542,
-0.23763462901115417,
-0.8049994111061096,
1.025253415107727,
... |
func insertSortDescendingInt(a []int) {
for i := 0; i < len(a); i++ {
// Move search left while it is greater than the item to its left
for j := i; j > 0; j-- {
if a[j] < a[j-1] {
break
}
x := a[j]
a[j] = a[j - 1]
a[j - 1] = x
}
}
} | [
-0.3788149654865265,
0.8622477054595947,
0.8822875022888184,
-0.6513242125511169,
-0.3236149251461029,
0.5696534514427185,
0.6502288579940796,
-0.6736816167831421,
-0.3430591821670532,
0.7562851905822754,
-0.4587641954421997,
-0.5521628856658936,
-0.901432991027832,
0.8713515996932983,
0... |
func InsertSort(a []SortableObject, ascending bool) {
if ascending {
insertSortAscending(a)
} else {
insertSortDescending(a)
}
} | [
-0.018064189702272415,
1.0910453796386719,
0.7319378852844238,
0.2248733788728714,
-0.14165939390659332,
0.7750213146209717,
0.1251833289861679,
-0.41606709361076355,
-0.6548547744750977,
0.3818491995334625,
-0.08095058053731918,
-0.658582866191864,
-0.5386241674423218,
0.6519069075584412,... |
func insertSortAscending(a []SortableObject) {
for i := 0; i < len(a); i++ {
// Move search left while it is greater than the item to its left
for j := i; j > 0; j-- {
if a[j].GetValue() > a[j-1].GetValue() {
break
}
x := a[j]
a[j] = a[j - 1]
a[j - 1] = x
}
}
} | [
-0.2224791944026947,
0.4253804385662079,
0.9507169723510742,
0.3570204973220825,
-0.03658423572778702,
0.42245402932167053,
0.35927191376686096,
-0.9547865986824036,
-0.5520081520080566,
1.042955756187439,
-0.5421543717384338,
-0.3395681381225586,
-0.3490079641342163,
1.0429115295410156,
... |
func insertSortDescending(a []SortableObject) {
for i := 0; i < len(a); i++ {
// Move search left while it is greater than the item to its left
for j := i; j > 0; j-- {
if a[j].GetValue() < a[j-1].GetValue(){
break
}
x := a[j]
a[j] = a[j - 1]
a[j - 1] = x
}
}
} | [
-0.14833177626132965,
0.7352992296218872,
0.9952247142791748,
0.3727107048034668,
0.051141396164894104,
0.6703881025314331,
0.5353201031684875,
-0.6648903489112854,
-0.5014691948890686,
0.6432737112045288,
-0.5699743032455444,
-0.6568865180015564,
-0.44335442781448364,
0.8669120073318481,
... |
func NewParser(l *Lexer) *Parser {
p := &Parser{
l: l,
errors: []string{},
}
p.prefixParseFns = map[TokenType]prefixParseFn{}
p.registerPrefix(IDENT, p.parseIdentifier)
p.registerPrefix(NOT, p.parsePrefixExpression)
p.registerPrefix(LPAREN, p.parseGroupedExpression)
p.registerPrefix(SET, p.parseSetExpr... | [
-0.08138562738895416,
-1.0950672626495361,
1.0828808546066284,
-0.490337610244751,
-1.0900492668151855,
-0.2005397230386734,
-0.27704593539237976,
-0.2802583873271942,
0.48460865020751953,
-0.29174119234085083,
-0.48533567786216736,
0.08914992213249207,
-0.0879262238740921,
0.3752742409706... |
func exampleNewWatcher(t *testing.T) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
t.Error(err)
}
defer watcher.Close()
err = watcher.Add(".")
if err != nil {
t.Error(err)
}
sigs := make(chan os.Signal)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
MAIN:
for {
select {
case event, o... | [
0.5023255348205566,
-1.3292453289031982,
0.7719743251800537,
0.6982935667037964,
-0.27828967571258545,
0.0418112613260746,
0.0828789472579956,
0.19041617214679718,
-0.25817054510116577,
0.01271571684628725,
-0.25630897283554077,
-0.010441601276397705,
0.3874685764312744,
0.873170018196106,... |
func (r *SearchRequest) MarshalJSON() ([]byte, error) {
root := make(map[string]interface{})
root["size"] = r.Size
if len(r.Sort) > 0 {
root["sort"] = r.Sort
}
for key, value := range r.CustomProps {
root[key] = value
}
root["query"] = r.Query
if len(r.Aggs) > 0 {
root["aggs"] = r.Aggs
}
return jso... | [
-0.3494682312011719,
-0.4140375852584839,
0.2713445723056793,
-0.6959484815597534,
-0.4839186668395996,
-0.4982009530067444,
0.05414596572518349,
-0.35298261046409607,
-0.1837458312511444,
0.15819916129112244,
-0.02111925184726715,
0.8241848349571228,
-0.36614522337913513,
0.46273875236511... |
func NewBoolQuery() *BoolQuery {
return &BoolQuery{Filters: make([]Filter, 0)}
} | [
0.8222418427467346,
-0.568561851978302,
0.22044916450977325,
0.24219216406345367,
-0.9283222556114197,
-0.6702513098716736,
-0.6891994476318359,
0.3968261778354645,
-0.33974915742874146,
0.1340220868587494,
-0.21194176375865936,
1.2075259685516357,
-0.09316392242908478,
0.8190106749534607,... |
func (q *BoolQuery) MarshalJSON() ([]byte, error) {
root := make(map[string]interface{})
if len(q.Filters) > 0 {
if len(q.Filters) == 1 {
root["filter"] = q.Filters[0]
} else {
root["filter"] = q.Filters
}
}
return json.Marshal(root)
} | [
0.02737532928586006,
-0.5693144798278809,
0.2988491654396057,
-0.4063166081905365,
-0.5646671652793884,
-0.19354058802127838,
-0.056690722703933716,
0.5779576301574707,
0.343113511800766,
1.044347882270813,
0.025607818737626076,
1.3935387134552002,
-0.26982611417770386,
0.8651850819587708,... |
func (f *QueryStringFilter) MarshalJSON() ([]byte, error) {
root := map[string]interface{}{
"query_string": map[string]interface{}{
"query": f.Query,
"analyze_wildcard": f.AnalyzeWildcard,
},
}
return json.Marshal(root)
} | [
-0.06844524294137955,
-0.16287614405155182,
-0.12717249989509583,
-0.5634613037109375,
-0.6304767727851868,
-0.026489492505788803,
-0.3023752272129059,
0.3891744017601013,
-0.22044044733047485,
-0.2829853594303131,
-0.35022425651550293,
1.4614839553833008,
0.3103780150413513,
0.40929788351... |
func (f *RangeFilter) MarshalJSON() ([]byte, error) {
root := map[string]map[string]map[string]interface{}{
"range": {
f.Key: {
"lte": f.Lte,
"gte": f.Gte,
},
},
}
if f.Format != "" {
root["range"][f.Key]["format"] = f.Format
}
return json.Marshal(root)
} | [
-1.0477993488311768,
-0.674051821231842,
0.316148966550827,
-0.27528032660484314,
-0.4629698395729065,
-0.37349560856819153,
-0.030955806374549866,
0.36211758852005005,
-0.5815548300743103,
-0.14134815335273743,
-1.0390039682388306,
1.3003129959106445,
-0.22383029758930206,
0.5402579307556... |
func (a *Agg) MarshalJSON() ([]byte, error) {
root := map[string]interface{}{
a.Key: a.Aggregation,
}
return json.Marshal(root)
} | [
-0.042011670768260956,
0.3630680441856384,
0.3584938645362854,
-0.1809619516134262,
-0.37149593234062195,
-0.36583784222602844,
0.09921015799045563,
0.7412181496620178,
0.24659442901611328,
0.8420265913009644,
0.5508727431297302,
1.2757818698883057,
0.6295595765113831,
0.8940467834472656,
... |
func (a AggArray) MarshalJSON() ([]byte, error) {
aggsMap := make(map[string]Aggregation)
for _, subAgg := range a {
aggsMap[subAgg.Key] = subAgg.Aggregation
}
return json.Marshal(aggsMap)
} | [
-0.25473397970199585,
0.18968535959720612,
0.5638087391853333,
0.13855332136154175,
-0.14686131477355957,
-0.18380622565746307,
0.001935497741214931,
0.30131250619888306,
0.44049158692359924,
0.7101331353187561,
0.2897818684577942,
0.9235999584197998,
0.46516284346580505,
1.023096442222595... |
func (a *aggContainer) MarshalJSON() ([]byte, error) {
root := map[string]interface{}{
a.Type: a.Aggregation,
}
if len(a.Aggs) > 0 {
root["aggs"] = a.Aggs
}
return json.Marshal(root)
} | [
0.1438867747783661,
0.7175289988517761,
0.3840818405151367,
0.29263564944267273,
0.6942256689071655,
-1.0153396129608154,
0.5607702136039734,
-0.26267439126968384,
0.6967405080795288,
0.19864943623542786,
1.0175238847732544,
1.0498623847961426,
0.5772637128829956,
1.437983512878418,
0.09... |
func (a *MetricAggregation) MarshalJSON() ([]byte, error) {
root := map[string]interface{}{
"field": a.Field,
}
for k, v := range a.Settings {
if k != "" && v != nil {
root[k] = v
}
}
return json.Marshal(root)
} | [
-0.0184343121945858,
0.6038661003112793,
0.24609564244747162,
-0.45243558287620544,
0.04774685949087143,
-0.11173766106367111,
0.7940829396247864,
0.08465754985809326,
-0.4645698070526123,
0.9240679740905762,
0.6599621772766113,
0.7932683825492859,
0.4861057996749878,
0.67426598072052,
-... |
func (a *PipelineAggregation) MarshalJSON() ([]byte, error) {
root := map[string]interface{}{
"buckets_path": a.BucketPath,
}
for k, v := range a.Settings {
if k != "" && v != nil {
root[k] = v
}
}
return json.Marshal(root)
} | [
-0.42193710803985596,
0.05239046365022659,
0.23447546362876892,
-1.0474308729171753,
0.19291755557060242,
-0.30348387360572815,
0.5014877319335938,
0.24087010324001312,
-0.4168337881565094,
0.724997878074646,
0.5780477523803711,
0.6893107295036316,
0.6034786105155945,
0.2611702084541321,
... |
func RabbitURL(url string) broker.Option {
return optfunc(rabbitURLKey{}, url)
} | [
0.12451837211847305,
0.28153195977211,
0.4211234450340271,
0.6106754541397095,
-0.06759709119796753,
0.6266703605651855,
-0.1593325436115265,
0.8112114667892456,
0.41684967279434204,
0.3485897183418274,
-1.1877996921539307,
0.7804064750671387,
-0.38041508197784424,
-0.604019045829773,
-1... |
func GCPTokenSource(ts gcp.TokenSource) broker.Option {
return optfunc(gcpTokenSourceKey{}, ts)
} | [
-0.09361208230257034,
0.7356225848197937,
0.026750823482871056,
-0.741069495677948,
0.1389165222644806,
-0.06657176464796066,
-1.074828028678894,
-0.2825886905193329,
-0.008083841763436794,
0.359804630279541,
-1.1543803215026855,
0.633584201335907,
0.1286003142595291,
-0.8484806418418884,
... |
func GCPProjectID(projID gcp.ProjectID) broker.Option {
return optfunc(gcpProjectIDKey{}, projID)
} | [
0.6605908274650574,
0.8089418411254883,
0.134285569190979,
0.2855813205242157,
-0.036089491099119186,
0.9365445971488953,
-0.4881037771701813,
-0.7067267298698425,
0.10294957458972931,
1.0251911878585815,
0.33699846267700195,
0.49022674560546875,
-1.0503076314926147,
0.029389023780822754,
... |
func installMaven(ctx *gcp.Context) (string, error) {
mvnl := ctx.Layer(mavenLayer)
// Check the metadata in the cache layer to determine if we need to proceed.
var meta mavenMetadata
ctx.ReadMetadata(mvnl, &meta)
if mavenVersion == meta.Version {
ctx.CacheHit(mavenLayer)
ctx.Logf("Maven cache hit, skipping ... | [
-0.7271949648857117,
-0.8817991018295288,
0.8403893709182739,
-0.5204228758811951,
-0.14364215731620789,
0.37254735827445984,
0.45233991742134094,
0.16408981382846832,
-0.3123911917209625,
0.4002172648906708,
-0.13914898037910461,
0.11815229803323746,
-0.3746051788330078,
0.262858510017395... |
func TestGetAllTodos(t *testing.T) {
_client := setupDatabase(t)
_handler := setupTodoHandler(_client)
defer _client.Close()
app := fiber.New()
app.Get("/todos", _handler.GetAllTodos)
r := httptest.NewRequest("GET", "/todos", nil)
resp, err := app.Test(r)
if err != nil {
assert.Fail(t, err.Error())
}
a... | [
0.6016990542411804,
0.5144227147102356,
0.7191913723945618,
0.5688830614089966,
0.6170349717140198,
0.09152720123529434,
0.06872166693210602,
0.3409460484981537,
0.0769168883562088,
-1.3998719453811646,
-0.17513372004032135,
0.6158143281936646,
0.17535792291164398,
0.2296728938817978,
-0... |
func TestGetTodoByID(t *testing.T) {
_client := setupDatabase(t)
_handler := setupTodoHandler(_client)
defer _client.Close()
app := fiber.New()
app.Get("/todos/:id", _handler.GetTodoByID)
r := httptest.NewRequest("GET", "/todos/"+sampleID.String(), nil)
resp, err := app.Test(r)
if err != nil {
assert.Fail... | [
0.7272728681564331,
0.17118903994560242,
0.4168654978275299,
0.014055396430194378,
0.4532316327095032,
-0.13611499965190887,
0.5001940727233887,
-0.3185473680496216,
-0.0840841680765152,
-0.7155911326408386,
-0.7953054308891296,
0.6392843127250671,
0.24563390016555786,
-0.10052086412906647... |
func TestCreateTodo(t *testing.T) {
_client := setupDatabase(t)
_handler := setupTodoHandler(_client)
defer _client.Close()
app := fiber.New()
app.Post("/todos", _handler.CreateTodo)
body := []byte(`{"content":"Example content"}`)
r := httptest.NewRequest("POST", "/todos", bytes.NewReader(body))
r.Header.Set... | [
0.7250988483428955,
0.5715006589889526,
0.5934401154518127,
-0.07487086951732635,
0.9123799204826355,
0.6285429000854492,
0.11761201173067093,
-0.2514857351779938,
-0.5240185260772705,
-0.5939654111862183,
-0.9727540612220764,
-0.0041467733681201935,
0.0336698442697525,
0.2507805824279785,... |
func TestUpdateTodoByID(t *testing.T) {
_client := setupDatabase(t)
_handler := setupTodoHandler(_client)
defer _client.Close()
app := fiber.New()
app.Put("/todos/:id", _handler.UpdateTodoByID)
body := []byte(`{"content":"Updated content"}`)
r := httptest.NewRequest("PUT", "/todos/"+sampleID.String(), bytes.N... | [
0.2554423213005066,
-0.1727367490530014,
0.6490939855575562,
-0.07678423821926117,
-0.2908508777618408,
-0.04631806164979935,
0.49177876114845276,
-0.42854028940200806,
-0.01664288341999054,
0.023425187915563583,
-1.11598801612854,
0.3066070079803467,
-0.10945327579975128,
-0.3825286626815... |
func TestDeleteTodoByID(t *testing.T) {
_client := setupDatabase(t)
_handler := setupTodoHandler(_client)
defer _client.Close()
app := fiber.New()
app.Delete("/todos/:id", _handler.DeleteTodoByID)
r := httptest.NewRequest("DELETE", fmt.Sprintf("/todos/%s", sampleID), nil)
resp, err := app.Test(r)
if err != ... | [
0.7368831634521484,
0.08686131983995438,
0.5120126008987427,
0.20588929951190948,
0.2078516185283661,
-0.08117303997278214,
0.6940277814865112,
-0.29150962829589844,
0.21888244152069092,
-0.6002933979034424,
-0.470794141292572,
0.2973823845386505,
0.09129706025123596,
0.22694623470306396,
... |
func setupDatabase(t *testing.T) (client *entity.Client) {
client = enttest.Open(t, "sqlite3", "file:ent?mode=memory&_fk=1")
ctx := context.Background()
if err := client.Schema.Create(ctx); err != nil {
panic(err)
}
if err := setSampleData(ctx, client); err != nil {
panic(err)
}
return client
} | [
0.13103987276554108,
0.3835331201553345,
0.5315350294113159,
-0.180542454123497,
0.6129955053329468,
0.3367946445941925,
0.508007287979126,
0.3921986520290375,
0.6475606560707092,
0.366219162940979,
0.27111735939979553,
-0.2777068018913269,
-1.1655936241149902,
0.10640405863523483,
-0.57... |
func setupTodoHandler(client *entity.Client) *handler.TodoHandler {
return handler.NewTodoHandler(client)
} | [
0.014525496400892735,
-0.03519655764102936,
0.1973770707845688,
-0.3522341549396515,
-0.034080468118190765,
0.39728736877441406,
0.4875449538230896,
-0.2850600481033325,
-0.07484208792448044,
-0.2919493019580841,
-0.08687791228294373,
-0.2581343948841095,
0.11648932844400406,
0.42954233288... |
func setSampleData(ctx context.Context, client *entity.Client) error {
_, err := client.Todo.Create().
SetID(sampleID).
SetContent("Sample todo data for unit test.").
SetCompleted(true).
Save(ctx)
return err
} | [
-0.21070460975170135,
0.5821361541748047,
0.250592440366745,
-0.13133752346038818,
0.013701683841645718,
0.45431122183799744,
0.34572577476501465,
-0.06697489321231842,
0.07791880518198013,
0.003932776395231485,
-1.5106661319732666,
0.45775729417800903,
0.05909872055053711,
0.2151327431201... |
func NewHelloWorld(hellowordString string) *Helloword {
hl := &Helloword{}
hl.d.Text = hellowordString
return hl
} | [
0.9403755068778992,
-0.27607056498527527,
0.14288276433944702,
0.18969032168388367,
-1.2632743120193481,
1.4359934329986572,
-0.7547382116317749,
0.3524567782878876,
0.4605444669723511,
-0.6006271243095398,
-1.2419908046722412,
0.2753831446170807,
-0.2720201313495636,
0.5084066987037659,
... |
func (hl *Helloword) HandlerHelloWorld(writer http.ResponseWriter, r *http.Request, ps httprouter.Params) {
util.ResponseJSON(hl.d, writer)
} | [
0.03754372522234917,
-0.3203943073749542,
0.5227254629135132,
-0.07049813121557236,
-0.11605127900838852,
0.8319522142410278,
0.2637443244457245,
0.46746140718460083,
-0.3500259518623352,
0.20927934348583221,
-1.4254405498504639,
-0.4027603268623352,
0.5760955214500427,
1.0263816118240356,... |
func (hl *Helloword) HandlerHelloWorldWithName(writer http.ResponseWriter, r *http.Request, ps httprouter.Params) {
d := &data{}
d.Text = hl.d.Text + " " + ps.ByName("name")
util.ResponseJSON(d, writer)
} | [
0.03517904505133629,
-0.4062483012676239,
0.5745084881782532,
-0.28742265701293945,
-0.8835691809654236,
0.542779266834259,
-0.1030280739068985,
-0.08773323893547058,
-0.6593996286392212,
0.6846913695335388,
-1.6459091901779175,
-0.6462997794151306,
0.285471111536026,
1.0256314277648926,
... |
func GetAffectedProjects(lastcommit string, ignore ...string) (map[string]string, error) {
wd, err := os.Getwd()
if err != nil {
return nil, err
}
dir := ""
if list := strings.Split(lastcommit, "/"); len(list) > 1 {
dir = strings.Join(list[:len(list)-1], "/")
lastcommit = list[len(list)-1]
}
wd = filepath... | [
-0.0809115543961525,
0.0939803197979927,
1.0923675298690796,
-0.17552527785301208,
-0.6583712697029114,
0.41868168115615845,
0.7557174563407898,
0.026452025398612022,
0.030286384746432304,
0.6257337927818298,
-0.3550511598587036,
-0.15488089621067047,
-0.5575233697891235,
0.455445110797882... |
func (c *controller) Run(threadiness int, stopCh <-chan struct{}) error {
defer runtime.HandleCrash()
klog.Infoln("Starting Topology Controller.")
klog.Infoln("Waiting for informer caches to sync")
klog.Infof("Starting %v workers.", threadiness)
klog.Infoln("Started workers")
<-stopCh
klog.Infoln("Shutting do... | [
-0.6001554727554321,
0.18661950528621674,
0.31954213976860046,
-0.11220470070838928,
1.056242823600769,
0.3736516833305359,
0.8623916506767273,
-0.42879313230514526,
-0.5965085029602051,
-0.3421742618083954,
-0.9590337872505188,
-0.6659611463546753,
-0.28272494673728943,
0.2781519591808319... |
func NewV1Client(gc gnmi.GNMIClient, deviceID string, isMgmtSystem bool) cvclient.CVClient {
return &v1client{
gnmiClient: gc,
deviceID: deviceID,
isMgmtSystem: isMgmtSystem,
}
} | [
0.6867561936378479,
-0.7657702565193176,
-0.03900153562426567,
0.698639988899231,
-0.9624921679496765,
-0.04279009997844696,
0.015939483419060707,
-0.8808177709579468,
0.5538195371627808,
0.5272674560546875,
0.6027287244796753,
1.3724168539047241,
-0.9963736534118652,
0.20436012744903564,
... |
func NewLocalizer(locale language.Tag, matcher language.Matcher, translationsPath string) LocalizerInterface {
localizer := &Localizer{
i18nStorage: &sync.Map{},
LocaleMatcher: matcher,
TranslationsPath: translationsPath,
loadMutex: &sync.RWMutex{},
}
localizer.SetLanguage(locale)
localizer.L... | [
0.06444620341062546,
-0.7868902683258057,
0.21654458343982697,
-0.31989699602127075,
-1.1263576745986938,
-0.6445446610450745,
-0.6881194114685059,
-0.09074588119983673,
-0.12254330515861511,
-0.4532652795314789,
-0.7255865931510925,
-0.5676401853561401,
0.027020638808608055,
0.48717951774... |
func NewLocalizerFS(
locale language.Tag, matcher language.Matcher, translationsFS fs.FS,
) LocalizerInterface {
localizer := &Localizer{
i18nStorage: &sync.Map{},
LocaleMatcher: matcher,
TranslationsFS: translationsFS,
loadMutex: &sync.RWMutex{},
}
localizer.SetLanguage(locale)
localizer.LoadTran... | [
-0.5525889992713928,
-0.18978315591812134,
0.19663675129413605,
-0.6243398189544678,
-1.1748311519622803,
-1.3765816688537598,
-0.6454973220825195,
-0.02335020713508129,
-0.3266356885433197,
-0.9276835918426514,
-0.10379555076360703,
-0.6648242473602295,
0.39879196882247925,
0.510877013206... |
func DefaultLocalizerBundle() *i18n.Bundle {
return i18n.NewBundle(DefaultLanguage)
} | [
-0.20303063094615936,
0.10403625667095184,
0.13688042759895325,
0.1356162130832672,
-0.6356127262115479,
0.6645666360855103,
-0.5863412022590637,
0.4043589234352112,
-0.8156173229217529,
-0.4636462926864624,
-0.4861748516559601,
-1.2771365642547607,
-1.0007987022399902,
0.45263513922691345... |
func LocalizerBundle(tag language.Tag) *i18n.Bundle {
return i18n.NewBundle(tag)
} | [
0.24992340803146362,
-0.04531034827232361,
0.3499183654785156,
-0.5207980275154114,
-1.0938526391983032,
-0.056165412068367004,
-0.4520312249660492,
-0.49685144424438477,
-0.8256101608276367,
-0.30259913206100464,
-0.2779686748981476,
-1.0370022058486938,
-0.2838553786277771,
0.14740201830... |
func DefaultLocalizerMatcher() language.Matcher {
return language.NewMatcher(DefaultLanguages)
} | [
0.07616724818944931,
-0.647298276424408,
0.1053401455283165,
0.2066643387079239,
-0.9457457065582275,
0.30705317854881287,
-0.6806886196136475,
0.91744065284729,
0.17359833419322968,
-0.7169260382652283,
-0.5599954128265381,
-1.9515876770019531,
-0.9580485820770264,
1.028480887413025,
-0... |
func (l *Localizer) Clone() CloneableLocalizer {
clone := &Localizer{
i18nStorage: l.i18nStorage,
TranslationsFS: l.TranslationsFS,
LocaleMatcher: l.LocaleMatcher,
LanguageTag: l.LanguageTag,
TranslationsPath: l.TranslationsPath,
loadMutex: l.loadMutex,
}
clone.SetLanguage(DefaultLa... | [
0.18370448052883148,
-0.7888256907463074,
0.3133065402507782,
0.35328131914138794,
-1.132590651512146,
0.16771838068962097,
-0.9909440279006958,
-0.22183190286159515,
-0.1751413494348526,
-0.08923449367284775,
-0.339040607213974,
-0.5945414304733276,
-0.5287084579467773,
0.0995139852166175... |
func (l *Localizer) LocalizationMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
clone := l.Clone().(LocaleControls)
clone.SetLocale(c.GetHeader("Accept-Language"))
c.Set(LocalizerContextKey, clone)
}
} | [
-0.3768991231918335,
-0.12345024943351746,
0.38963639736175537,
0.220197394490242,
-0.6815561056137085,
-0.05523224547505379,
-0.4564403295516968,
-0.14708784222602844,
0.5606457591056824,
0.8590409755706787,
0.31008222699165344,
-0.5454376935958862,
-0.1092434674501419,
0.1885274797677993... |
func (l *Localizer) createLocaleBundleByTag(tag language.Tag) *i18n.Bundle {
bundle := i18n.NewBundle(tag)
bundle.RegisterUnmarshalFunc("yml", yaml.Unmarshal)
l.loadTranslationsToBundle(bundle)
return bundle
} | [
1.0734944343566895,
-0.4015474319458008,
0.24312834441661835,
-0.5931729078292847,
-0.45419594645500183,
-0.41847386956214905,
-0.1123596653342247,
-0.15089546144008636,
-0.49563971161842346,
0.11358606815338135,
-0.7591409683227539,
-0.7807437777519226,
0.18621926009655,
0.692801177501678... |
func (l *Localizer) LoadTranslations() {
defer l.loadMutex.Unlock()
l.loadMutex.Lock()
l.getCurrentLocalizer()
} | [
-0.17316029965877533,
0.5188130736351013,
0.3096696138381958,
0.19289551675319672,
-0.7010732889175415,
-0.6589489579200745,
-0.6244886517524719,
-0.4826938509941101,
-0.1444193571805954,
-0.31599554419517517,
-0.7860044240951538,
-0.7342388033866882,
-1.2782518863677979,
0.425973743200302... |
func (l *Localizer) loadTranslationsToBundle(i18nBundle *i18n.Bundle) {
switch {
case l.TranslationsPath != "":
if err := l.loadFromDirectory(i18nBundle); err != nil {
panic(err.Error())
}
default:
if err := l.loadFromFS(i18nBundle); err != nil {
panic(err.Error())
}
}
} | [
0.09056469053030014,
0.8840645551681519,
0.396823525428772,
-0.19172364473342896,
0.49856507778167725,
0.1407851278781891,
-0.029714664444327354,
-0.11479329317808151,
-0.4823918342590332,
0.3839587867259979,
0.3812008202075958,
-1.2141821384429932,
-0.329282283782959,
0.4699268937110901,
... |
func (l *Localizer) loadFromDirectory(i18nBundle *i18n.Bundle) error {
files, err := ioutil.ReadDir(l.TranslationsPath)
if err != nil {
return err
}
for _, f := range files {
if !f.IsDir() {
i18nBundle.MustLoadMessageFile(path.Join(l.TranslationsPath, f.Name()))
}
}
return nil
} | [
0.23287762701511383,
0.16743575036525726,
0.3970274031162262,
-0.3067162036895752,
0.35661882162094116,
-0.21209362149238586,
0.2666390836238861,
-1.0197864770889282,
-0.4196688234806061,
0.39820998907089233,
0.40254902839660645,
-0.4667562246322632,
0.27346161007881165,
1.0790544748306274... |
func (l *Localizer) loadFromFS(i18nBundle *i18n.Bundle) error {
translationFiles, err := fs.ReadDir(l.TranslationsFS, string('.'))
if err != nil {
return err
}
for _, file := range translationFiles {
if !file.IsDir() {
data, err := fs.ReadFile(l.TranslationsFS, file.Name())
if err != nil {
return err
... | [
-0.02616599202156067,
0.29148656129837036,
0.5315983891487122,
-0.5203163027763367,
-0.23469138145446777,
-0.411571204662323,
-0.23354145884513855,
-0.29226773977279663,
-0.8113417625427246,
-0.18039219081401825,
0.5199877023696899,
-0.9472315311431885,
-0.14040020108222961,
0.565943658351... |
func (l *Localizer) getLocalizer(tag language.Tag) *i18n.Localizer {
var localizer *i18n.Localizer
if l.isUnd(tag) {
tag = DefaultLanguage
}
if item, ok := l.i18nStorage.Load(tag); !ok {
l.i18nStorage.Store(tag, i18n.NewLocalizer(l.createLocaleBundleByTag(tag), tag.String()))
} else {
localizer = item.(*i1... | [
-0.0004064518434461206,
-0.2203378528356552,
0.35673075914382935,
0.08075474947690964,
-0.4020836353302002,
-0.6405004858970642,
-0.3349877595901489,
-0.18863825500011444,
0.44619932770729065,
-0.43537604808807373,
-0.8608342409133911,
-0.35467422008514404,
-0.5679042339324951,
0.518371462... |
func (l *Localizer) getCurrentLocalizer() *i18n.Localizer {
return l.getLocalizer(l.Language())
} | [
-0.43890324234962463,
-1.1386890411376953,
0.3455815315246582,
0.03290023282170296,
-1.5244001150131226,
0.22917599976062775,
-0.6866342425346375,
-0.06965269148349762,
-0.7374327778816223,
-0.2510691285133362,
0.03351929783821106,
-0.06902908533811569,
-0.06824000179767609,
0.933624446392... |
func (l *Localizer) SetLocale(al string) {
l.SetLanguage(l.matchByString(al))
} | [
0.722272515296936,
-0.3145257234573364,
0.2286701500415802,
0.7847239971160889,
-1.1243759393692017,
-0.048232562839984894,
0.2992584705352783,
0.7087106108665466,
0.028927557170391083,
-0.09621133655309677,
0.15251277387142181,
-0.2368677407503128,
-0.1321115791797638,
1.3641653060913086,... |
func (l *Localizer) Preload(tags []language.Tag) {
for _, tag := range tags {
l.getLocalizer(tag)
}
} | [
-0.05373057350516319,
0.3359535336494446,
0.08621375262737274,
-0.19633182883262634,
0.5534619092941284,
-0.11627693474292755,
-0.6886129975318909,
-0.5743439793586731,
-0.45638734102249146,
0.057412948459386826,
-1.0619548559188843,
-0.933157205581665,
0.33260124921798706,
0.9153817892074... |
func (l *Localizer) SetLanguage(tag language.Tag) {
if l.isUnd(tag) {
tag = DefaultLanguage
}
l.LanguageTag = tag
l.LoadTranslations()
} | [
0.5236508250236511,
0.3278990387916565,
0.0918721929192543,
0.7057163715362549,
0.34598979353904724,
-0.40508341789245605,
0.23842763900756836,
0.7151290774345398,
0.15594083070755005,
-0.5029093027114868,
-0.478280246257782,
-1.0843777656555176,
-0.15697522461414337,
1.6955316066741943,
... |
func (l *Localizer) Language() language.Tag {
return l.LanguageTag
} | [
0.6175532937049866,
-0.3293416500091553,
0.020853910595178604,
0.22271360456943512,
0.000978140626102686,
0.28065550327301025,
0.14697104692459106,
-0.07523531466722488,
0.25339552760124207,
-0.8702497482299805,
-0.0454791896045208,
-0.8999010920524597,
0.49470004439353943,
1.3284305334091... |
func (l *Localizer) FetchLanguage() {
l.LoadTranslations()
} | [
0.8698447942733765,
0.08572206646203995,
0.03979381173849106,
0.4304586946964264,
-0.2796280086040497,
0.28978076577186584,
-0.18833881616592407,
0.12442508339881897,
0.19063682854175568,
0.17321698367595673,
0.12692897021770477,
-0.13274987041950226,
0.6801643967628479,
0.7652064561843872... |
func (l *Localizer) GetLocalizedMessage(messageID string) string {
return l.getCurrentLocalizer().MustLocalize(&i18n.LocalizeConfig{MessageID: messageID})
} | [
0.048131391406059265,
-0.18587897717952728,
0.3240787088871002,
-0.39614808559417725,
-0.026342792436480522,
0.2625952959060669,
-0.8282491564750671,
-0.6487125754356384,
-0.05647801607847214,
0.15374170243740082,
0.08192986994981766,
0.2676013112068176,
-0.9681838750839233,
1.398115038871... |
func (l *Localizer) GetLocalizedTemplateMessage(messageID string, templateData map[string]interface{}) string {
return l.getCurrentLocalizer().MustLocalize(&i18n.LocalizeConfig{
MessageID: messageID,
TemplateData: templateData,
})
} | [
-0.1894485056400299,
-0.4496445059776306,
0.240742489695549,
-0.7987710237503052,
-0.41485893726348877,
-0.02033160999417305,
-0.9446761608123779,
-0.07365154474973679,
-0.4864962697029114,
-0.07138771563768387,
-0.27974796295166016,
0.5402913093566895,
-0.41717228293418884,
1.067168951034... |
func (l *Localizer) Localize(messageID string) (string, error) {
return l.getCurrentLocalizer().Localize(&i18n.LocalizeConfig{MessageID: messageID})
} | [
-0.28785988688468933,
0.1681554913520813,
0.387610524892807,
0.005575465504080057,
-0.37479832768440247,
-0.2842537462711334,
-0.2536529302597046,
-0.8827117085456848,
-0.293520450592041,
0.5748968124389648,
0.3192445933818817,
0.3310701549053192,
-1.1525477170944214,
1.4495093822479248,
... |
func (l *Localizer) LocalizeTemplateMessage(messageID string, templateData map[string]interface{}) (string, error) {
return l.getCurrentLocalizer().Localize(&i18n.LocalizeConfig{
MessageID: messageID,
TemplateData: templateData,
})
} | [
-0.6066407561302185,
0.09304960817098618,
0.2732936143875122,
-0.6222575902938843,
-0.026468079537153244,
-0.5634840726852417,
-0.6278768181800842,
-0.15561281144618988,
-0.7381402254104614,
0.14026480913162231,
-0.034621115773916245,
1.0170217752456665,
-0.5770085453987122,
1.154797434806... |
func (l *Localizer) BadRequestLocalized(err string) (int, interface{}) {
return errorutil.BadRequest(l.GetLocalizedMessage(err))
} | [
-0.7120158672332764,
-0.9580402970314026,
0.4040674865245819,
-0.15968681871891022,
-0.1848868578672409,
-0.3996773958206177,
-0.8405484557151794,
-0.23458626866340637,
0.402409166097641,
-0.6292925477027893,
-0.42964816093444824,
0.6819044351577759,
0.3382933437824249,
0.8012495636940002,... |
func (l *Localizer) UnauthorizedLocalized(err string) (int, interface{}) {
return errorutil.Unauthorized(l.GetLocalizedMessage(err))
} | [
-0.6277464628219604,
-0.9904036521911621,
0.3038404583930969,
-0.5935696363449097,
-1.2119910717010498,
-0.547970712184906,
0.04013499245047569,
0.08283047378063202,
0.49350878596305847,
-0.40370121598243713,
-0.46559643745422363,
0.5459952354431152,
0.1625996232032776,
0.5977462530136108,... |
func (l *Localizer) ForbiddenLocalized(err string) (int, interface{}) {
return errorutil.Forbidden(l.GetLocalizedMessage(err))
} | [
-0.10138801485300064,
-0.15078620612621307,
0.3383253216743469,
-0.13757778704166412,
-1.012178897857666,
-0.16920943558216095,
-0.18235398828983307,
-0.35435083508491516,
0.06914617121219635,
-0.3689713776111603,
-0.952321469783783,
0.4933663010597229,
-0.017464352771639824,
0.53729581832... |
func GetContextLocalizer(c *gin.Context) (loc LocalizerInterface, ok bool) {
loc, ok = extractLocalizerFromContext(c)
if loc != nil {
loc.SetLocale(c.GetHeader("Accept-Language"))
lang := GetRootLanguageTag(loc.Language())
if lang != loc.Language() {
loc.SetLanguage(lang)
loc.LoadTranslations()
}
}
r... | [
-0.008843536488711834,
0.1513509899377823,
0.6759082674980164,
-0.07662594318389893,
-1.420715570449829,
-0.4577120840549469,
-0.09920646250247955,
-0.06039844825863838,
0.11750049889087677,
0.2645801603794098,
-0.480320543050766,
-0.45415666699409485,
-0.5057398080825806,
0.38101232051849... |
func MustGetContextLocalizer(c *gin.Context) LocalizerInterface {
if localizer, ok := GetContextLocalizer(c); ok {
return localizer
}
panic("localizer is not present in provided context")
} | [
0.336967408657074,
-0.054159559309482574,
0.26807278394699097,
0.6433379650115967,
-0.587269127368927,
0.7530901432037354,
-0.8591126203536987,
-0.5675771236419678,
0.7894663214683533,
0.2073526829481125,
0.012882142327725887,
-0.07810132205486298,
-0.41655054688453674,
0.3635610044002533,... |
func extractLocalizerFromContext(c *gin.Context) (LocalizerInterface, bool) {
if c == nil {
return nil, false
}
if item, ok := c.Get(LocalizerContextKey); ok {
if localizer, ok := item.(LocalizerInterface); ok {
return localizer, true
}
}
return nil, false
} | [
-0.7235519886016846,
-0.25282981991767883,
0.44445595145225525,
-0.20670020580291748,
-1.1662758588790894,
-0.47261926531791687,
-0.4201953709125519,
-0.6999199986457825,
0.4550161063671112,
0.5986859202384949,
-0.590400755405426,
-1.293813943862915,
-0.8085184693336487,
0.6586430668830872... |
func GetRootLanguageTag(t language.Tag) language.Tag {
for {
parent := t.Parent()
if parent == language.Und {
return t
}
t = parent
}
} | [
1.4191336631774902,
-0.14831304550170898,
0.5318136215209961,
0.5394645929336548,
-0.8766874670982361,
0.36480772495269775,
-0.28309234976768494,
-0.029544319957494736,
-0.6831453442573547,
-0.6883180737495422,
-0.33217114210128784,
0.0606733113527298,
0.38033151626586914,
1.281982421875,
... |
func ListenRestfulApi(address string, handleFunc func(http.ResponseWriter, *http.Request)) (err error) {
err = http.ListenAndServe(address, CreateRouter(handleFunc))
if err != nil {
log.Errorf("[RestfulApi]: Socket listening on address %+v failed,%+v", address, err)
return
}
log.Errorf("[MySQL-Notification]:Be... | [
0.3293524384498596,
-0.5318767428398132,
0.7336503267288208,
-0.5163081288337708,
0.19515259563922882,
-0.5207837224006653,
0.29777634143829346,
0.45604097843170166,
-0.19668659567832947,
0.09064475446939468,
-0.9672127962112427,
0.9286770820617676,
-0.3270551860332489,
-0.0266904309391975... |
func CreateRouter(handlerFunc http.HandlerFunc) *mux.Router {
router := mux.NewRouter()
config := dots_config.GetSystemConfig()
prefixPath := config.ClientRestfulApiConfiguration.RestfulApiPath
restfulHandlerFunc := createRestfulHandlerFunc(handlerFunc)
// router.HandleFunc("/test", restfulHandlerFunc).Met... | [
0.47282370924949646,
-1.0838613510131836,
0.5483470559120178,
0.4207872450351715,
0.03683532029390335,
-0.164409801363945,
0.34921395778656006,
0.2815893888473511,
0.37590861320495605,
-0.38635215163230896,
0.1084296703338623,
-0.4362545311450958,
-0.10280352830886841,
0.0048255305737257,
... |
func createRestfulHandlerFunc(handlerFunc http.HandlerFunc) (http.HandlerFunc) {
return func (w http.ResponseWriter, r *http.Request) {
var errMessage string
// Check content-type option
contentType := r.Header.Get(string(messages.CONTENT_TYPE))
if contentType == "" || contentType != CONTENT_TYPE_VAL... | [
0.2078733742237091,
-1.17924964427948,
0.4655206501483917,
-0.28725701570510864,
-0.48635900020599365,
-0.004579027649015188,
0.1199917271733284,
-0.3617582321166992,
-0.5259947180747986,
0.1299189180135727,
-0.32545387744903564,
0.00984687078744173,
-0.2844855487346649,
-0.197161361575126... |
func AddFile(a *Archive, from, to string) (int64, error) {
src, err := os.Open(from)
if err != nil {
return -1, err
}
defer src.Close()
dst, err := a.Create(to)
if err != nil {
return -1, err
}
fi, err := src.Stat()
if err != nil {
return -1, err
}
dst.Chmod(fi.Mode())
dst.Chown(
int(fi.Sys().(*s... | [
-0.22675323486328125,
0.19983427226543427,
0.7412489652633667,
-0.15787333250045776,
-0.5484057664871216,
0.39491763710975647,
0.5811352729797363,
0.28850507736206055,
-0.6640492081642151,
-0.11415038257837296,
0.7017369866371155,
0.4543769061565399,
0.15032082796096802,
-0.287241965532302... |
func AddDirectory(a *Archive, from, to string, recursive bool) (int, error) {
return AddGlob(a, filepath.Join(from, "*"), to, recursive)
} | [
-0.6693028807640076,
0.3802497684955597,
0.6985664367675781,
0.5265007615089417,
0.03048153780400753,
0.06022440269589424,
0.37026411294937134,
0.43329259753227234,
0.1317557841539383,
-0.7050790786743164,
0.22179630398750305,
0.7528504729270935,
0.5869261622428894,
0.3483715355396271,
-... |
func AddGlob(a *Archive, pattern, to string, recursive bool) (int, error) {
files, err := filepath.Glob(pattern)
if err != nil {
return -1, err
}
count := 0
for _, file := range files {
fi, _ := os.Stat(file)
dst := filepath.Join(to, fi.Name())
switch {
case fi.Mode().IsRegular():
if _, err := AddFi... | [
-0.778898298740387,
1.316748023033142,
1.0065851211547852,
0.392137736082077,
0.12780795991420746,
0.2720579206943512,
1.3112119436264038,
0.5008129477500916,
0.11543549597263336,
0.21348726749420166,
0.2750972509384155,
0.07950439304113388,
-0.09000620245933533,
0.22210218012332916,
0.1... |
func AddTarContent(a *Archive, file io.Reader, to string) (int, error) {
reader := tar.NewReader(file)
count := 0
for {
hdr, err := reader.Next()
if err != nil {
if err == io.EOF {
break
}
return count, err
}
switch hdr.Typeflag {
case tar.TypeRegA, tar.TypeReg:
if err := readFileFromTar(... | [
-0.7258086204528809,
-0.3238863945007324,
0.7165202498435974,
-0.5551243424415588,
-0.5709609985351562,
-0.04715440049767494,
0.2955620288848877,
0.35550057888031006,
-0.9070659279823303,
0.3291594982147217,
0.5827739834785461,
-0.06560275703668594,
-0.1461123526096344,
-0.1186136603355407... |
func (*UploadImageRequest) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*UploadImageRequest_Info)(nil),
(*UploadImageRequest_Chunk)(nil),
}
} | [
-2.3390841484069824,
-0.06431253999471664,
0.393537312746048,
-0.5634072422981262,
0.39944082498550415,
-0.9493165612220764,
-0.11136171966791153,
-0.9547327756881714,
0.6828091740608215,
0.5278404355049133,
0.16214583814144135,
0.12123630940914154,
0.17223545908927917,
1.4497960805892944,... |
func swap(x, y int) (int, int) {
return y, x
} | [
-2.1065828800201416,
-0.3371109366416931,
0.7770970463752747,
-0.7359529733657837,
-0.41842326521873474,
0.41280514001846313,
-0.45538854598999023,
-0.49074846506118774,
-0.24600695073604584,
-0.8873544931411743,
-0.44920092821121216,
1.1373385190963745,
0.8437291383743286,
-0.851199150085... |
func (o *GetServerConfigImportsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetServerConfigImportsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
retu... | [
-0.14929422736167908,
-0.1455201953649521,
0.7192412614822388,
0.42229920625686646,
-0.1739075928926468,
-1.054355263710022,
0.642012357711792,
-0.6442020535469055,
0.141935333609581,
1.0024396181106567,
-0.2879451811313629,
-0.5088930726051331,
-1.2841070890426636,
0.056275200098752975,
... |
func NewGetServerConfigImportsOK() *GetServerConfigImportsOK {
return &GetServerConfigImportsOK{}
} | [
0.46559107303619385,
0.7763907313346863,
0.31565558910369873,
1.6254158020019531,
-0.3713725507259369,
-0.6899673938751221,
0.8496564626693726,
0.3511497974395752,
-0.5845127701759338,
1.0390290021896362,
-1.3882023096084595,
-0.22875095903873444,
-0.5262932777404785,
0.08227221667766571,
... |
func NewGetServerConfigImportsDefault(code int) *GetServerConfigImportsDefault {
return &GetServerConfigImportsDefault{
_statusCode: code,
}
} | [
0.3812490701675415,
0.41816380620002747,
0.22838929295539856,
0.9181557297706604,
0.5703791379928589,
-0.43267664313316345,
0.34381842613220215,
0.3808589577674866,
-0.23595216870307922,
0.9412177801132202,
-1.6989365816116333,
-0.33658072352409363,
-1.804785966873169,
-0.12282202392816544... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.