text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func GetTypeById(id int) (v *Types, err error) {
o := orm.NewOrm()
v = &Types{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
} | [
0.4120260775089264,
0.3870381712913513,
0.0671566054224968,
0.2901518642902374,
0.947282612323761,
-0.5527883768081665,
0.141713485121727,
-1.329285979270935,
-0.17663687467575073,
0.6021692752838135,
-0.3771960735321045,
-0.5028117895126343,
-1.1373592615127563,
0.5219213962554932,
0.74... |
func GetAllType(query map[string]string, fields []string, sortby []string, order []string,
offset int64, limit int64) (ml []interface{}, err error) {
o := orm.NewOrm()
qs := o.QueryTable(new(Types))
// query k=v
for k, v := range query {
// rewrite dot-notation to Object__Attribute
k = strings.Replace(k, ".", ... | [
-0.2711925804615021,
-0.04484869912266731,
1.1346940994262695,
0.7448904514312744,
0.14068584144115448,
-0.3334718942642212,
-0.39192914962768555,
-0.6399984359741211,
0.08133714646100998,
0.32246163487434387,
0.3205552101135254,
-0.017216257750988007,
-0.12735749781131744,
0.6378344297409... |
func UpdateTypeById(m *Types) (err error) {
o := orm.NewOrm()
v := Types{Id: m.Id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
if num, err = o.Update(m); err == nil {
fmt.Println("Number of records updated in database:", num)
}
}
return
} | [
-0.5695579648017883,
-0.7033082842826843,
0.7287337779998779,
0.10907890647649765,
0.3000883162021637,
-0.11775124073028564,
0.6365305185317993,
-0.47758448123931885,
-0.21161800622940063,
1.3301209211349487,
-0.7183014154434204,
-0.7409325242042542,
-1.1105751991271973,
0.6790953278541565... |
func DeleteType(id int) (err error) {
o := orm.NewOrm()
v := Types{Id: id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
if v.Default == 1 {
return errors.New("默认类型不可删除")
}
var num int64
if num, err = o.Delete(&Types{Id: id}); err == nil {
fmt.Println("Number of records dele... | [
-0.34374046325683594,
0.48207753896713257,
1.0393399000167847,
0.6019083261489868,
1.0374342203140259,
-0.21553857624530792,
0.9074679613113403,
-0.13629914820194244,
0.22796393930912018,
0.3290013074874878,
-0.1746080368757248,
-0.5744453072547913,
-1.1414246559143066,
1.1230015754699707,... |
func NewPeriod(amount sdk.Coins, length int64) vestingtypes.Period {
return vestingtypes.Period{Amount: amount, Length: length}
} | [
0.9280606508255005,
0.022493984550237656,
0.28505200147628784,
-0.016063770279288292,
-0.7458223104476929,
0.7823829650878906,
-0.41436970233917236,
-0.44181811809539795,
1.473022222518921,
0.40096575021743774,
0.16939422488212585,
0.753029465675354,
-0.5329024791717529,
-0.000578025472350... |
func GetTotalVestingPeriodLength(periods vestingtypes.Periods) int64 {
length := int64(0)
for _, period := range periods {
length += period.Length
}
return length
} | [
-0.28815895318984985,
0.6275316476821899,
0.5410965085029602,
0.1538166105747223,
0.7095581293106079,
0.6520258188247681,
0.0686882808804512,
-0.05698660388588905,
2.017340898513794,
0.48464563488960266,
-0.4417555034160614,
-0.930643618106842,
-0.5111356973648071,
-0.4459236264228821,
-... |
func NewServer(c *Config) (*Server, error) {
// validate config
if err := validation.Validate.Struct(c); err != nil {
return nil, fmt.Errorf("invalid config: %v", err)
}
// create root context
ctx, cancel := context.WithCancel(context.Background())
// register handlers
mux := runtime.NewServeMux()
opts := [... | [
-0.3101752996444702,
0.21527962386608124,
0.7315975427627563,
0.1786871999502182,
0.005602116696536541,
0.508797287940979,
0.5971434116363525,
0.25551411509513855,
0.20146748423576355,
-0.049486853182315826,
-0.5913833975791931,
0.3532528579235077,
-0.8061651587486267,
0.2591763138771057,
... |
func (s *Server) Listen() error {
defer s.cancel()
s.log.Infof("grpc-gateway server listening on port %d", s.port)
return http.ListenAndServe(fmt.Sprintf(":%d", s.port), s.mux)
} | [
0.7859394550323486,
-0.8701982498168945,
0.42699289321899414,
-1.0131981372833252,
-0.018151780590415,
0.2254800647497177,
-0.1268710345029831,
0.8209686875343323,
-0.16850492358207703,
0.41054821014404297,
0.01833825558423996,
0.3745321035385132,
-0.49640950560569763,
0.1886703372001648,
... |
func NewLogRecorder() *LogRecorder {
lr := LogRecorder{}
return &lr
} | [
-0.17448003590106964,
-0.44482386112213135,
-0.17080044746398926,
-0.8885128498077393,
-0.845352828502655,
-0.7853252291679382,
-1.6053109169006348,
-0.19223083555698395,
0.18375712633132935,
-0.8453036546707153,
-0.19530963897705078,
0.6927288770675659,
-0.8956784605979919,
1.124081611633... |
func (lr *LogRecorder) Log(log string) {
lr.logs = append(lr.logs, log)
//fmt.Printf("DR: %s\n", log)
} | [
0.30684319138526917,
0.0645471140742302,
0.5768356919288635,
-0.35821533203125,
-0.4236443042755127,
0.6855137944221497,
-0.1381046324968338,
0.5051001310348511,
0.669450044631958,
-1.0526957511901855,
-0.31301647424697876,
0.593754231929779,
-0.7180864810943604,
0.5039988160133362,
0.22... |
func (lr *LogRecorder) LogSlice(logs []string) {
sort.Strings(logs)
for _, log := range logs {
lr.Log(log)
}
} | [
-0.5596351027488708,
-1.2900660037994385,
0.26787811517715454,
-0.12070946395397186,
0.1607728898525238,
-0.2718704044818878,
-1.2720260620117188,
-0.5373196601867676,
-0.2890925109386444,
-0.002822563052177429,
0.2510930001735687,
0.34565457701683044,
-0.3620290756225586,
0.84925937652587... |
func (lr *LogRecorder) GetLogs() []string {
return lr.logs
} | [
0.49386510252952576,
-0.3129562437534332,
0.41762205958366394,
0.049243517220020294,
0.09234151244163513,
0.5057843923568726,
-0.8904606103897095,
-0.8227511644363403,
0.8032999634742737,
0.09372609108686447,
0.22101083397865295,
1.4440762996673584,
-1.1127070188522339,
0.5935325622558594,... |
func myFunc(){ // example of an eternal cycle
i := 0
HERE: // <-- first word on a line ending with a colon is a label
println(i)
i++
goto HERE // <-- Jump
} | [
0.38342177867889404,
-0.34735816717147827,
0.5791468024253845,
-0.001794768264517188,
-0.26660576462745667,
0.3713133931159973,
0.42190831899642944,
0.5975228548049927,
-0.3154858350753784,
0.553933322429657,
0.053739409893751144,
0.6538941264152527,
-0.17136332392692566,
-0.02232564240694... |
func configureFlags(api *operations.LolchestWinAPI) {
// api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... }
} | [
-0.1156935915350914,
0.4240288734436035,
0.16229429841041565,
0.16407352685928345,
0.71928471326828,
-0.3718050420284271,
0.10956104099750519,
-0.3153279423713684,
-0.3962584435939789,
-0.5551586151123047,
-0.5541487336158752,
-0.11565717309713364,
-1.2181918621063232,
1.4088101387023926,
... |
func configureTLS(tlsConfig *tls.Config) {
// Make all necessary changes to the TLS configuration here.
} | [
0.47939756512641907,
0.40804848074913025,
0.3549412190914154,
-0.3323724865913391,
-0.2388513684272766,
-0.19460536539554596,
-0.016701387241482735,
0.9700636267662048,
0.8824155926704407,
0.5949287414550781,
-0.9719791412353516,
-0.5662629008293152,
0.9028839468955994,
0.2598060965538025,... |
func setupMiddlewares(handler http.Handler) http.Handler {
return handler
} | [
-0.39171406626701355,
-0.40465793013572693,
0.2157735824584961,
0.04118415340781212,
-0.7074241042137146,
0.18857896327972412,
0.40157604217529297,
-0.3453899323940277,
1.4809798002243042,
-0.3703938126564026,
0.01971183717250824,
0.05063294246792793,
-0.4930081367492676,
1.335522651672363... |
func setupGlobalMiddleware(handler http.Handler) http.Handler {
return cors.Default().Handler(handler)
} | [
-0.029837757349014282,
-0.2818668484687805,
0.4763510227203369,
0.2864786982536316,
-0.840234637260437,
0.7008671760559082,
-0.3436869978904724,
0.571399450302124,
0.11377059668302536,
0.564674437046051,
-0.06782735139131546,
0.7340308427810669,
-0.500299334526062,
1.1493568420410156,
-0... |
func (k Kind) String() string {
return kindNames[k]
} | [
0.13326828181743622,
-0.6148219108581543,
0.05710964649915695,
-0.2835799753665924,
-1.1838513612747192,
1.0753190517425537,
0.2916674017906189,
-1.8361262083053589,
-0.6083488464355469,
0.818107008934021,
0.5081657767295837,
1.1785573959350586,
-0.32660147547721863,
-0.02504541166126728,
... |
func (b *books) Open() error {
var err error
b.db, err = sql.Open("sqlite3", b.dsn)
return err
} | [
-0.5817622542381287,
0.9204318523406982,
0.1467120349407196,
0.6354614496231079,
-0.07440316677093506,
1.1084976196289062,
-0.07643844932317734,
1.2911266088485718,
-0.4580196142196655,
0.1631314605474472,
0.42462158203125,
-0.0893084928393364,
-0.9042776226997375,
0.07762925326824188,
0... |
func (b *books) Close() {
b.db.Close()
} | [
-0.42063117027282715,
-0.3154771327972412,
0.29229456186294556,
1.1436192989349365,
0.1637052297592163,
1.7191070318222046,
0.1345675140619278,
-0.03915524482727051,
-1.2046245336532593,
-0.5581069588661194,
0.7903257012367249,
-0.6433086395263672,
-1.542602300643921,
1.5407077074050903,
... |
func (b *books) Remove(id string) bool {
if !b.isOpen() {
log.Panic("Repositorio não aberto")
}
_, err := b.db.Exec("DELETE FROM CAD_BOOKS WHERE COD_BOOK = ?", id)
return err == nil
} | [
-0.6921842098236084,
0.6739817261695862,
0.5293534398078918,
0.42574843764305115,
-0.4367448091506958,
0.6987866163253784,
-0.13407626748085022,
0.650557816028595,
-0.6469294428825378,
0.38704195618629456,
-0.280348002910614,
-1.1670717000961304,
-1.2908878326416016,
0.008859480731189251,
... |
func (a *LicenseAgreementApiService) AcceptLicenseAgreement(ctx _context.Context) ApiAcceptLicenseAgreementRequest {
return ApiAcceptLicenseAgreementRequest{
ApiService: a,
ctx: ctx,
}
} | [
-1.0006530284881592,
-0.7679625153541565,
0.7667343020439148,
-0.5657963752746582,
-1.702178716659546,
0.07112167775630951,
0.36436277627944946,
0.43607667088508606,
0.04336169734597206,
0.7675320506095886,
-0.041348811239004135,
1.1118890047073364,
-0.7195956110954285,
0.9368011951446533,... |
func (a *LicenseAgreementApiService) AcceptLicenseAgreementExecute(r ApiAcceptLicenseAgreementRequest) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
local... | [
-0.1284068375825882,
-0.8679081201553345,
0.984961211681366,
-0.18473659455776215,
-0.6394417881965637,
0.2271697074174881,
0.37544047832489014,
0.6635984182357788,
-0.21927250921726227,
1.2154953479766846,
0.25131839513778687,
0.7310783863067627,
-1.270342230796814,
0.5156027674674988,
... |
func (a *LicenseAgreementApiService) DownloadLicenseAgreementFile(ctx _context.Context) ApiDownloadLicenseAgreementFileRequest {
return ApiDownloadLicenseAgreementFileRequest{
ApiService: a,
ctx: ctx,
}
} | [
0.20300276577472687,
-0.5893353223800659,
0.6970173716545105,
-0.10180769860744476,
-0.18958799540996552,
0.8088435530662537,
0.813049852848053,
0.4024917185306549,
-0.9785107374191284,
0.057369597256183624,
0.41196340322494507,
0.6888912320137024,
-0.7482259273529053,
0.4109545946121216,
... |
func (a *LicenseAgreementApiService) DownloadLicenseAgreementFileExecute(r ApiDownloadLicenseAgreementFileRequest) (*os.File, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes... | [
-0.15335462987422943,
-0.6384612917900085,
0.9092968106269836,
-0.37503862380981445,
-0.08431582152843475,
0.04527973383665085,
0.32168498635292053,
0.3965379595756531,
-0.5553270578384399,
0.869243860244751,
0.21760238707065582,
0.7144854664802551,
-1.4990330934524536,
0.5046097636222839,... |
func (a *LicenseAgreementApiService) GetCurrentLicenseAgreementAccepted(ctx _context.Context) ApiGetCurrentLicenseAgreementAcceptedRequest {
return ApiGetCurrentLicenseAgreementAcceptedRequest{
ApiService: a,
ctx: ctx,
}
} | [
-0.3116571307182312,
-1.2352792024612427,
0.8247883915901184,
-0.5113475918769836,
-1.69688081741333,
0.28942692279815674,
0.35254526138305664,
0.3859369158744812,
-0.5383113026618958,
1.056748390197754,
0.87989342212677,
1.7511769533157349,
-0.4013468325138092,
0.11119773983955383,
0.94... |
func (a *LicenseAgreementApiService) GetCurrentLicenseAgreementAcceptedExecute(r ApiGetCurrentLicenseAgreementAcceptedRequest) (LicenseAgreementAcceptResult, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileNam... | [
-0.45938554406166077,
-0.7815440893173218,
1.1132124662399292,
-0.6156960129737854,
-1.1960562467575073,
-0.006949933711439371,
0.09515619277954102,
0.3615185022354126,
-0.6957412362098694,
1.1857869625091553,
0.5918530225753784,
1.234095811843872,
-1.0891339778900146,
0.11313463002443314,... |
func (a *LicenseAgreementApiService) GetLicenseAgreement(ctx _context.Context) ApiGetLicenseAgreementRequest {
return ApiGetLicenseAgreementRequest{
ApiService: a,
ctx: ctx,
}
} | [
-0.4212755560874939,
-0.39646977186203003,
0.6792091131210327,
-0.16678747534751892,
-0.7313357591629028,
-0.7961880564689636,
-0.055957090109586716,
-0.3161020874977112,
0.006754606030881405,
0.10015839338302612,
0.2242388129234314,
1.4639673233032227,
-1.1121950149536133,
0.5327404737472... |
func (a *LicenseAgreementApiService) GetLicenseAgreementExecute(r ApiGetLicenseAgreementRequest) (LicenseAgreements, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byt... | [
-0.47910216450691223,
-0.4890092611312866,
1.0474482774734497,
-0.1870911419391632,
-0.42259475588798523,
-0.43353307247161865,
-0.04483512416481972,
0.029571613296866417,
-0.3844194710254669,
1.0455838441848755,
0.03448304906487465,
0.8353310227394104,
-1.324692964553833,
0.14713403582572... |
func (row *Row) Compatible(aRow *Row, selectors []*ColSelector, db, table string) (bool, error) {
for _, sel := range selectors {
c := EncodeSelector(sel.resolve(db, table))
val1, ok := row.Values[c]
if !ok {
return false, ErrInvalidColumn
}
val2, ok := aRow.Values[c]
if !ok {
return false, ErrInva... | [
-0.6080396771430969,
-0.5123443007469177,
0.7972729802131653,
0.7899194359779358,
-0.1294977366924286,
0.4876139461994171,
-0.40632402896881104,
-0.019898544996976852,
0.08728872984647751,
0.52202308177948,
-0.046672701835632324,
-1.1144500970840454,
-0.2006317526102066,
0.1674421727657318... |
func (client *Client) UpdateDcdnDeliverTask(request *UpdateDcdnDeliverTaskRequest) (response *UpdateDcdnDeliverTaskResponse, err error) {
response = CreateUpdateDcdnDeliverTaskResponse()
err = client.DoAction(request, response)
return
} | [
-0.21328480541706085,
-0.2586902678012848,
0.7282363772392273,
0.828838586807251,
-1.0338819026947021,
0.5685530304908752,
0.40009433031082153,
0.3628588020801544,
0.5124773979187012,
-0.3201087713241577,
-1.1388912200927734,
0.473785936832428,
-0.18846285343170166,
0.12582510709762573,
... |
func (client *Client) UpdateDcdnDeliverTaskWithChan(request *UpdateDcdnDeliverTaskRequest) (<-chan *UpdateDcdnDeliverTaskResponse, <-chan error) {
responseChan := make(chan *UpdateDcdnDeliverTaskResponse, 1)
errChan := make(chan error, 1)
err := client.AddAsyncTask(func() {
defer close(responseChan)
defer close(... | [
-0.3022843599319458,
-0.3611343801021576,
0.9143980741500854,
0.20537069439888,
-0.6895980834960938,
0.42292121052742004,
0.1447967141866684,
-0.40381455421447754,
0.5769091248512268,
-0.14010758697986603,
-0.2664387822151184,
0.2574048340320587,
0.17166267335414886,
0.6403728723526001,
... |
func (client *Client) UpdateDcdnDeliverTaskWithCallback(request *UpdateDcdnDeliverTaskRequest, callback func(response *UpdateDcdnDeliverTaskResponse, err error)) <-chan int {
result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *UpdateDcdnDeliverTaskResponse
var err error
defer close(res... | [
-0.10443747788667679,
0.10501343756914139,
0.9854094982147217,
0.3890279531478882,
-0.7398710250854492,
0.2816651165485382,
0.26629576086997986,
-0.018127743154764175,
1.0786900520324707,
0.002310359152033925,
-0.43720078468322754,
-0.3848794102668762,
0.21131092309951782,
0.61711102724075... |
func CreateUpdateDcdnDeliverTaskRequest() (request *UpdateDcdnDeliverTaskRequest) {
request = &UpdateDcdnDeliverTaskRequest{
RpcRequest: &requests.RpcRequest{},
}
request.InitWithApiInfo("dcdn", "2018-01-15", "UpdateDcdnDeliverTask", "", "")
request.Method = requests.POST
return
} | [
0.18486559391021729,
-0.5631060004234314,
0.7067880630493164,
0.42247411608695984,
-0.4041707515716553,
0.49715638160705566,
-0.06659100949764252,
0.4659918546676636,
0.06234990432858467,
-0.0819370374083519,
-0.7523815631866455,
0.38334861397743225,
0.09577459841966629,
0.8045802712440491... |
func CreateUpdateDcdnDeliverTaskResponse() (response *UpdateDcdnDeliverTaskResponse) {
response = &UpdateDcdnDeliverTaskResponse{
BaseResponse: &responses.BaseResponse{},
}
return
} | [
0.046442270278930664,
-1.177939534187317,
0.3843350410461426,
0.45491012930870056,
-0.5116064548492432,
0.30670350790023804,
0.5889956951141357,
0.24529984593391418,
0.7166441082954407,
0.015356098301708698,
-1.1915935277938843,
-0.6878184080123901,
-0.23053793609142303,
0.5629367232322693... |
func NewDeleteAction(model store.ClusterManagerModel) *DeleteAction {
return &DeleteAction{
model: model,
}
} | [
0.3808286488056183,
-0.9133080244064331,
0.16614925861358643,
0.48525387048721313,
-0.3971906900405884,
-0.2006932646036148,
0.4647776782512665,
-1.1049779653549194,
0.7159461975097656,
0.9036977887153625,
-0.8214200139045715,
0.6827862858772278,
-0.6513537168502808,
0.25028085708618164,
... |
func (da *DeleteAction) Handle(
ctx context.Context, req *cmproto.DeleteNodeGroupRequest, resp *cmproto.DeleteNodeGroupResponse) {
if req == nil || resp == nil {
blog.Errorf("delete cloud failed, req or resp is empty")
return
}
da.ctx = ctx
da.req = req
da.resp = resp
da.resp.Data = &cmproto.DeleteNodeGroupR... | [
-0.7495313882827759,
0.6320054531097412,
0.7063601613044739,
-0.15100854635238647,
0.1972726434469223,
-0.0732719898223877,
1.359339714050293,
-0.48721539974212646,
-0.26030048727989197,
0.15668706595897675,
0.26901501417160034,
0.4485512673854828,
-0.6329556107521057,
0.5125361680984497,
... |
func NewRemoveNodeAction(model store.ClusterManagerModel) *RemoveNodeAction {
return &RemoveNodeAction{
model: model,
}
} | [
-0.6735649108886719,
-0.5153485536575317,
0.2994709312915802,
0.12792707979679108,
-0.5704531669616699,
-0.7419788837432861,
0.8387197256088257,
-0.15489071607589722,
0.5761452913284302,
1.4700448513031006,
-0.8947333693504333,
0.2039460986852646,
-0.6853521466255188,
0.030424021184444427,... |
func (da *RemoveNodeAction) Handle(
ctx context.Context, req *cmproto.RemoveNodesFromGroupRequest, resp *cmproto.RemoveNodesFromGroupResponse) {
if req == nil || resp == nil {
blog.Errorf("RemoveNodeFromGroup failed, req or resp is empty")
return
}
da.ctx = ctx
da.req = req
da.resp = resp
if err := da.valid... | [
-0.7628705501556396,
0.7421613335609436,
0.8009373545646667,
-0.2982056736946106,
0.3366774022579193,
-0.2712787985801697,
1.3941459655761719,
-0.12844058871269226,
-0.2696518898010254,
0.3780688941478729,
0.17249053716659546,
0.5826798677444458,
-0.8922475576400757,
0.1304008662700653,
... |
func NewCleanNodesAction(model store.ClusterManagerModel) *CleanNodesAction {
return &CleanNodesAction{
model: model,
}
} | [
-0.376371294260025,
-0.32098183035850525,
-0.1312578171491623,
-0.010302457958459854,
-1.093902349472046,
-0.61127769947052,
1.360451579093933,
-0.81095290184021,
0.38055771589279175,
2.020699977874756,
-0.7190255522727966,
1.106368064880371,
-0.0887446328997612,
0.23048998415470123,
-1.... |
func (da *CleanNodesAction) Handle(
ctx context.Context, req *cmproto.CleanNodesInGroupRequest, resp *cmproto.CleanNodesInGroupResponse) {
if req == nil || resp == nil {
blog.Errorf("CleanNodesAction failed, req or resp is empty")
return
}
da.ctx = ctx
da.req = req
da.resp = resp
if err := da.validate(); er... | [
-0.5827648043632507,
0.8212082982063293,
0.7910716533660889,
-0.04768136888742447,
-0.08485199511051178,
0.08961911499500275,
1.6711663007736206,
-0.28854748606681824,
-0.15181638300418854,
0.3531697690486908,
-0.054912663996219635,
0.6011189222335815,
-0.34187328815460205,
-0.029362786561... |
func getPort() string {
var PORT = os.Getenv("PORT")
if PORT == "" {
PORT = "9001"
fmt.Println("no port set in environment variable, using default port " + PORT)
}
return ":" + PORT
} | [
0.7018730640411377,
0.0841723158955574,
0.5748465061187744,
0.7901073694229126,
0.9572671055793762,
0.6598681807518005,
0.18650443851947784,
-0.017888570204377174,
-0.3507288992404938,
0.24217939376831055,
0.6656748652458191,
0.5689843893051147,
-0.3687542676925659,
0.10946574062108994,
... |
func (in *KeptnCore) DeepCopyInto(out *KeptnCore) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
return
} | [
0.4843083322048187,
-0.427452951669693,
0.6228318810462952,
-0.039541203528642654,
-0.6001909971237183,
0.8367460370063782,
0.021160276606678963,
0.6628671288490295,
-1.0894206762313843,
-0.2828264534473419,
-0.7566757202148438,
1.6279265880584717,
0.13718047738075256,
-0.04972228035330772... |
func (in *KeptnCore) DeepCopy() *KeptnCore {
if in == nil {
return nil
}
out := new(KeptnCore)
in.DeepCopyInto(out)
return out
} | [
-0.38773179054260254,
0.1188775822520256,
0.3835788369178772,
1.0384325981140137,
-0.5986148715019226,
0.678346574306488,
0.2036682367324829,
-0.08962934464216232,
0.21425236761569977,
-0.0678241029381752,
-0.7049000263214111,
0.5960646867752075,
-1.0167673826217651,
-0.1125018298625946,
... |
func (in *KeptnCore) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | [
-0.06616470962762833,
-0.24166995286941528,
0.6107336282730103,
0.44599035382270813,
-0.686582088470459,
1.1079806089401245,
0.7185785174369812,
0.017288891598582268,
-0.2903989255428314,
-0.5878639817237854,
-0.5884875655174255,
0.10097092390060425,
-0.19381576776504517,
-0.09378025680780... |
func (in *KeptnCoreList) DeepCopyInto(out *KeptnCoreList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]KeptnCore, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | [
-0.25668951869010925,
0.3298254609107971,
0.7224454879760742,
-0.2887915372848511,
-0.24600619077682495,
0.23459485173225403,
-0.32864949107170105,
0.962730348110199,
-0.6290023922920227,
-0.13778850436210632,
-1.3522131443023682,
1.0149551630020142,
-0.5158036351203918,
-0.081234134733676... |
func (in *KeptnCoreList) DeepCopy() *KeptnCoreList {
if in == nil {
return nil
}
out := new(KeptnCoreList)
in.DeepCopyInto(out)
return out
} | [
-1.1860908269882202,
0.610024631023407,
0.4337572157382965,
0.264636367559433,
0.0005113428342156112,
0.38831859827041626,
-0.4659419059753418,
0.3828454911708832,
0.33206120133399963,
-0.3404565155506134,
-1.696815848350525,
0.5712785124778748,
-0.714135468006134,
-0.5173759460449219,
0... |
func (in *KeptnCoreList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | [
-0.2968803942203522,
0.22673195600509644,
0.6152650117874146,
0.005071766674518585,
-0.3454163670539856,
0.8273528814315796,
0.4315260946750641,
0.304962694644928,
-0.0506749227643013,
-0.8435894250869751,
-1.0734736919403076,
0.2931995987892151,
-0.5022895932197571,
-0.4526432752609253,
... |
func (in *KeptnCoreSpec) DeepCopyInto(out *KeptnCoreSpec) {
*out = *in
return
} | [
0.9318137168884277,
0.190839022397995,
0.46648287773132324,
-0.23472708463668823,
-0.4370402693748474,
0.7333822846412659,
-0.04039238020777702,
0.8170445561408997,
-1.119882583618164,
-0.574188232421875,
-1.032910943031311,
1.3950835466384888,
0.24429698288440704,
-0.24795830249786377,
... |
func (in *KeptnCoreSpec) DeepCopy() *KeptnCoreSpec {
if in == nil {
return nil
}
out := new(KeptnCoreSpec)
in.DeepCopyInto(out)
return out
} | [
0.047421082854270935,
0.4530538320541382,
0.3895743191242218,
0.0777919664978981,
-0.05382528528571129,
0.3449164927005768,
0.0629926472902298,
0.15728534758090973,
-0.16619271039962769,
-0.37681546807289124,
-0.6645318269729614,
0.5309907793998718,
-0.07016465067863464,
-0.455593019723892... |
func (in *KeptnCoreStatus) DeepCopyInto(out *KeptnCoreStatus) {
*out = *in
return
} | [
1.0049829483032227,
0.30935513973236084,
0.36573347449302673,
0.1501472443342209,
-0.7426373362541199,
1.040434718132019,
-0.39304810762405396,
0.4005468189716339,
-1.033467411994934,
-0.8798189759254456,
-1.0935688018798828,
1.3965816497802734,
-0.12101016938686371,
-0.6162272691726685,
... |
func (in *KeptnCoreStatus) DeepCopy() *KeptnCoreStatus {
if in == nil {
return nil
}
out := new(KeptnCoreStatus)
in.DeepCopyInto(out)
return out
} | [
0.15066280961036682,
0.4328143894672394,
0.22031787037849426,
0.3201179504394531,
-0.2883225679397583,
0.8106586337089539,
-0.04287230595946312,
-0.3575969338417053,
-0.24338793754577637,
-0.7699918150901794,
-1.0535863637924194,
0.4384044110774994,
-0.4501093029975891,
-0.2187743782997131... |
func (*MarkdownData) Descriptor() ([]byte, []int) {
return file_adarender_proto_rawDescGZIP(), []int{0}
} | [
-0.6392897963523865,
0.3165043890476227,
0.23597723245620728,
0.005823255516588688,
-0.8295023441314697,
0.803472101688385,
-0.15671148896217346,
0.36879006028175354,
-1.05607271194458,
-0.9814577698707581,
0.12274284660816193,
0.6658720374107361,
-0.5363786816596985,
0.6793102025985718,
... |
func (*MarkdownStream) Descriptor() ([]byte, []int) {
return file_adarender_proto_rawDescGZIP(), []int{1}
} | [
-0.4956631064414978,
0.2900600731372833,
0.5767532587051392,
0.41628238558769226,
-0.8564335107803345,
-0.3903207778930664,
0.023565417155623436,
0.28516605496406555,
-0.537953794002533,
-1.0870797634124756,
-0.038087062537670135,
0.6016504764556885,
-0.4893236756324768,
1.4233109951019287... |
func (*HTMLData) Descriptor() ([]byte, []int) {
return file_adarender_proto_rawDescGZIP(), []int{2}
} | [
-0.9514667987823486,
1.235889196395874,
0.3125089108943939,
-0.5991330146789551,
-0.6784627437591553,
1.058779001235962,
-0.3245701789855957,
0.15924236178398132,
-0.35792097449302673,
-0.9749975204467773,
-0.1971045434474945,
0.9187127351760864,
0.3235829174518585,
0.5096136331558228,
0... |
func (*HTMLStream) Descriptor() ([]byte, []int) {
return file_adarender_proto_rawDescGZIP(), []int{3}
} | [
-0.4285985231399536,
0.9967071413993835,
0.4468332827091217,
-0.06674359738826752,
-0.8801056742668152,
-0.13954444229602814,
-0.05361195653676987,
0.16905392706394196,
-0.0388924703001976,
-1.2348166704177856,
-0.2769020199775696,
0.5248493552207947,
0.36163613200187683,
1.196510314941406... |
func (_m *PermissionRepository) FindAll(permissions []string) ([]domain.Permission, error) {
ret := _m.Called(permissions)
var r0 []domain.Permission
if rf, ok := ret.Get(0).(func([]string) []domain.Permission); ok {
r0 = rf(permissions)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]domain.Permission)
... | [
-0.29906219244003296,
-0.16857001185417175,
0.5851001143455505,
0.8749191164970398,
-0.34355634450912476,
-0.5457079410552979,
0.4965094327926636,
0.1684449464082718,
-0.023632967844605446,
0.19549359381198883,
0.3739900588989258,
0.023283664137125015,
-0.4571564495563507,
0.94581705331802... |
func (_m *PermissionRepository) FindBySystemTokenID(systemTokenId string) ([]domain.Permission, error) {
ret := _m.Called(systemTokenId)
var r0 []domain.Permission
if rf, ok := ret.Get(0).(func(string) []domain.Permission); ok {
r0 = rf(systemTokenId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]domai... | [
0.6578832864761353,
-0.4191376864910126,
0.07958333194255829,
0.2314736396074295,
0.4549451172351837,
-1.0219436883926392,
-0.18269677460193634,
-0.30826446413993835,
-0.14138618111610413,
0.23350264132022858,
-1.1564058065414429,
-0.21341067552566528,
-0.9648423194885254,
1.12663567066192... |
func isIndex(path string) bool {
return strings.HasSuffix(path, "_index.md")
} | [
-0.6777225732803345,
-0.18842138350009918,
0.4696597158908844,
0.6260970234870911,
-0.7303892970085144,
0.16486334800720215,
0.41344791650772095,
0.3742949068546295,
0.8247074484825134,
0.19131195545196533,
-0.5187493562698364,
0.3445664942264557,
-0.384308397769928,
-0.48428332805633545,
... |
func isMdFile(path string) bool {
return strings.HasSuffix(path, ".md")
} | [
0.3219844400882721,
-0.07440019398927689,
0.7508302927017212,
0.42536109685897827,
-0.9251917004585266,
0.8631802201271057,
-0.6774407029151917,
0.44999024271965027,
0.1694898009300232,
-0.2756371796131134,
0.262719988822937,
0.38313281536102295,
-0.43481680750846863,
0.4419240653514862,
... |
func titleFromPath(path string) string {
base := filepath.Base(path)
fileName := strings.TrimSuffix(base, filepath.Ext(base))
return utils.UnSlugify(fileName)
} | [
0.3115217983722687,
-1.2707446813583374,
0.518243134021759,
-0.6870720386505127,
-0.8731843829154968,
0.11143622547388077,
-0.9122543334960938,
-0.2371377795934677,
-0.3594709634780884,
0.37123870849609375,
-0.08069983124732971,
-0.3488844931125641,
-0.26508358120918274,
-0.996693730354309... |
func replaceRoot(url string) string {
rootUrl := viper.GetString("replaceRoot")
url = strings.TrimPrefix(url, strings.ToLower(rootUrl))
if len(url) == 0 {
return "/"
}
return url
} | [
0.5848778486251831,
-0.11309891194105148,
0.5153710246086121,
0.015917522832751274,
-0.30267971754074097,
-0.4071783125400543,
0.35620781779289246,
0.9598674774169922,
0.7058890461921692,
-0.053203947842121124,
-0.24638859927654266,
1.115182876586914,
-1.0184311866760254,
0.789011955261230... |
func GetCityInfo(u url.URL) (CityInfo, error) {
var ci CityInfo
res, err := http.Get(u.String())
if err != nil {
return ci, err
}
defer res.Body.Close()
// Parse the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return ci, err
}
// Find city and country
doc.Find(".b... | [
0.33582672476768494,
-0.06339111179113388,
0.6570443511009216,
-0.3993469476699829,
-0.39866775274276733,
-0.23968088626861572,
0.37784242630004883,
0.23573008179664612,
-0.3851465880870819,
0.1865098923444748,
0.08820440620183945,
-0.41389384865760803,
-0.2157089114189148,
0.8541856408119... |
func GetCitiesURLs() []url.URL {
numbeoURL := "https://www.numbeo.com/cost-of-living/rankings_current.jsp"
res, err := http.Get(numbeoURL)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
// Parse the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
log.Fatal(err)
}... | [
-0.05546654388308525,
0.5310856699943542,
0.4048324227333069,
-0.09436696767807007,
0.16826525330543518,
0.10706938058137894,
-0.09081979095935822,
0.277946799993515,
-0.3815056383609772,
0.41884371638298035,
0.2043963074684143,
-0.36305463314056396,
-0.281185120344162,
0.8473886251449585,... |
func Test_ParseFrame(t *testing.T) {
data := [][]byte{
{0x10, 0x81, 0x0, 0x0, 0x05, 0xff, 0x01, 0x01, 0x30, 0x01, 0x62, 0x02, 0xbb, 0x00, 0xbe, 0x00},
}
got, err := ParseFrame(data[0])
if err != nil {
t.Error(err)
}
log.Printf("[%v] %v\n", "", got)
want := Frame{
Data: Data{0x10, 0x81, 0x0, 0x0, 0x05, 0... | [
0.24158838391304016,
0.07068654149770737,
0.8600187301635742,
-0.17861557006835938,
0.6193593144416809,
-0.12755022943019867,
0.30984142422676086,
-0.5838232040405273,
0.19797956943511963,
-0.8063262104988098,
-0.5153778791427612,
0.5911399722099304,
-0.8208106160163879,
0.1578408479690551... |
func main() {
a := [][]string{[]string{"James", "Bond", "Shaken, not stirred"},[]string{"Miss", "Moneypenny", "Helloooooo, James."}}
fmt.Println(a)
for _, v := range a {
fmt.Println(v)
for _,j := range v {
fmt.Println(j)
}
}
} | [
0.2937600612640381,
-0.9473251104354858,
0.8510773181915283,
-0.35660678148269653,
0.1189238652586937,
0.008541806600987911,
0.23288790881633759,
-0.4069690704345703,
-0.25290176272392273,
-0.10628856718540192,
0.14135025441646576,
0.40359073877334595,
0.3756636381149292,
-0.33101925253868... |
func (pk *PublicKey) Sha() string {
return PublicKeySha(pk.Key)
} | [
-0.17464791238307953,
0.3571089208126068,
0.38542380928993225,
0.16978900134563446,
-0.48669931292533875,
0.4091185927391052,
-0.5656322240829468,
0.3114781081676483,
0.15360765159130096,
0.2732842266559601,
0.24314101040363312,
0.24060852825641632,
0.78952956199646,
0.42680448293685913,
... |
func PublicKeySha(key string) string {
return fmt.Sprintf("%x", sha1.Sum([]byte(key))) // nolint: gosec
} | [
0.0726809948682785,
0.266421377658844,
0.5157353281974792,
-0.019999494776129723,
-1.518553376197815,
0.15633295476436615,
-0.5552377104759216,
-0.5247787833213806,
-0.13673135638237,
0.7025835514068604,
-0.2451673150062561,
0.6231787204742432,
-0.06193995475769043,
0.6662092804908752,
-... |
func (az *AzureClient) EnsureDefaultLogAnalyticsWorkspace(ctx context.Context, resourceGroup, location string) (workspaceResourceID string, err error) {
AzureCloudLocationToOmsRegionCodeMap := map[string]string{
"australiasoutheast": "ASE",
"australiaeast": "EAU",
"australiacentral": "CAU",
"canadacentr... | [
0.45796486735343933,
-0.23009732365608215,
0.6379157900810242,
-1.0129079818725586,
0.3160359859466553,
-0.09493397921323776,
0.3180014193058014,
-0.3129861354827881,
0.6860588788986206,
-0.16453206539154053,
-0.39827972650527954,
0.3177478611469269,
0.15923142433166504,
0.2284985482692718... |
func (az *AzureClient) GetLogAnalyticsWorkspaceInfo(ctx context.Context, workspaceSubscriptionID, workspaceResourceGroup, workspaceName string) (workspaceID string, workspaceKey string, workspaceLocation string, err error) {
if !strings.EqualFold(workspaceSubscriptionID, az.subscriptionID) {
az.workspacesClient = oi... | [
0.44135743379592896,
-0.21475082635879517,
0.5298206210136414,
-0.7193436026573181,
-0.5920212864875793,
-0.5508622527122498,
0.22346998751163483,
-0.7332897782325745,
0.18578939139842987,
0.10256168991327286,
-0.12280814349651337,
0.8281456232070923,
-0.26321542263031006,
0.41483071446418... |
func (az *AzureClient) AddContainerInsightsSolution(ctx context.Context, workspaceSubscriptionID, workspaceResourceGroup, workspaceName, workspaceLocation string) (result bool, err error) {
solutionClient := om.NewSolutionsClientWithBaseURI(az.environment.ResourceManagerEndpoint, workspaceSubscriptionID, "Microsoft.Op... | [
-0.4200972616672516,
-0.1375126987695694,
0.7680624723434448,
-0.9341342449188232,
-0.5653358697891235,
-0.30120688676834106,
0.460858553647995,
-0.8943721652030945,
0.8557912707328796,
0.3989656865596771,
0.2210017889738083,
-0.04450325667858124,
-1.0457658767700195,
-0.08564309775829315,... |
func InsertHandlerForHTTP(req *http.Request) error {
extraLabels, err := parserCommon.GetExtraLabels(req)
if err != nil {
return err
}
ce := req.Header.Get("Content-Encoding")
return stream.Parse(req.Body, ce, func(series []parser.Series) error {
return insertRows(series, extraLabels)
})
} | [
-0.4663987457752228,
0.7297279238700867,
0.642702043056488,
-0.38210850954055786,
0.04100295528769493,
0.6328575015068054,
-0.3813099265098572,
0.3675907254219055,
-0.8622726798057556,
0.36067086458206177,
0.3746691942214966,
-0.6495910882949829,
-0.8132041096687317,
0.4479391276836395,
... |
func NewAuthenticationServer(rsaPrivateKey string) (*Auth, error) {
key, err := ioutil.ReadFile(rsaPrivateKey)
if err != nil {
return nil, fmt.Errorf("error reading jwt private key: %w", err)
}
parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key)
if err != nil {
return nil, fmt.Errorf("error parsing jwt privat... | [
-1.6235506534576416,
-0.7137506604194641,
0.2061130404472351,
-0.08640585094690323,
-1.2126996517181396,
-0.20900385081768036,
0.44259029626846313,
-0.3918531835079193,
0.6639922261238098,
0.8010510802268982,
-0.8548693656921387,
-0.07054197788238525,
-0.7284747362136841,
0.312664777040481... |
func NewAuthenticationServerWithTemporaryKey() (*Auth, error) {
auth := new(Auth)
var err error
auth.jwtPrivatekey, err = rsa.GenerateKey(rand.Reader, 2048)
auth.authProviders = make(map[string]AuthProvider)
auth.serviceAccounts = make(map[string]struct{})
return auth, err
} | [
-1.824018120765686,
-0.4498462378978729,
0.2571857273578644,
0.051172949373722076,
-1.1470481157302856,
-0.1601807177066803,
0.1279047429561615,
-0.5900634527206421,
1.010574221611023,
0.4762362837791443,
-1.1846500635147095,
0.04627333581447601,
-0.23185034096240997,
0.6487887501716614,
... |
func (auth *Auth) RegisterServer(s *grpc.Server) {
apiv1.RegisterAuthenticatorServer(s, auth)
} | [
-2.7572858333587646,
-0.2903502881526947,
0.1229064017534256,
0.6921194195747375,
0.6111101508140564,
-0.18998853862285614,
0.129764124751091,
0.8116220831871033,
0.6809179186820984,
-0.48286256194114685,
-1.2805851697921753,
1.2693694829940796,
-0.8123798370361328,
0.7081663012504578,
0... |
func (auth *Auth) RegisterHTTPProxy(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error {
return apiv1.RegisterAuthenticatorHandlerFromEndpoint(ctx, mux, endpoint, opts)
} | [
-1.2588526010513306,
0.26101264357566833,
0.5673819780349731,
0.08358216285705566,
-0.0720263421535492,
0.30154043436050415,
-0.6992255449295044,
-0.4608214795589447,
-0.28799059987068176,
-0.558201014995575,
-1.1399816274642944,
0.5499935150146484,
-0.943671703338623,
0.0802449882030487,
... |
func (auth *Auth) Close() error { return nil } | [
-0.4402487277984619,
-0.34478437900543213,
0.4454956650733948,
0.7938488721847534,
-1.0912240743637085,
0.7847991585731506,
0.5509946942329407,
-0.5024139881134033,
0.5487346649169922,
-0.7450546026229858,
0.46963629126548767,
0.7872995138168335,
-0.7212062478065491,
0.4321281611919403,
... |
func (auth *Auth) RegisterAuthProvider(uri string, name string, ap AuthProvider, service bool) {
if _, exists := auth.authProviders[uri]; exists {
panic("authentication provider already registered for uri: " + uri)
}
auth.authProviders[uri] = ap
if service {
auth.serviceAccounts[uri] = struct{}{}
}
log.Printf... | [
-1.073754906654358,
0.37046340107917786,
0.3332666754722595,
-0.06715000420808792,
-0.32699817419052124,
0.2208351045846939,
-0.8304086327552795,
-0.8991339802742004,
1.4912136793136597,
-0.014250831678509712,
-0.424171507358551,
0.9579237699508667,
-0.3212422728538513,
-0.0454459264874458... |
func (auth *Auth) Login(ctx context.Context, r *apiv1.LoginRequest) (*apiv1.LoginResponse, error) {
if auth.jwtPrivatekey == nil {
return nil, status.Errorf(codes.Internal, "no private key specified for signing jwt token")
}
if _, found := auth.authProviders[r.GetUser().GetSystem()]; !found {
log.Printf("auth: f... | [
-0.7553606033325195,
-0.09017354249954224,
0.8167462348937988,
0.4337730407714844,
-0.9694042205810547,
-0.027503497898578644,
0.12661537528038025,
-0.8680993318557739,
0.9839965105056763,
-0.33262428641319275,
0.24391521513462067,
1.0740852355957031,
-0.41710609197616577,
0.41334074735641... |
func (auth *Auth) Refresh(ctx context.Context, r *apiv1.TokenRefreshRequest) (*apiv1.LoginResponse, error) {
ucd := GetContextData(ctx)
// do we really need to refresh token? send old one back if there is plenty of time
remaining := ucd.GetTokenExpiresAt().Sub(time.Now())
if remaining > 5*time.Minute {
log.Printf... | [
-0.37703239917755127,
-0.6027505397796631,
0.42593246698379517,
0.3851272761821747,
-1.1201322078704834,
-0.022756822407245636,
-0.5296353101730347,
-0.5137321949005127,
0.4663870334625244,
-0.3091897666454315,
0.5160817503929138,
1.1209577322006226,
0.040519408881664276,
-0.37258064746856... |
func (ucd *UserContextData) GetAuthenticatedUser() *apiv1.Identifier {
if ucd == nil {
return nil
}
return ucd.authenticatedUser
} | [
-0.17801311612129211,
-0.01908830739557743,
0.34174948930740356,
0.6983433961868286,
-0.033709339797496796,
0.11662054806947708,
0.8339971303939819,
0.6775023937225342,
0.5497357845306396,
-1.3451392650604248,
-0.756971001625061,
0.32422471046447754,
-0.5578902959823608,
-0.330769628286361... |
func (ucd *UserContextData) GetTokenExpiresAt() time.Time {
if ucd == nil {
return time.Time{}
}
return ucd.tokenExpiresAt
} | [
-0.18925762176513672,
0.1731194257736206,
0.21794095635414124,
-1.01907217502594,
-0.3150871992111206,
-0.4392770230770111,
-0.5578593611717224,
-0.5238479971885681,
0.5635350942611694,
-0.21052376925945282,
-0.4586622714996338,
0.6677505373954773,
-0.013276114128530025,
0.2075678557157516... |
func (sv *Server) unaryAuthInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
ctx, err := sv.auth.contextWithUserData(ctx)
if err == nil {
return handler(ctx, req)
}
if _, found := noAuthEndpoints[info.FullMethod]; found { // is this end... | [
-0.7211673855781555,
-0.38312041759490967,
0.692436695098877,
0.11345349997282028,
-0.8311663866043091,
-0.24265077710151672,
0.060342900454998016,
0.16375578939914703,
0.7742338180541992,
-0.38802075386047363,
0.5640801787376404,
0.014385329559445381,
-0.47799739241600037,
-0.586650490760... |
func (auth *Auth) contextWithUserData(ctx context.Context) (context.Context, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return ctx, fmt.Errorf("invalid token")
}
tokenString, ok := md["authorization"]
if !ok {
return ctx, fmt.Errorf("invalid token")
}
user, err := auth.parseToken(tokenStri... | [
0.2743191719055176,
-0.3573684096336365,
0.482147216796875,
0.29010340571403503,
-1.5117093324661255,
0.506115734577179,
-0.38706088066101074,
-0.6569845080375671,
0.7215834259986877,
0.467913955450058,
-0.10394717752933502,
-0.06537915021181107,
0.5858107805252075,
-0.9247495532035828,
... |
func GetContextData(ctx context.Context) *UserContextData {
if v := ctx.Value(userContextKey); v != nil {
if ucd, ok := v.(*UserContextData); ok {
return ucd
}
}
return nil
} | [
0.08768291026353836,
0.11075229942798615,
0.36864686012268066,
0.7434333562850952,
-0.5545166730880737,
-0.08485255390405655,
0.0922275185585022,
-0.6054471731185913,
1.0895198583602905,
-0.04006236791610718,
-0.03765467554330826,
0.5570360422134399,
-0.09226416051387787,
-0.13347345590591... |
func GenerateCredentials() (string, string, error) {
p, err := password.Generate(64, 10, 0, false, true)
if err != nil {
return "", "", err
}
hash, err := bcrypt.GenerateFromPassword([]byte(p), bcrypt.DefaultCost)
if err != nil {
return "", "", err
}
return p, string(hash), nil
} | [
-0.08585893362760544,
0.6446443796157837,
0.6639116406440735,
0.1227191686630249,
0.35780006647109985,
-0.012902580201625824,
-0.7754287719726562,
0.8237329125404358,
-0.15630857646465302,
0.9388852119445801,
-1.2640790939331055,
-0.3595423698425293,
-0.5141446590423584,
0.390157014131546,... |
func NewSingleAuthProvider(hash string) AuthProvider {
return &singleAuthProvider{hash: hash}
} | [
0.4313536584377289,
0.23529694974422455,
-0.22405193746089935,
0.002485864097252488,
-0.8338266015052795,
0.07976587861776352,
-0.5645447969436646,
0.13671967387199402,
1.0988357067108154,
0.24764442443847656,
-0.4608767628669739,
0.45367178320884705,
-0.2836894989013672,
0.230659767985343... |
func CreateCandidate(candidate Candidate) (Candidate, error) {
_, err := Candidates.InsertOne(context.TODO(), candidate)
return candidate, err
} | [
0.17913804948329926,
-0.3655902147293091,
0.4134719669818878,
0.29607903957366943,
0.285795658826828,
0.5105058550834656,
-0.2831386923789978,
0.19881902635097504,
0.3528457581996918,
-0.3626364469528198,
-0.2923682928085327,
-0.42464780807495117,
-0.90281081199646,
-0.22598236799240112,
... |
func ReadCandidate(_id string) (Candidate, error) {
var candidate Candidate
filter := bson.M{"_id": _id}
err := Candidates.FindOne(context.TODO(), filter).Decode(&candidate)
return candidate, err
} | [
-0.21716877818107605,
-1.0364320278167725,
0.5322492122650146,
0.048805221915245056,
-0.7242374420166016,
-0.24070070683956146,
-0.3831579089164734,
0.48553475737571716,
-0.335963636636734,
0.22395142912864685,
0.7517409920692444,
0.6225571632385254,
-0.2580413818359375,
-0.597220540046691... |
func ReadAllCandidates() (*mongo.Cursor, error) {
filter := bson.M{}
cur, err := Candidates.Find(context.TODO(), filter)
return cur, err
} | [
-0.6818324327468872,
-1.0832210779190063,
0.550626277923584,
0.7520289421081543,
-0.2576907277107239,
0.13549724221229553,
-0.4945233464241028,
1.3211201429367065,
-0.4218999445438385,
0.180453822016716,
0.9153704643249512,
0.8975590467453003,
-0.3925495445728302,
0.6332943439483643,
-0.... |
func UpdateCandidate(candidate Candidate) error {
filter := bson.M{"_id": candidate.ID}
updated := bson.M{
"$set": candidate,
}
_, err := Candidates.UpdateOne(context.TODO(), filter, updated)
return err
} | [
-1.2049568891525269,
-1.2346055507659912,
0.46454760432243347,
0.335776150226593,
-0.7461724877357483,
0.5549546480178833,
-0.04189981892704964,
0.9431631565093994,
-0.013297474011778831,
0.8677402138710022,
-0.3047622740268707,
0.38521668314933777,
-0.6593523621559143,
0.02640681155025959... |
func DeleteCandidate(_id string) error {
filter := bson.M{"_id": _id}
_, err := Candidates.DeleteOne(context.TODO(), filter)
return err
} | [
-0.18327930569648743,
-0.7004541158676147,
0.36508870124816895,
0.3724749982357025,
0.07697059959173203,
0.0340556874871254,
0.33366286754608154,
1.6443547010421753,
-0.13583457469940186,
-0.1830909103155136,
-0.01846124790608883,
0.4886739253997803,
-0.44772884249687195,
0.649710595607757... |
func init() {
Candidates = ConnectDB("Candidates")
} | [
-0.038418252021074295,
-1.2794725894927979,
0.19364573061466217,
0.6411761045455933,
0.34873470664024353,
1.1503461599349976,
-0.004454293753951788,
1.697407841682434,
-0.8256868124008179,
-0.05203131586313248,
-0.06600623577833176,
0.335668683052063,
-0.4999275207519531,
0.380138576030731... |
func (m *podMetrics) New() runtime.Object {
return &metrics.PodMetrics{}
} | [
-0.21704953908920288,
-0.6332864761352539,
0.3494115471839905,
-0.22364592552185059,
-0.7254641056060791,
0.41367995738983154,
0.12369003891944885,
-1.403775930404663,
-1.1389508247375488,
-0.43282264471054077,
0.5006099939346313,
0.09859463572502136,
-0.4111737012863159,
-0.03151994198560... |
func (m *podMetrics) Destroy() {
} | [
-0.1802513748407364,
-0.08672113716602325,
0.2431543618440628,
-0.11109492182731628,
0.26343104243278503,
1.0601719617843628,
0.6772252321243286,
-0.16402797400951385,
-0.8593618273735046,
0.19259341061115265,
0.8689825534820557,
-0.22775079309940338,
-1.7984412908554077,
0.509940266609191... |
func (m *podMetrics) Kind() string {
return "PodMetrics"
} | [
0.7582454085350037,
0.09343641251325607,
0.24872943758964539,
-0.509450376033783,
0.05070634186267853,
1.8279070854187012,
0.5583686828613281,
-1.6307601928710938,
-0.9057214260101318,
0.4830000698566437,
0.9366241097450256,
1.1371269226074219,
-0.5315152406692505,
-0.35398730635643005,
... |
func (m *podMetrics) NewList() runtime.Object {
return &metrics.PodMetricsList{}
} | [
0.30289503931999207,
-0.40133923292160034,
0.4422995448112488,
0.27400362491607666,
-0.003887959523126483,
0.4915415644645691,
-0.046669669449329376,
-1.0708850622177124,
0.05687277764081955,
-0.027622971683740616,
0.18900686502456665,
-0.03757888823747635,
-0.6570820212364197,
-0.09168812... |
func (m *podMetrics) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
pods, err := m.pods(ctx, options)
if err != nil {
return &metrics.PodMetricsList{}, err
}
ms, err := m.getMetrics(pods...)
if err != nil {
namespace := genericapirequest.NamespaceValue(ctx)
klog... | [
-0.4007234573364258,
-0.8057613968849182,
0.6750531792640686,
-0.28342965245246887,
0.3953129053115845,
-0.024032598361372948,
-0.3415069580078125,
-0.9776976704597473,
-0.07039356231689453,
0.429682195186615,
0.08994470536708832,
0.42127564549446106,
-0.9138079285621643,
-0.35602641105651... |
func (m *podMetrics) Get(ctx context.Context, name string, opts *metav1.GetOptions) (runtime.Object, error) {
namespace := genericapirequest.NamespaceValue(ctx)
pod, err := m.podLister.ByNamespace(namespace).Get(name)
if err != nil {
if errors.IsNotFound(err) {
// return not-found errors directly
return &me... | [
-0.6986245512962341,
0.044166598469018936,
0.7931045293807983,
-0.5004264116287231,
-0.08573789149522781,
0.03324362635612488,
-0.08811034262180328,
-1.4494993686676025,
-0.47014710307121277,
0.49361681938171387,
0.8408301472663879,
0.8302673697471619,
-0.9926289319992065,
-0.3283248841762... |
func (m *podMetrics) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
var table metav1beta1.Table
switch t := object.(type) {
case *metrics.PodMetrics:
table.ResourceVersion = t.ResourceVersion
table.SelfLink = t.SelfLink //nolint:staticcheck ... | [
-0.009177010506391525,
-0.399734228849411,
0.7135931849479675,
0.04929269850254059,
0.3330274522304535,
0.11662011593580246,
0.4775601923465729,
-1.1915500164031982,
-0.30758020281791687,
0.48113149404525757,
0.4208205044269562,
0.12460947036743164,
-0.4566178619861603,
-0.3634655475616455... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.