text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func oldFletcher32Reader(r io.Reader, size uint64) remReader {
assert(size >= 4, "bad size for fletcher")
b := make([]byte, size-4)
read(r, b)
var checksum uint32
binary.Read(r, binary.LittleEndian, &checksum)
bf := newResetReaderFromBytes(b)
values := make([]uint16, len(b)/2)
binary.Read(bf, binary.BigEndian, ... | [
0.534083902835846,
-0.30952224135398865,
0.7261836528778076,
-0.5089057683944702,
-0.6716148257255554,
-0.2264893352985382,
0.09886263310909271,
-0.4640383720397949,
0.06700662523508072,
-0.43422067165374756,
0.36687490344047546,
-0.23224470019340515,
0.1385711133480072,
0.5863192081451416... |
func (o *Botversionsummary) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
} | [
-0.1639728844165802,
-0.6706567406654358,
0.3002062737941742,
-0.7973108887672424,
-1.1122108697891235,
0.6508819460868835,
-0.2010863572359085,
-0.45514801144599915,
-0.35454195737838745,
0.7608314156532288,
-0.5005016326904297,
1.2220555543899536,
0.06136090308427811,
-1.0108642578125,
... |
func (bc *BoltClient) OpenDB() {
var err error
bc.boltDB, err = bolt.Open(bc.FileName, 0600, nil)
if err != nil {
fmt.Println(err.Error())
panic(err.Error())
}
} | [
0.3125080168247223,
0.58200603723526,
0.43139418959617615,
0.045809995383024216,
0.5449190139770508,
1.294804573059082,
0.6507618427276611,
0.5297197103500366,
-1.0992295742034912,
-0.30661559104919434,
0.7138094305992126,
1.5936553478240967,
-1.072466254234314,
0.2979412376880646,
1.001... |
func (bc *BoltClient) Get(byname string) ([]byte, error) {
// acc := account.Account{}
var id []byte
err := bc.boltDB.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(bc.BucketName))
// accountBytes := b.Get([]byte(byname))
// accountBytes := b.Get([]byte(byname))
id = b.Get([]byte(byname))
// err := j... | [
-0.04397435113787651,
-0.44082072377204895,
1.1154361963272095,
-0.6186042428016663,
-0.33262819051742554,
-0.4234462380409241,
0.5348021388053894,
-0.26693302392959595,
-0.1850304752588272,
-0.011753384955227375,
-0.7993243336677551,
1.1002439260482788,
-0.5921778678894043,
-0.51836764812... |
func (bc *BoltClient) Set(name string) error {
// id := uuid.NewV4().String()
idUUIDObj, err := uuid.NewV4()
if err != nil {
return err
}
id := idUUIDObj.Bytes()
// acc := Account{
// ID: id,
// Name: name,
// }
// jsonBytes, _ := json.Marshal(acc)
err = bc.boltDB.Update(func(tx *bolt.Tx) error {
b ... | [
-0.8647721409797668,
-0.1874239444732666,
0.6407977938652039,
-0.7668433785438538,
-0.2565709948539734,
0.13404580950737,
0.053791504353284836,
-0.5684801936149597,
-0.4634052515029907,
0.6531750559806824,
-1.443121314048767,
0.5823907256126404,
-0.4430321455001831,
-0.6217049360275269,
... |
func (bc *BoltClient) InitBucket() {
err := bc.boltDB.Update(func(tx *bolt.Tx) error {
_, err := tx.CreateBucketIfNotExists([]byte(bc.BucketName))
if err != nil {
return fmt.Errorf("create bucket failed: %s", err)
}
return nil
})
if err != nil {
panic(err)
}
} | [
0.4939841628074646,
1.2794111967086792,
0.7741496562957764,
-0.03279269486665726,
1.1803480386734009,
0.3004280924797058,
0.4929637014865875,
-0.03201744332909584,
-1.0800226926803589,
0.1737370640039444,
-0.29992425441741943,
0.8723762035369873,
-0.3501068949699402,
0.6885549426078796,
... |
func NewNodeServer(nodeId string, ephemeral bool, maxVolumesPerNode int64) *nodeServer {
return &nodeServer{
nodeID: nodeId,
ephemeral: ephemeral,
maxVolumePerNode: maxVolumesPerNode,
}
} | [
-1.3494991064071655,
0.0042871166951954365,
0.2116263210773468,
-0.8645707964897156,
-0.3382304906845093,
-0.05142327770590782,
-0.7066037058830261,
0.303597629070282,
0.23891490697860718,
0.420803964138031,
-0.6911267042160034,
0.34401556849479675,
0.05131065472960472,
0.8443546891212463,... |
func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
// Check arguments
if req.GetVolumeCapability() == nil {
return nil, status.Error(codes.InvalidArgument, "Volume capability missing in request")
}
if len(req.GetVolumeId()) == ... | [
-0.5959713459014893,
-0.23059220612049103,
1.0262092351913452,
-0.18304525315761566,
0.6043291687965393,
0.47903668880462646,
0.3077661395072937,
0.6211806535720825,
-0.17281435430049896,
0.5165202021598816,
1.0294138193130493,
0.35069912672042847,
-0.08109614253044128,
0.7823795676231384,... |
func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
// Check arguments
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
}
if len(req.GetTargetPath()) == 0 {
... | [
-0.6408644914627075,
-0.5003698468208313,
0.7624686360359192,
-0.5070444345474243,
0.3102218508720398,
-0.45146995782852173,
0.6889659762382507,
0.9177504777908325,
-0.3549972176551819,
0.3065476417541504,
1.4063613414764404,
0.4411731958389282,
-0.09369006007909775,
0.335293710231781,
0... |
func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
// Check arguments
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
}
if len(req.GetStagingTargetPath()) == 0 {
retu... | [
-1.376340627670288,
-0.972795307636261,
0.6257423162460327,
-0.6095739603042603,
0.21418340504169464,
-0.8394173383712769,
0.05594533309340477,
-0.12260304391384125,
-0.8723121881484985,
0.3459230065345764,
0.779138445854187,
0.32756444811820984,
-0.6719479560852051,
0.7747452259063721,
... |
func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
// Check arguments
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
}
if len(req.GetStagingTargetPath()) == 0 {
... | [
-1.5236650705337524,
-0.3481721878051758,
0.7172610759735107,
-0.8112169504165649,
0.6095935702323914,
-0.3707036077976227,
0.5552424192428589,
0.7360154986381531,
-1.158619999885559,
0.4652136564254761,
0.5848913788795471,
0.12256690114736557,
-1.1178609132766724,
0.7583785653114319,
0.... |
func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
topology := &csi.Topology{
Segments: map[string]string{TopologyKeyNode: ns.nodeID},
}
return &csi.NodeGetInfoResponse{
NodeId: ns.nodeID,
MaxVolumesPerNode: ns.maxVolumePerNode,
Accessibl... | [
-0.6024543046951294,
0.22266553342342377,
0.20713838934898376,
-0.8696253895759583,
0.08931851387023926,
-0.48778215050697327,
-0.5513865351676941,
-0.5533578991889954,
-0.635236382484436,
-0.7158172130584717,
0.2823171317577362,
0.6225085258483887,
0.00540066696703434,
0.2103281319141388,... |
func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
return &csi.NodeGetCapabilitiesResponse{
Capabilities: []*csi.NodeServiceCapability{
{
Type: &csi.NodeServiceCapability_Rpc{
Rpc: &csi.NodeServiceCapability_RPC{... | [
-0.8599373698234558,
-0.05955110117793083,
0.5645380616188049,
-0.4823960065841675,
0.06897962093353271,
-1.2654200792312622,
0.3117651045322418,
-0.5352526903152466,
0.058664482086896896,
-0.06937799602746964,
0.1503027379512787,
0.6400841474533081,
-0.8530018925666809,
0.7019746899604797... |
func (mg *AccessKey) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)
var rsp reference.ResolutionResponse
var err error
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.User),
Extract: refe... | [
-0.8845603466033936,
0.014480605721473694,
0.4241251051425934,
-0.6039681434631348,
0.20055711269378662,
-0.21537365019321442,
-0.20522385835647583,
-0.034936003386974335,
-0.36650586128234863,
0.31484556198120117,
0.7179223895072937,
0.7889134287834167,
-0.3407648801803589,
0.087272316217... |
func (mg *GroupPolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)
var rsp reference.ResolutionResponse
var err error
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Group),
Extra... | [
-0.8600295782089233,
-0.6980203986167908,
0.48582297563552856,
-1.3045287132263184,
0.6494724154472351,
0.08537023514509201,
-0.06577049940824509,
-0.6157552003860474,
-0.27847108244895935,
0.23831026256084442,
0.6123989820480347,
0.8191645741462708,
-0.07175948470830917,
0.088799104094505... |
func (mg *InstanceProfile) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)
var rsp reference.ResolutionResponse
var err error
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role),
Extract: ... | [
-0.5415675044059753,
0.03930526599287987,
0.4282241463661194,
-1.4795583486557007,
0.7715681195259094,
0.017065301537513733,
-0.11091794073581696,
-0.18621930480003357,
-0.6967640519142151,
0.30793848633766174,
0.026720751076936722,
0.6451808214187622,
-0.9234744310379028,
-0.0974851176142... |
func (mg *RolePolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)
var rsp reference.ResolutionResponse
var err error
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn),
Ex... | [
-0.619544267654419,
-0.8886505961418152,
0.6500906348228455,
-1.9175631999969482,
0.7116049528121948,
-0.01337455864995718,
-0.40363630652427673,
-0.10454384982585907,
0.20276303589344025,
0.24041658639907837,
0.6270838975906372,
0.7888900637626648,
0.10535269975662231,
0.1101776510477066,... |
func (mg *UserGroupMembership) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)
var rsp reference.ResolutionResponse
var mrsp reference.MultiResolutionResponse
var err error
mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{
CurrentValues: r... | [
-0.8496271967887878,
-0.08152303844690323,
0.42201173305511475,
-0.5182868838310242,
0.42950987815856934,
-0.46619364619255066,
0.11083449423313141,
-0.3997787833213806,
-0.20582176744937897,
0.306738018989563,
0.34182605147361755,
0.4484613239765167,
-0.44964343309402466,
-0.2024747878313... |
func (mg *UserPolicyAttachment) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)
var rsp reference.ResolutionResponse
var err error
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PolicyArn),
Ex... | [
-0.5964917540550232,
-0.7596937417984009,
0.5195148587226868,
-1.2992576360702515,
0.39653801918029785,
0.28511372208595276,
-0.221893310546875,
-0.32336628437042236,
0.26070791482925415,
0.10480086505413055,
0.24151906371116638,
0.7268468737602234,
0.15461808443069458,
-0.1514382958412170... |
func UseMiddleware(exec Executor, middleware ...ExecutorMiddleware) Executor {
// Apply in reverse order.
for i := len(middleware) - 1; i >= 0; i-- {
m := middleware[i]
exec = m(exec)
}
return exec
} | [
-0.14857982099056244,
0.48678112030029297,
0.7556276321411133,
0.635735273361206,
0.18905231356620789,
-1.17525315284729,
-0.27726659178733826,
0.4599921405315399,
-0.13356682658195496,
-0.23907771706581116,
0.5040315985679626,
-0.03089602291584015,
-1.065705418586731,
1.1384397745132446,
... |
func createApp() *menta.MentaApp {
// runs tendermint init if needed
menta.InitTendermint(homeDir)
// setup the app
app := menta.NewApp("counter-example", homeDir)
// Register the service
app.AddService(counter.Service{})
return app
} | [
0.8469945788383484,
-0.49715548753738403,
0.42567992210388184,
-0.014417537488043308,
0.2752852141857147,
0.8922626972198486,
-0.5591630339622498,
-0.814078688621521,
0.3497944176197052,
-0.022957423701882362,
0.1297929733991623,
-0.9591585397720337,
-0.27282822132110596,
0.556747436523437... |
func RunApp() {
app := createApp()
app.Run()
} | [
0.7446627020835876,
-0.030040165409445763,
0.31598106026649475,
1.3203145265579224,
0.9532939791679382,
1.864211082458496,
0.1679963320493698,
-0.061399735510349274,
-0.7303537726402283,
-0.38503602147102356,
-0.16291463375091553,
0.7348237037658691,
-0.3575257956981659,
0.5959420204162598... |
func main() {
app := cli.NewApp()
app.Name = "counter cli"
app.Version = "1.0"
app.Description = "Menta counter example"
app.Author = "Dave Bryson"
app.Commands = []cli.Command{
{
Name: "start",
Usage: "Start the tendermint node",
Action: func(c *cli.Context) error {
RunApp()
return nil
},
... | [
0.8791481256484985,
-0.07767412066459656,
1.0832489728927612,
0.6341648101806641,
0.3893260359764099,
0.7509939074516296,
0.8108399510383606,
-0.7325237393379211,
-0.3062230050563812,
0.018602833151817322,
-0.1504024714231491,
-0.08952511101961136,
0.38837799429893494,
0.03130663186311722,... |
func (p Plugin) Exec() error {
// Install specified version of kubectl
if p.Kube.Version != "" {
err := k.InstallKubectl(p.Kube.Version)
if err != nil {
return err
}
}
// Initialize commands
var commands []*exec.Cmd
// Print Kubectl version
commands = append(commands, exec.Command(kubeExe, "version", ... | [
0.14954611659049988,
-0.4387802183628082,
0.7992806434631348,
0.7088952660560608,
0.7245361804962158,
0.294112890958786,
-0.5701354146003723,
0.03006312996149063,
0.19722050428390503,
0.8834680318832397,
0.19814375042915344,
0.45179271697998047,
-0.2975963354110718,
0.03113534487783909,
... |
func (v Looping) val() js.Value {
return _looping[v]
} | [
-0.5375630259513855,
0.41743481159210205,
0.06135294958949089,
-0.3216388523578644,
-0.654582679271698,
-0.041122306138277054,
0.27522972226142883,
-0.5947720408439636,
0.01662205159664154,
0.02765660174190998,
0.11138010025024414,
1.433350920677185,
0.884151816368103,
0.2731509506702423,
... |
func convertLooping(loop js.Value) Looping {
for i, l := range _looping {
if l.Equal(loop) {
return Looping(i)
}
}
return 0
} | [
-1.3218427896499634,
0.20969033241271973,
0.42368030548095703,
0.3780438303947449,
-0.5774902105331421,
-0.4743824899196625,
-0.1488453596830368,
-0.21710611879825592,
0.31974396109580994,
1.1076751947402954,
-0.23362456262111664,
0.14070682227611542,
0.0011358341434970498,
0.7719019651412... |
func (m Matrix) GetSquare(i, j int) square.Square {
return m.Squares[i][j]
} | [
-0.21929098665714264,
-0.4061243534088135,
0.36219072341918945,
0.8554766774177551,
0.13629505038261414,
-0.8058682084083557,
0.40376967191696167,
-1.0056569576263428,
-0.17545999586582184,
-0.1616182029247284,
0.2913960814476013,
0.6432753205299377,
-0.5792471170425415,
-0.392898589372634... |
func FindSmallerCellSize(pointList *[]point.Point) Matrix {
squares := make([][]square.Square, 1)
squares[0] = make([]square.Square, 1)
squares[0][0] = square.Square{
Width: 1.0,
X: 0,
Y: 0,
// points must be normalized into a range [0.0, 1.0)
Points: make([]*point.Point, len(*pointList)),
}
for ... | [
0.3904467821121216,
0.14151491224765778,
0.581972599029541,
0.6434007287025452,
-0.8430518507957458,
-0.8161719441413879,
0.6186067461967468,
-0.38408684730529785,
0.7710482478141785,
-0.002055639633908868,
-0.20356814563274384,
-0.40567734837532043,
-0.21718767285346985,
1.466443419456482... |
func (m Matrix) Subdivide() *Matrix {
cap := len(m.Squares) * 2
nm := New(m.Width/2.0, cap)
for _, row := range m.Squares {
for _, oldSq := range row {
result := oldSq.Partition()
for i := range result {
for j := range result[i] {
sq := result[i][j]
nm.Squares[sq.X][sq.Y] = sq
}
}
}
}... | [
0.5788400173187256,
-0.22794070839881897,
0.6692216992378235,
0.01361298467963934,
-0.5419108271598816,
-0.4550888240337372,
0.2908326983451843,
-0.386835515499115,
-0.34782227873802185,
-0.8607107996940613,
0.3508378267288208,
-0.26231837272644043,
-0.2200070023536682,
0.5995006561279297,... |
func New(width float32, size int) Matrix {
nm := Matrix{
Width: width,
Squares: make([][]square.Square, size, size),
}
for i := range nm.Squares {
nm.Squares[i] = make([]square.Square, size, size)
}
return nm
} | [
-0.2548789978027344,
-1.0488005876541138,
0.43472960591316223,
-0.5512055158615112,
-1.1368569135665894,
-0.36261889338493347,
0.17215706408023834,
-0.9916804432868958,
0.7274736762046814,
-0.4530932605266571,
-0.4380551874637604,
0.24130435287952423,
0.7997318506240845,
0.6669656038284302... |
func (m *Matrix) Draw(canvas *drawing.Canvas, strat Strategy) {
path := canvas.GetContext()
path.SetFillColor(color.RGBA{0xaa, 0xaa, 0xaa, 0xff})
path.SetStrokeColor(color.RGBA{0x99, 0x99, 0x99, 0xff})
path.SetLineWidth(2)
drawing.DrawSquare(0.0, 0.0, 1.0, 1.0, path)
log.Info("filling the background of the image,... | [
0.3041001558303833,
0.14412395656108856,
0.736723005771637,
-0.553118884563446,
0.8140770792961121,
0.5915200114250183,
0.6234877705574036,
-0.7255749106407166,
0.4043218195438385,
0.37807875871658325,
0.8793375492095947,
0.715514063835144,
0.337901771068573,
0.7717990875244141,
-0.55723... |
func Init() {
err := gl.Init()
if err != nil {
panic(err)
}
gl.Enable(gl.BLEND)
gl.Enable(gl.SCISSOR_TEST)
gl.BlendEquation(gl.FUNC_ADD)
} | [
1.315561056137085,
0.5534237623214722,
0.47616639733314514,
0.3048667013645172,
0.4105864465236664,
0.8906502723693848,
0.6240686774253845,
-0.3952377140522003,
0.5721498727798462,
0.281788170337677,
-0.8900052309036255,
0.3550277650356293,
-0.507912278175354,
0.27303218841552734,
0.4381... |
func Clear(r, g, b, a float32) {
gl.ClearColor(r, g, b, a)
gl.Clear(gl.COLOR_BUFFER_BIT)
} | [
1.1868877410888672,
0.16373026371002197,
0.31930074095726013,
-0.25745120644569397,
-0.3096151351928711,
1.602389931678772,
0.11933445930480957,
-1.4139690399169922,
-0.3473276197910309,
0.10505765676498413,
0.0637526661157608,
0.5889514684677124,
0.2520808279514313,
0.5654083490371704,
... |
func Bounds(x, y, w, h int) {
gl.Viewport(int32(x), int32(y), int32(w), int32(h))
gl.Scissor(int32(x), int32(y), int32(w), int32(h))
} | [
0.8959237337112427,
-0.24993346631526947,
0.46163567900657654,
-1.312933325767517,
-0.23131084442138672,
0.41077518463134766,
-0.697329044342041,
-1.1953332424163818,
0.6856610774993896,
-0.4036487340927124,
-0.17798791825771332,
0.8282370567321777,
-0.09634798765182495,
-0.009709896519780... |
func BlendFunc(src, dst BlendFactor) {
gl.BlendFunc(uint32(src), uint32(dst))
} | [
0.7031164169311523,
0.8238492012023926,
0.2937995493412018,
0.07845034450292587,
0.05835125595331192,
0.14617030322551727,
0.6025487780570984,
0.26431557536125183,
-0.18191079795360565,
-0.1078258752822876,
-0.3239907920360565,
1.4412568807601929,
1.2788240909576416,
-0.16613414883613586,
... |
func TestDownloadS3TestSuite(t *testing.T) {
suite.Run(t, new(S3DownloaderTestSuite))
} | [
0.4345318675041199,
-0.29977428913116455,
0.39039042592048645,
0.294571191072464,
0.16118095815181732,
0.9503631591796875,
0.2134021371603012,
0.1576308012008667,
0.7761096358299255,
-0.41273438930511475,
-0.4473656415939331,
0.7692559361457825,
-0.3118757903575897,
-0.3587556481361389,
... |
func (s *reservationService) CreateReservation(ctx context.Context, reservation *bookly.Reservation) error {
if reservation.ToTime.Before(reservation.FromTime) {
// Offers is not available during negative time periods
return bookly.ErrOfferNotAvailable
}
if reservation.FromTime.Before(time.Now()) {
return book... | [
-0.7388074398040771,
-0.04345150291919708,
0.697381317615509,
0.38746577501296997,
0.28921422362327576,
0.09003733098506927,
0.2397099733352661,
0.060053158551454544,
0.3502134084701538,
1.1284079551696777,
-0.08609218150377274,
-0.543129563331604,
-0.20589545369148254,
0.9151925444602966,... |
func (s *reservationService) GetClientReservations(ctx context.Context, clientID int64, pageNumber int, pageSize int) ([]*bookly.ReservationObject, error) {
reservations, errGet := s.reservationStorage.GetClientReservations(ctx, clientID)
if errGet != nil {
return nil, errGet
}
list := []*bookly.ReservationObjec... | [
-0.37695878744125366,
-0.016795914620161057,
0.7343505024909973,
-0.018964121118187904,
-0.2814597189426422,
-0.2500072419643402,
-0.3213869035243988,
0.15685220062732697,
-0.09593071043491364,
0.8096804618835449,
-0.46874526143074036,
0.4276396632194519,
0.0617876872420311,
0.507518589496... |
func (s *reservationService) DeleteReservation(ctx context.Context, clientID int64, reservationID int64) error {
isOwned, err := s.reservationStorage.IsReservationOwnedByClient(ctx, clientID, reservationID)
if err != nil {
return bookly.ErrReservationDoesNotExists
}
if !isOwned {
return bookly.ErrReservationNot... | [
-0.6053954362869263,
0.04052696004509926,
0.46658220887184143,
0.7537920475006104,
-0.03836765140295029,
-0.5135360360145569,
-0.1922646015882492,
0.15788477659225464,
0.5575387477874756,
0.6652073264122009,
-0.2894327640533447,
-0.03823087364435196,
-0.4465332627296448,
0.6671459674835205... |
func (s *reservationService) GetHotelReservations(ctx context.Context, currentOnly bool, hotelID int64, searchRoomID int64, pageNumber int, pageSize int) ([]*bookly.ReservationHotelObject, error) {
reservations, errGet := s.reservationStorage.GetHotelReservations(ctx, hotelID)
if errGet != nil {
return nil, errGet
... | [
-0.6906424760818481,
-0.3989330232143402,
0.7030879259109497,
0.9154623746871948,
-0.21251536905765533,
0.06314048171043396,
-0.5596142411231995,
0.4549727141857147,
-0.5468193888664246,
1.0785112380981445,
-0.4186003506183624,
-0.06549961864948273,
-0.6007167100906372,
0.6348377466201782,... |
func NewMockEncoder(ctrl *gomock.Controller) *MockEncoder {
mock := &MockEncoder{ctrl: ctrl}
mock.recorder = &MockEncoderMockRecorder{mock}
return mock
} | [
-0.39995288848876953,
0.3144846260547638,
0.4391433596611023,
0.8760387897491455,
-0.3848729133605957,
0.09895540773868561,
0.26073387265205383,
-0.2957625687122345,
0.3174839913845062,
0.23867323994636536,
-0.8198033571243286,
0.014689872972667217,
-0.8736479878425598,
2.089164972305298,
... |
func (m *MockEncoder) EXPECT() *MockEncoderMockRecorder {
return m.recorder
} | [
-0.023562636226415634,
0.19095851480960846,
0.44836336374282837,
0.0367729514837265,
0.14267590641975403,
0.37682750821113586,
0.21091541647911072,
0.10732847452163696,
0.2438473403453827,
-0.25424426794052124,
0.4342372417449951,
0.8358470797538757,
-1.0752580165863037,
0.7037783265113831... |
func (m *MockEncoder) Bytes() []byte {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Bytes")
ret0, _ := ret[0].([]byte)
return ret0
} | [
-0.6131818294525146,
0.3998042941093445,
0.07838036119937897,
-0.25767529010772705,
0.9120669364929199,
0.5854036808013916,
0.22771349549293518,
-0.40873831510543823,
-0.020065216347575188,
-1.014747142791748,
-0.29849204421043396,
-0.40386030077934265,
-0.8613136410713196,
1.3877530097961... |
func (mr *MockEncoderMockRecorder) Bytes() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Bytes", reflect.TypeOf((*MockEncoder)(nil).Bytes))
} | [
-0.31885749101638794,
1.6069371700286865,
0.1965922713279724,
-0.5150879621505737,
-0.12763749063014984,
0.6092912554740906,
-0.7429193258285522,
-1.2788182497024536,
1.1137900352478027,
-0.34463900327682495,
0.3339787423610687,
0.7791976928710938,
-0.9997043609619141,
1.489487886428833,
... |
func (m *MockEncoder) Encode(arg0 Marshaler) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Encode", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.555849015712738,
0.3141936957836151,
0.0445951484143734,
0.8531965613365173,
1.2686655521392822,
-0.07788527011871338,
0.5911864638328552,
-0.17304125428199768,
-0.7949098944664001,
-0.11329558491706848,
0.29779505729675293,
-0.4384959936141968,
-1.2114638090133667,
1.248539924621582,
... |
func (mr *MockEncoderMockRecorder) Encode(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Encode", reflect.TypeOf((*MockEncoder)(nil).Encode), arg0)
} | [
-0.3154313564300537,
0.9166889190673828,
0.2490115463733673,
0.7280058860778809,
-0.19172713160514832,
0.22648122906684875,
-0.1014748141169548,
-0.8973442912101746,
0.63901686668396,
0.47783559560775757,
0.9413657188415527,
0.6514556407928467,
-1.1039396524429321,
1.6697330474853516,
0.... |
func NewMockDecoder(ctrl *gomock.Controller) *MockDecoder {
mock := &MockDecoder{ctrl: ctrl}
mock.recorder = &MockDecoderMockRecorder{mock}
return mock
} | [
-0.2540047764778137,
0.07243654131889343,
0.4361339211463928,
0.7583871483802795,
-0.30218520760536194,
-0.04554111510515213,
0.2083059549331665,
-0.0821601003408432,
0.485964834690094,
-0.24986490607261658,
-0.6200137734413147,
-0.46357372403144836,
-0.3275330364704132,
1.3984605073928833... |
func (m *MockDecoder) EXPECT() *MockDecoderMockRecorder {
return m.recorder
} | [
-0.2179298847913742,
0.5190274715423584,
0.4789491295814514,
-0.3826541006565094,
0.12674465775489807,
-0.06451534479856491,
-0.17948700487613678,
0.2760571837425232,
0.07636266946792603,
-0.7008730173110962,
0.3160242438316345,
0.8191791772842407,
-0.7480695843696594,
0.6214300394058228,
... |
func (m *MockDecoder) Decode(arg0 Unmarshaler) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Decode", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.6747658252716064,
0.4044053256511688,
0.28181982040405273,
0.6209710836410522,
1.02335524559021,
-0.471369206905365,
0.3400542438030243,
-0.177546888589859,
-0.5835376977920532,
-0.3798811137676239,
-0.33276286721229553,
-0.7384803295135498,
-1.0897935628890991,
1.7152472734451294,
0.... |
func (mr *MockDecoderMockRecorder) Decode(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Decode", reflect.TypeOf((*MockDecoder)(nil).Decode), arg0)
} | [
-0.3604970872402191,
0.9570643901824951,
0.25327885150909424,
0.45537805557250977,
-0.4916646480560303,
-0.1852283477783203,
-0.25850725173950195,
-0.8689321875572205,
0.6502417922019958,
0.07351431250572205,
0.39755794405937195,
0.294373482465744,
-1.075179100036621,
1.7304279804229736,
... |
func (m *MockDecoder) ResetReader(arg0 io.Reader) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "ResetReader", arg0)
} | [
-1.0136051177978516,
0.07493233680725098,
0.281583696603775,
0.7048954367637634,
1.045572280883789,
0.027203094214200974,
0.8484669923782349,
0.5515041351318359,
-0.7074682712554932,
-0.32452392578125,
0.3762979805469513,
-0.4279746115207672,
-0.6953163743019104,
1.256783366203308,
1.202... |
func (mr *MockDecoderMockRecorder) ResetReader(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetReader", reflect.TypeOf((*MockDecoder)(nil).ResetReader), arg0)
} | [
-0.9510775208473206,
0.22413846850395203,
0.23745101690292358,
0.5019368529319763,
-0.10969273746013641,
-0.30243024230003357,
0.031752366572618484,
-0.2717609405517578,
0.36135005950927734,
0.2227456271648407,
0.9904672503471375,
0.3091409206390381,
-1.2474876642227173,
1.1752028465270996... |
func CleanSplitOnSpace(s string) []string {
var out []string
split := strings.Split(s, " ")
for _, v := range split {
if v == "" {
continue
}
out = append(out, v)
}
return out
} | [
-0.20341558754444122,
-0.9580774903297424,
0.24618680775165558,
0.2837165594100952,
-0.7142828702926636,
-0.23419757187366486,
-0.37786367535591125,
0.8932002782821655,
1.2807961702346802,
1.0404481887817383,
-1.0800503492355347,
0.9350667595863342,
-0.3608557879924774,
0.9340081810951233,... |
func WordEol(s string, wordIdx int) string {
split := strings.Split(s, " ")
if wordIdx > -1 && len(split) >= wordIdx {
return strings.Join(split[wordIdx:], " ")
}
return ""
} | [
0.7804793119430542,
0.9351642727851868,
0.42939072847366333,
-1.0854564905166626,
-0.2599399983882904,
-0.5895178914070129,
-0.8544290065765381,
-0.4617421329021454,
0.8647450804710388,
1.5279704332351685,
0.5246451497077942,
0.25663018226623535,
0.01113283820450306,
-1.0225101709365845,
... |
func EscapeString(s string) string {
return escapeReplacer.Replace(s)
} | [
-0.3779226541519165,
0.37824487686157227,
-0.02954181097447872,
-0.4350048303604126,
-0.4827063977718353,
-0.3972887396812439,
-0.09212732315063477,
0.1944260150194168,
0.3135792016983032,
0.7645500898361206,
-0.5670318007469177,
-0.45240864157676697,
-0.05480331927537918,
-0.8133543133735... |
func StripAll(s string) string {
return strings.Map(func(r rune) rune {
if r < ' ' || r == zwsp {
return -1
}
return r
}, s)
} | [
0.8185641169548035,
-1.124934434890747,
0.4056102931499481,
-0.48741769790649414,
-1.011905550956726,
0.45049867033958435,
0.06832422316074371,
0.6984409093856812,
1.245300054550171,
-0.05660572648048401,
0.22270362079143524,
0.6965588331222534,
-0.5227380990982056,
0.9531245231628418,
0... |
func IdxOrEmpty(slice []string, idx int) string {
if len(slice) > idx {
return slice[idx]
}
return ""
} | [
-0.6821029186248779,
-0.3259127736091614,
0.1965862363576889,
-1.173393964767456,
-0.4750013053417206,
-0.3467233180999756,
-1.7575517892837524,
-0.8100326061248779,
0.6175647974014282,
1.6081403493881226,
0.48989686369895935,
0.009960174560546875,
0.011963894590735435,
-1.5531445741653442... |
func JoinToMaxLength(toJoin []string, sep string, maxLength int) []string {
var out []string
curBuilder := strings.Builder{}
curBuilder.Grow(maxLength)
for _, s := range toJoin {
entryLen := len(s)
if curBuilder.Len() == 0 && entryLen > maxLength {
out = append(out, s)
continue
}
if curBuilder.Len(... | [
0.7108173370361328,
-0.0455203615128994,
0.6950664520263672,
0.26378121972084045,
-0.8757899403572083,
0.19573548436164856,
-0.8622992038726807,
0.5136033892631531,
0.693977952003479,
0.2045031636953354,
0.5690740346908569,
-0.14412832260131836,
-0.3255546987056732,
-0.5479161739349365,
... |
func ReverseIdx(toIdx []string, idx int) string {
if idx >= 0 {
return IdxOrEmpty(toIdx, idx)
}
if abs(idx) > len(toIdx) {
return ""
}
return IdxOrEmpty(toIdx, len(toIdx)+idx)
} | [
-0.7717723846435547,
0.03725206106901169,
0.6706229448318481,
-1.002805471420288,
-0.1300709992647171,
-0.1509273201227188,
-1.3488441705703735,
0.3740760385990143,
0.6520115733146667,
0.7037189602851868,
0.33946463465690613,
0.3971993625164032,
-0.12279896438121796,
-1.606877088546753,
... |
func AddZwsp(s string) string {
if len(s) < 2 {
return s
}
return fmt.Sprintf("%c\u200b%s", s[0], s[1:])
} | [
0.48309946060180664,
-0.06102180853486061,
0.6318688988685608,
-0.7394683957099915,
-0.5637508034706116,
0.22482280433177948,
-0.4589316248893738,
-0.5245851874351501,
1.2591615915298462,
0.11665306985378265,
0.21855470538139343,
0.3426525294780731,
-0.6950609683990479,
0.1014985665678978,... |
func NewDouble(t godouble.T, configurators ...func(*awsdouble.AWSTestDouble)) *MigrationHubDouble {
result := &MigrationHubDouble{}
configurators = append([]func(configurator *awsdouble.AWSTestDouble){func(d *awsdouble.AWSTestDouble) {
d.SetDefaultCall(result.defaultMethodCall)
d.SetDefaultReturnValues(result.de... | [
-0.9144370555877686,
0.6643925905227661,
0.4763624370098114,
1.4219460487365723,
0.31096693873405457,
0.37364256381988525,
0.25679537653923035,
-0.4344542324542999,
-0.06694772094488144,
-0.062259841710329056,
-1.2713398933410645,
-0.18621118366718292,
0.04890453815460205,
0.90737211704254... |
func (avi *AviSession) rest_request(verb string, uri string, payload interface{}) ([]byte, error) {
var result []byte
url := avi.prefix + uri
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: avi.insecure},
}
errorResult := AviError{verb: verb, url: url}
var payloadIO io.Reader
if payl... | [
-0.1324518620967865,
-0.40648722648620605,
1.217376947402954,
0.6206178069114685,
0.2954106628894806,
-0.763224184513092,
-0.8371654748916626,
-0.4712945222854614,
0.4824496805667877,
0.7097188234329224,
0.6073780059814453,
0.882445752620697,
0.14372819662094116,
-0.2373717725276947,
0.8... |
func (avi *AviSession) Get(uri string) (interface{}, error) {
return avi.rest_request_interface_response("GET", uri, nil)
} | [
-1.3733140230178833,
-0.11769706010818481,
0.6574986577033997,
0.8414306640625,
-0.05867829918861389,
-0.8854827880859375,
-0.19058269262313843,
-1.145868182182312,
0.8198307752609253,
0.4553123116493225,
0.01374213956296444,
1.1098488569259644,
-0.8035000562667847,
-1.1707348823547363,
... |
func (avi *AviSession) Post(uri string, payload interface{}) (interface{}, error) {
return avi.rest_request_interface_response("POST", uri, payload)
} | [
-0.7180344462394714,
0.21461188793182373,
0.5486863851547241,
1.2406237125396729,
-0.3451453745365143,
-0.22871103882789612,
-0.32750335335731506,
-1.0997674465179443,
0.4778393805027008,
-0.25138059258461,
0.1013977900147438,
0.07460834830999374,
-1.1005046367645264,
-0.725267767906189,
... |
func (avi *AviSession) Put(uri string, payload interface{}) (interface{}, error) {
return avi.rest_request_interface_response("PUT", uri, payload)
} | [
-0.9863414764404297,
0.15651710331439972,
0.5097185969352722,
0.3092435598373413,
-0.19917219877243042,
-0.2167980819940567,
0.09589168429374695,
-0.8843381404876709,
0.6177361011505127,
0.6770118474960327,
0.03480340912938118,
0.7239708304405212,
-1.2310004234313965,
-1.3188152313232422,
... |
func (avi *AviSession) Delete(uri string) (interface{}, error) {
return avi.rest_request_interface_response("DELETE", uri, nil)
} | [
-0.8607856631278992,
0.0058351000770926476,
0.7057424783706665,
1.3452088832855225,
0.24426507949829102,
-0.6845172643661499,
0.4182839095592499,
-0.8222426176071167,
1.6801567077636719,
0.8708669543266296,
0.1016608402132988,
0.6974449753761292,
-1.3181302547454834,
-0.9483469724655151,
... |
func (avi *AviSession) GetCollection(uri string) (AviCollectionResult, error) {
var result AviCollectionResult
res, rerror := avi.rest_request("GET", uri, nil)
if rerror != nil || res == nil {
return result, rerror
}
err := json.Unmarshal(res, &result)
return result, err
} | [
-0.7540357112884521,
-0.5011463165283203,
0.9008408188819885,
0.9022105932235718,
0.2687031328678131,
-1.0667495727539062,
-0.3128438889980316,
-0.9812504053115845,
0.22900216281414032,
0.298103004693985,
0.3251877427101135,
0.8122334480285645,
-0.19739028811454773,
-0.3907703161239624,
... |
func MakePaymentEndpoints(service PaymentService, logger kitlog.Logger) http.Handler {
router := chi.NewRouter()
router.Method(http.MethodPost, "/", kithttp.NewServer(
transferMoney(service), decodeTransferMoneyRequest, encodeTransferMoneyResponse,
[]kithttp.ServerOption{
kithttp.ServerErrorLogger(logger),
... | [
0.03059282898902893,
-0.13070008158683777,
0.7095489501953125,
-0.268596351146698,
-0.5720838308334351,
0.05516450107097626,
-0.4244675934314728,
-0.17182019352912903,
0.3561599850654602,
0.14344429969787598,
0.41353169083595276,
-0.010705715976655483,
-0.018835555762052536,
0.328864276409... |
func CheckCertsValidity(driver drivers.Driver) error {
certExpiryDateCmd := `date --date="$(sudo openssl x509 -in /var/lib/kubelet/pki/kubelet-client-current.pem -noout -enddate | cut -d= -f 2)" --iso-8601=seconds`
output, err := drivers.RunSSHCommandFromDriver(driver, certExpiryDateCmd)
if err != nil {
return err... | [
0.5629138350486755,
-0.7538074851036072,
0.7148992419242859,
0.5044564604759216,
0.035412777215242386,
0.49704471230506897,
-1.0493311882019043,
-0.17333738505840302,
-0.6349115967750549,
0.7220795154571533,
0.1789790838956833,
-0.19370567798614502,
-0.3204643726348877,
0.4838917851448059,... |
func (_m *mockHandler) Handle(_a0 Conn, _a1 *Message) error {
ret := _m.Called(_a0, _a1)
var r0 error
if rf, ok := ret.Get(0).(func(Conn, *Message) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
} | [
-0.19439060986042023,
0.002503766445443034,
0.5003290176391602,
-0.20908892154693604,
1.0177843570709229,
-0.2795584201812744,
0.9122175574302673,
0.19893778860569,
-0.648226261138916,
-0.3974161744117737,
0.5646625757217407,
-0.42806389927864075,
-0.2262965738773346,
0.4180545210838318,
... |
func (_m *mockRedisPool) Get() redis.Conn {
ret := _m.Called()
var r0 redis.Conn
if rf, ok := ret.Get(0).(func() redis.Conn); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(redis.Conn)
}
return r0
} | [
-1.1546988487243652,
-0.28960177302360535,
0.5811866521835327,
0.34224262833595276,
1.0702896118164062,
-1.044256567955017,
0.3116891086101532,
0.6708514094352722,
-0.39556214213371277,
-0.6038787364959717,
0.15329881012439728,
0.9811328649520874,
-0.18158875405788422,
0.04192438721656799,... |
func mainHandler(w http.ResponseWriter, r *http.Request) {
// Use otelhttp to record a span for the outgoing call, and propagate
// context to the destination.
destination := os.Getenv("DESTINATION_URL")
resp, err := otelhttp.Get(r.Context(), destination)
if err != nil {
log.Fatal("could not fetch remote endpoin... | [
0.3101217448711395,
-0.5443287491798401,
0.673159658908844,
-0.11512749642133713,
-0.4270716607570648,
0.7050428986549377,
-0.3360452651977539,
0.17427875101566315,
-0.2456532120704651,
0.35688552260398865,
1.133893609046936,
-0.4878331422805786,
0.6823594570159912,
-0.587922215461731,
0... |
func main() {
ctx := context.Background()
// Set up the Cloud Trace exporter.
exporter, err := cloudtrace.New()
if err != nil {
log.Fatalf("cloudtrace.New: %v", err)
}
// Identify your application using resource detection.
res, err := resource.New(ctx,
// Use the GCP resource detector to detect information a... | [
1.0169694423675537,
0.4990202486515045,
0.8473794460296631,
0.1481025218963623,
0.5235071182250977,
0.7547219395637512,
0.9218255877494812,
-0.3495132029056549,
0.19492213428020477,
0.40512773394584656,
0.1717689335346222,
-0.02850763499736786,
-0.01697888784110546,
-0.03893991559743881,
... |
func D1a(input string) string {
lines := strings.Split(input, "\n")
m := make(map[int]bool, len(lines))
nums := make([]int, 0, len(lines))
for _, line := range lines {
if line == "" {
continue
}
i, err := strconv.Atoi(line)
if err != nil {
return fmt.Sprintf("Invalid input `%s`: %v", line, err)
}
... | [
-1.0412706136703491,
-0.6680033206939697,
0.8347281217575073,
-0.5297175645828247,
-0.44894829392433167,
-0.4748663008213043,
1.1928105354309082,
0.7068124413490295,
0.20038440823554993,
0.19687539339065552,
0.7511278986930847,
0.5734517574310303,
0.583518385887146,
0.741500735282898,
-0... |
func D1b(input string) string {
nums, err := parseSlice(input)
if err != nil {
return fmt.Sprintf("Can not load input: %v", err)
}
sort.Ints(nums)
for i := len(nums) - 1; i >= 0; i-- {
for j := i - 1; j >= 0; j-- {
if nums[i]+nums[j] > 2020 {
continue
}
//
for k := 0; k < j; k++ {
if num... | [
-0.6702171564102173,
-0.24806663393974304,
0.8154919743537903,
0.2005642056465149,
-0.8643702268600464,
0.22369328141212463,
0.8495566844940186,
-0.6516560912132263,
0.0994710922241211,
0.6359304785728455,
0.8738422393798828,
0.2994852662086487,
-0.2946105897426605,
0.522695779800415,
-0... |
func (ui *UserInfo) AuthorizeDatabase(privilege influxql.Privilege, database string) bool {
if ui.Admin || privilege == influxql.NoPrivileges {
return true
}
p, ok := ui.Privileges[database]
return ok && (p == privilege || p == influxql.AllPrivileges)
} | [
-0.4190233051776886,
0.291639506816864,
0.6362547278404236,
1.0889288187026978,
-0.38870105147361755,
0.004671150352805853,
-1.049649953842163,
0.5451009273529053,
0.5598930716514587,
-0.35023266077041626,
0.5436633229255676,
0.7488524913787842,
-1.0755575895309448,
0.8419398069381714,
0... |
func (u *UserInfo) AuthorizeSeriesRead(database string, measurement []byte, tags models.Tags) bool {
return true
} | [
0.44103094935417175,
-0.03467566892504692,
0.3063002824783325,
0.652062177658081,
-1.1959576606750488,
0.6707436442375183,
-0.019101984798908234,
-0.3943251371383667,
-0.10261227190494537,
-0.5998290181159973,
0.3556444048881531,
0.5161025524139404,
-0.4848741590976715,
-0.4743130207061767... |
func (u *UserInfo) AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool {
return true
} | [
-0.028972605243325233,
-0.20324328541755676,
0.23976650834083557,
0.9714207649230957,
-0.2930556535720825,
0.19559377431869507,
0.3980960249900818,
0.1582338809967041,
-0.4701351523399353,
-0.31295377016067505,
-0.26793739199638367,
-0.058675892651081085,
-0.7275727987289429,
-0.0197646412... |
func increment2(inc *int) {
// the * is an operator, it tells us the value of the pointer points to
*inc++
println("inc2:\tValue Of[", inc, "]\tAddr Of[", &inc, "]\tValue Points To[", *inc, "]")
} | [
-0.2423725575208664,
-0.8690090179443359,
0.5026531219482422,
0.41794198751449585,
-1.4184333086013794,
0.039901722222566605,
0.30888259410858154,
-0.16948838531970978,
-0.14838245511054993,
0.03869454190135002,
0.2563343942165375,
1.1086164712905884,
-0.3331393897533417,
0.748027384281158... |
func NewTweetServer(s store.Store, es eventstore.EventStore) (*Server, error) {
if s == nil {
return nil, fmt.Errorf("Store should not be NIL")
}
if es == nil {
return nil, fmt.Errorf("Event Store should not be NIL")
}
go es.Start()
return &Server{
tweetStore: s,
eventStore: es,
}, nil
} | [
-0.011368967592716217,
-0.7459894418716431,
0.4468720257282257,
-0.5394278764724731,
0.3400861918926239,
-0.46560922265052795,
0.12068776786327362,
0.5250096321105957,
0.5215982794761658,
0.43531206250190735,
-0.2594631314277649,
0.9675434231758118,
-0.24985890090465546,
0.5061725378036499... |
func (s *Server) Get(ctx context.Context, req *pb.GetTweetRequest) (*pb.GetTweetResponse, error) {
// get user infos from context
userInfos, err := auth.GetUserInfosFromContext(ctx)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
id := req.GetId()
tweet, err := s.tweetStore.Get(... | [
-0.652644693851471,
-0.5619733333587646,
0.4819229543209076,
-0.09798365086317062,
0.7265253663063049,
0.31200724840164185,
-0.3399776816368103,
-0.7981358170509338,
0.03530081734061241,
-0.22330088913440704,
0.172431081533432,
0.9163237810134888,
-0.6752465963363647,
0.1986331194639206,
... |
func (s *Server) List(req *pb.ListTweetRequest, stream pb.TweetService_ListServer) error {
tweets, err := s.tweetStore.List(stream.Context(), req.UserId, int(req.Limit))
if err != nil {
return status.Errorf(codes.Internal, "Could not list tweets: %v", err)
}
res := &pb.ListTweetResponse{}
for _, tweet := range ... | [
-0.3029157817363739,
-0.37683042883872986,
0.3932861387729645,
-0.08285020291805267,
0.29265308380126953,
-0.4933052062988281,
0.09144426137208939,
-0.10147441178560257,
0.31474342942237854,
0.40695878863334656,
-0.6087057590484619,
1.157968282699585,
-0.3353896737098694,
0.825491666793823... |
func IsUniqueViolation(err error) bool {
pgerr, ok := err.(pg.Error)
return ok && pgerr.Field('C') == "23505"
} | [
-0.2190384715795517,
1.4298237562179565,
0.3823292553424835,
0.5871004462242126,
0.1947018802165985,
-0.7291767597198486,
0.931085467338562,
0.23590737581253052,
0.7288413047790527,
0.6642845273017883,
-0.5651649832725525,
-0.010090925730764866,
-0.4679388105869293,
0.25315141677856445,
... |
func TestSingleSQL(t *testing.T) {
// sql := "INSERT INTO NATION VALUES (1, 'NAME1',21, 'COMMENT1'), (2, 'NAME2', 22, 'COMMENT2')"
// sql := "insert into dept values (11, 'aa', 'bb')"
// sql := "delete from dept where deptno > 10"
// sql := "delete from nation where n_nationkey > 10"
// sql := "delete nation, nati... | [
-0.06400623172521591,
0.8011119961738586,
0.5859174728393555,
0.06056828051805496,
-0.4595489501953125,
0.18184243142604828,
0.33331945538520813,
-0.544557511806488,
0.4784613251686096,
0.3813478350639343,
-0.9844721555709839,
0.10733133554458618,
-0.4169219732284546,
0.7642272710800171,
... |
func TestJoinTableSqlBuilder(t *testing.T) {
mock := NewMockOptimizer(false)
// should pass
sqls := []string{
"SELECT N_NAME,N_REGIONKEY FROM NATION join REGION on NATION.N_REGIONKEY = REGION.R_REGIONKEY",
"SELECT N_NAME, N_REGIONKEY FROM NATION join REGION on NATION.N_REGIONKEY = REGION.R_REGIONKEY WHERE NATIO... | [
0.3136201500892639,
-0.4315938353538513,
0.825005292892456,
0.6144533753395081,
-0.5694561004638672,
0.5115177631378174,
0.27466049790382385,
-0.19734811782836914,
-0.1123238131403923,
-0.03407301753759384,
-1.130079984664917,
-0.8309170603752136,
-0.5074523687362671,
0.06257812678813934,
... |
func TestDerivedTableSqlBuilder(t *testing.T) {
mock := NewMockOptimizer(false)
// should pass
sqls := []string{
"select c_custkey from (select c_custkey from CUSTOMER ) a",
"select c_custkey from (select c_custkey from CUSTOMER group by c_custkey ) a",
"select col1 from (select c_custkey from CUSTOMER group b... | [
0.4226055145263672,
-0.04717430844902992,
1.0075238943099976,
0.27842995524406433,
-0.5531547665596008,
0.5327966213226318,
1.1562186479568481,
0.2134411782026291,
-0.7082767486572266,
0.1427498310804367,
-0.9248498678207397,
-0.6947989463806152,
-0.4012143313884735,
0.13256318867206573,
... |
func TestUnionSqlBuilder(t *testing.T) {
mock := NewMockOptimizer(false)
// should pass
sqls := []string{
"(select 1) union (select 1)",
"(((select n_nationkey from nation order by n_nationkey))) union (((select n_nationkey from nation order by n_nationkey)))",
"select 1 union select 2",
"select 1 union (sel... | [
-0.5107938051223755,
0.11786661297082901,
0.7719573378562927,
0.08264532685279846,
-0.1771067976951599,
0.4604232609272003,
-0.1105068176984787,
-0.27242451906204224,
0.40598657727241516,
-0.3246162235736847,
-1.4937541484832764,
-0.45449090003967285,
-0.5749131441116333,
0.074754096567630... |
func TestCTESqlBuilder(t *testing.T) {
mock := NewMockOptimizer(false)
// should pass
sqls := []string{
"WITH qn AS (SELECT * FROM nation) SELECT * FROM qn;",
"with qn0 as (select 1), qn1 as (select * from qn0), qn2 as (select 1), qn3 as (select 1 from qn1, qn2) select 1 from qn3",
`WITH qn AS (select "outer... | [
-0.044650208204984665,
-0.3633817732334137,
0.6342840194702148,
-0.22956271469593048,
-0.5639795064926147,
0.3207002878189087,
-0.5642897486686707,
-0.3591534495353699,
0.1289048045873642,
-0.19185411930084229,
-0.7822527289390564,
-0.9802238941192627,
-0.24518626928329468,
-0.088375315070... |
func SyncEnvVar(env interface{}) {
bs, err := json.Marshal(&env)
if err != nil {
log.Fatal(err)
}
envVar := map[string]string{}
err = json.Unmarshal(bs, &envVar)
if err != nil {
log.Fatal(err)
}
viper.AutomaticEnv()
for k := range envVar {
val := viper.GetString(k)
if val != "" {
envVar[k] = val
... | [
-0.7624327540397644,
-1.2605607509613037,
0.908250629901886,
-0.3881489932537079,
-0.1872042566537857,
-0.018785420805215836,
-0.05569637194275856,
-0.6651396751403809,
-1.0869059562683105,
1.4606860876083374,
-0.6830500960350037,
1.2119216918945312,
0.5577543377876282,
0.9993184804916382,... |
func main() {
a := bouncerule.App{}
user := os.Getenv("MYSQL_USER")
password := os.Getenv("MYSQL_PASSWORD")
dbname := os.Getenv("MYSQL_DATABASE")
port := os.Getenv("SERVER_PORT")
address := fmt.Sprintf(":%s", port)
fmt.Printf("Running server on port %s...", port)
a.Initialize(user, password, dbname)
a.Run(a... | [
1.1364610195159912,
-0.3328593075275421,
0.7717769145965576,
0.4783906042575836,
0.7661891579627991,
1.1570396423339844,
0.4849418103694916,
1.1016746759414673,
-1.0171358585357666,
0.4180985987186432,
-0.4572974741458893,
0.7540039420127869,
-0.48243802785873413,
0.8387801051139832,
0.9... |
func UserSignIn(username, password string) (*user_model.User, *auth.Source, error) {
var user *user_model.User
isEmail := false
if strings.Contains(username, "@") {
isEmail = true
emailAddress := user_model.EmailAddress{LowerEmail: strings.ToLower(strings.TrimSpace(username))}
// check same email
has, err :=... | [
-0.6279511451721191,
-0.8659974336624146,
0.7486405372619629,
0.1381189227104187,
-1.0841538906097412,
-0.17316192388534546,
0.0026824017986655235,
0.15141147375106812,
0.7661193013191223,
0.09606964886188507,
-0.9169158339500427,
0.6332652568817139,
-0.12280544638633728,
0.010829478502273... |
func NewSUT(runFunc RunFunc, routables []routable.Contract) (context.CancelFunc, *sync.WaitGroup, *mux.Router) {
var wg sync.WaitGroup
ctx, cancel := context.WithCancel(context.Background())
muxRouter := mux.NewRouter()
runFunc(ctx, cancel, muxRouter, routables, nil)
return cancel, &wg, muxRouter
} | [
0.21796631813049316,
-0.20247188210487366,
0.3859221041202545,
0.13628226518630981,
-1.3344718217849731,
-0.4302874803543091,
0.20388522744178772,
0.5631395578384399,
-0.597411572933197,
0.6579503417015076,
0.5002290606498718,
0.8823033571243286,
0.2952529788017273,
-0.07525387406349182,
... |
func (s Service) CreateTodo(ctx context.Context, req *todo.CreateTodoRequest) (*todo.CreateTodoResponse, error) {
// Convert proto timestamps to time.Time TODO(JS): Figure out how to handle cases where they are not present.
// db_created_at, err := ptypes.Timestamp(req.Item.CreatedAt)
// log.Print(err)
// if err !=... | [
-0.5072965025901794,
0.6051338315010071,
0.9832717776298523,
0.24838267266750336,
0.7303058505058289,
0.42960333824157715,
-0.2930211126804352,
-0.5347737073898315,
-0.35414040088653564,
0.20659063756465912,
-0.7100505828857422,
-0.05550698935985565,
-0.6476879119873047,
-0.053246140480041... |
func (s Service) GetTodo(ctx context.Context, req *todo.GetTodoRequest) (*todo.GetTodoResponse, error) {
var dbitem DbItem
result := s.DB.Table("todo").First(&dbitem, req.Id)
if result.Error != nil {
return nil, grpc.Errorf(codes.NotFound, "Could not retrieve item from the database: %s", result.Error)
}
// Conv... | [
-0.3053121864795685,
0.5024966597557068,
0.7599555253982544,
0.48552942276000977,
0.8809962868690491,
0.18712134659290314,
-0.3480619490146637,
-0.6614941954612732,
-0.2416420876979828,
-0.2749365270137787,
-0.26664286851882935,
0.8292354941368103,
-0.13742578029632568,
-0.1037739142775535... |
func (s Service) GetTodos(ctx context.Context, req *todo.GetTodosRequest) (*todo.GetTodosResponse, error) {
var dbitems []*DbItem
result := s.DB.Table("todo").Find(&dbitems)
if result.Error != nil {
return nil, grpc.Errorf(codes.NotFound, "Could not retrieve item from the database: %s", result.Error)
}
var items... | [
-0.9182753562927246,
0.7369863986968994,
0.6489236354827881,
0.3068743348121643,
0.9369169473648071,
-0.2961351275444031,
-0.21854758262634277,
-0.7654661536216736,
-0.3051087558269501,
-0.20126624405384064,
-0.32277342677116394,
0.49445563554763794,
0.21218562126159668,
0.3463131189346313... |
func NewCmd() *cobra.Command {
opts := phraseOptions{}
cmd := &cobra.Command{
Use: "phrase",
Short: "Generate a random passphrase",
Long: `Generate a random passphrase.
Keyspace is the number of possible combinations of the passphrase.
Average time taken to crack is based on a brute force attack scenario ... | [
0.21101894974708557,
-0.5444782376289368,
0.8715134859085083,
-0.7985724210739136,
-0.6958450675010681,
0.35708650946617126,
0.3300277292728424,
0.6070054173469543,
0.9009140729904175,
0.15579330921173096,
0.39159536361694336,
0.15288837254047394,
-0.5198388695716858,
0.32898905873298645,
... |
func FormatSecretSecurity(keyspace, avgTimeToCrack float64) (space, time string) {
if math.IsInf(keyspace, 1) {
return "+Inf", "+Inf"
}
space = fmt.Sprintf("%.2f", keyspace)
time = fmt.Sprintf("%.2f seconds", avgTimeToCrack)
switch {
case keyspace >= sextillion:
space = fmt.Sprintf("%.2f sextillion", keyspa... | [
0.07179234176874161,
-0.22801706194877625,
0.8259626030921936,
-0.16507476568222046,
-0.37280941009521484,
-0.37846583127975464,
-0.45606085658073425,
-1.0593628883361816,
0.2123498171567917,
1.0056864023208618,
0.4281419515609741,
0.7185025811195374,
0.16835129261016846,
0.844119250774383... |
func prettify(str string) string {
idx := strings.IndexByte(str, '.')
num := str[:idx]
sb := strings.Builder{}
j := 0
for i := len(num) - 1; i >= 0; i-- {
sb.WriteByte(num[j])
if i%3 == 0 && i != 0 {
sb.WriteByte(',')
}
j++
}
// Append remaining characters
sb.WriteString(str[idx:])
return sb.Strin... | [
0.5200338363647461,
0.06409570574760437,
0.6733447909355164,
-0.5147859454154968,
-0.5790178775787354,
-0.21048395335674286,
-0.28643593192100525,
0.0247334074229002,
0.49943146109580994,
0.18207603693008423,
0.04711267352104187,
0.4582193195819855,
-0.8054954409599304,
-1.08145010471344,
... |
func New(config *Config, sess *session.Session, logger *zap.Logger) (*Daemon, error) {
return NewDaemon(
config,
sqs.New(sess),
sns.New(sess),
autoscaling.New(sess),
ec2.New(sess),
logger,
)
} | [
-0.607914924621582,
-0.8683210611343384,
0.4067704975605011,
-0.4943042993545532,
-0.407033771276474,
-0.041161127388477325,
-0.22248123586177826,
-0.9266724586486816,
0.6939089298248291,
-0.5992935299873352,
-0.5916422605514526,
0.6713464260101318,
1.0949358940124512,
0.34601062536239624,... |
func NewDaemon(
config *Config,
sqsClient SQSClient,
snsClient SNSClient,
asgClient AutoscalingClient,
ec2Client EC2Client,
logger *zap.Logger,
) (*Daemon, error) {
daemon := &Daemon{
config: config,
sqsClient: sqsClient,
snsClient: snsClient,
asgClient: asgClient,
ec2Client: ec2Client,
log: ... | [
-0.21181412041187286,
-0.9623975157737732,
0.6093618869781494,
-0.7110779881477356,
-0.28682246804237366,
-0.4790092408657074,
-0.6282040476799011,
-0.3504006564617157,
0.2390136867761612,
-0.30979207158088684,
-0.022108757868409157,
0.31786835193634033,
0.3903171420097351,
0.9583579897880... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.