// Execute executes a schema check command
501726
func (c *SchemaCheck) Execute(args []string) error {
	return c.doSchemaOp(schemaCheck, dosa.AdminClient.CanUpsertSchema, c.Args.Paths)
}
990508
func (q *Query) Execute(tree *toml.Tree) *Result {
	result := &Result{
		items:     []interface{}{},
		positions: []toml.Position{},
	}
	if q.root == nil {
		result.appendResult(tree, tree.GetPosition(""))
	} else {
		ctx := &queryContext{
			result:  result,
			filters: q.filters,
		}
		ctx.lastPosition = tree.Position()
		q.root.call(tree, ctx)
	}
	return result
}
234327
func (w *UserHelperWriter) Execute(data *UserTypeTemplateData) error {
	fm := make(map[string]interface{})
	fm["famt"] = fieldAssignmentModelToType
	fm["fatm"] = fieldAssignmentTypeToModel
	fm["viewSelect"] = viewSelect
	fm["viewFields"] = viewFields
	fm["viewFieldNames"] = viewFieldNames
	fm["goDatatype"] = goDatatype
	fm["goDatatypeByModel"] = goDatatypeByModel
	fm["plural"] = inflection.Plural
	fm["gtt"] = codegen.GoTypeTransform
	fm["gttn"] = codegen.GoTypeTransformName
	fm["gptn"] = codegen.GoTypeName
	fm["newMediaTemplate"] = newMediaTemplate
	return w.ExecuteTemplate("types", userHelperT, fm, data)
}
922941
func (c *PreparedQuery) Execute(queryIDOrName string, q *QueryOptions) (*PreparedQueryExecuteResponse, *QueryMeta, error) {
	var out *PreparedQueryExecuteResponse
	qm, err := c.c.query("/v1/query/"+queryIDOrName+"/execute", &out, q)
	if err != nil {
		return nil, nil, err
	}
	return out, qm, nil
}
965953
func (c *Console) Execute(path string) error {
	return c.jsre.Exec(path)
}
752284
func (c *CmdImport) Execute(args []string) error {
	c.fullPkgName = c.Args.Package
	fmt.Printf("Processing %q\n", c.Args.Package)

	objects, err := c.getObjects()
	if err != nil {
		return err
	}

	c.getCurrentPckgName()
	return c.render(objects)
}
1330322
func (*localExecutor) Execute(command []string, in io.Reader, out, errOut io.Writer) error {
	klog.V(3).Infof("Local executor running command: %s", strings.Join(command, " "))
	cmd := exec.Command(command[0], command[1:]...)
	cmd.Stdout = out
	cmd.Stderr = errOut
	cmd.Stdin = in
	err := cmd.Run()
	if err != nil {
		klog.V(4).Infof("Error from local command execution: %v", err)
	}
	return err
}
619286
func (sq *Subquery) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
	inner, err := sq.Subquery.Execute(vcursor, bindVars, wantfields)
	if err != nil {
		return nil, err
	}
	return sq.buildResult(inner), nil
}
284359
func (c *Context) Execute(ctx context.Context, sql string) ([]sqlexec.RecordSet, error) {
	return nil, errors.Errorf("Not Support.")
}
1218332
func (w *UserTypesWriter) Execute(data *UserTypeTemplateData) error {
	fm := make(map[string]interface{})
	fm["famt"] = fieldAssignmentModelToType
	fm["fatm"] = fieldAssignmentTypeToModel
	fm["fapm"] = fieldAssignmentPayloadToModel
	fm["viewSelect"] = viewSelect
	fm["viewFields"] = viewFields
	fm["viewFieldNames"] = viewFieldNames
	fm["goDatatype"] = goDatatype
	fm["goDatatypeByModel"] = goDatatypeByModel
	fm["plural"] = inflection.Plural
	fm["gtt"] = codegen.GoTypeTransform
	fm["gttn"] = codegen.GoTypeTransformName
	return w.ExecuteTemplate("types", userTypeT, fm, data)
}
1072270
func (s *Script) Execute(conn *Conn, keyCount int, keysAndArgs ...interface{}) (*Reply, error) {
	s.lock.RLock()
	defer s.lock.RUnlock()
	if s.body == "" {
		return nil, ErrEmptyScript
	}
	args := make([]interface{}, len(keysAndArgs)+2)
	args[0] = s.sha
	args[1] = keyCount
	for i := range keysAndArgs {
		args[i+2] = keysAndArgs[i]
	}
	rep, err := NewCommand("EVALSHA", args...).Run(conn)
	if err != nil {
		return nil, err
	}
	if !rep.IsError() {
		return rep, nil
	}
	errorMessage, _ := rep.Error()
	if !strings.HasPrefix(errorMessage, "NOSCRIPT") {
		return rep, nil
	}
	args[0] = s.body
	return NewCommand("EVAL", args...).Run(conn)
}
1026940
func (n *Node) execute(cmd Command) (bool, error) {
	if err := n.stateCheck(nodeRunning, nodeHealthChecking); err != nil {
		return false, err
	}

	if n.isCurrentState(nodeRunning) {
		conn, err := n.cm.get()
		if err != nil {
			logErr("[Node]", err)
			n.doHealthCheck()
			return false, err
		}

		if conn == nil {
			panic(fmt.Sprintf("[Node] (%v) expected non-nil connection", n))
		}

		if rc, ok := cmd.(retryableCommand); ok {
			rc.setLastNode(n)
		}

		logDebug("[Node]", "(%v) - executing command '%v'", n, cmd.Name())
		err = conn.execute(cmd)
		if err == nil {
			// NB: basically the success path of _responseReceived in Node.js client
			if cmErr := n.cm.put(conn); cmErr != nil {
				logErr("[Node]", cmErr)
			}
			return true, nil
		} else {
			// NB: basically, this is _connectionClosed / _responseReceived in Node.js client
			// must differentiate between Riak and non-Riak errors here and within execute() in connection
			switch err.(type) {
			case RiakError, ClientError:
				// Riak and Client errors will not close connection
				if cmErr := n.cm.put(conn); cmErr != nil {
					logErr("[Node]", cmErr)
				}
				return true, err
			default:
				// NB: must be a non-Riak, non-Client error, close the connection
				if cmErr := n.cm.remove(conn); cmErr != nil {
					logErr("[Node]", cmErr)
				}
				if !isTemporaryNetError(err) {
					n.doHealthCheck()
				}
				return true, err
			}
		}
	} else {
		return false, nil
	}
}
889660
func (b BuildInfo) Execute(args []string) error {
	fmt.Printf("%s\n", b)
	return nil
}
725576
func (q *StreamHealthQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
	return &sqltypes.Result{}, nil
}
326671
func (s *ServeCmd) Execute(args []string) error {
	if len(args) == 0 {
		return errors.New("specify the spec to serve as argument to the serve command")
	}

	specDoc, err := loads.Spec(args[0])
	if err != nil {
		return err
	}
	b, err := json.MarshalIndent(specDoc.Spec(), "", "  ")
	if err != nil {
		return err
	}

	basePath := s.BasePath
	if basePath == "" {
		basePath = "/"
	}

	listener, err := net.Listen("tcp4", net.JoinHostPort(s.Host, strconv.Itoa(s.Port)))
	if err != nil {
		return err
	}
	sh, sp, err := swag.SplitHostPort(listener.Addr().String())
	if err != nil {
		return err
	}
	if sh == "0.0.0.0" {
		sh = "localhost"
	}

	visit := s.DocURL
	handler := http.NotFoundHandler()
	if !s.NoUI {
		if s.Flavor == "redoc" {
			handler = middleware.Redoc(middleware.RedocOpts{
				BasePath: basePath,
				SpecURL:  path.Join(basePath, "swagger.json"),
				Path:     "docs",
			}, handler)
			visit = fmt.Sprintf("http://%s:%d%s", sh, sp, path.Join(basePath, "docs"))
		} else if visit != "" || s.Flavor == "swagger" {
			if visit == "" {
				visit = "http://petstore.swagger.io/"
			}
			u, err := url.Parse(visit)
			if err != nil {
				return err
			}
			q := u.Query()
			q.Add("url", fmt.Sprintf("http://%s:%d%s", sh, sp, path.Join(basePath, "swagger.json")))
			u.RawQuery = q.Encode()
			visit = u.String()
		}
	}

	handler = handlers.CORS()(middleware.Spec(basePath, b, handler))
	errFuture := make(chan error)
	go func() {
		docServer := new(http.Server)
		docServer.SetKeepAlivesEnabled(true)
		docServer.Handler = handler

		errFuture <- docServer.Serve(listener)
	}()

	if !s.NoOpen && !s.NoUI {
		err := webbrowser.Open(visit)
		if err != nil {
			return err
		}
	}
	log.Println("serving docs at", visit)
	return <-errFuture
}
1106159
func (s *Store) execute(c *Connection, ex *ExecuteRequest) (*ExecuteResponse, error) {
	if c == nil {
		s.connsMu.RLock()
		c = s.conns[defaultConnID]
		s.connsMu.RUnlock()
	}
	c.SetLastUsedNow()

	start := time.Now()

	d := &databaseSub{
		ConnID:  c.ID,
		Atomic:  ex.Atomic,
		Queries: ex.Queries,
		Timings: ex.Timings,
	}
	cmd, err := newCommand(execute, d)
	if err != nil {
		return nil, err
	}
	b, err := json.Marshal(cmd)
	if err != nil {
		return nil, err
	}

	f := s.raft.Apply(b, s.ApplyTimeout)
	if e := f.(raft.Future); e.Error() != nil {
		if e.Error() == raft.ErrNotLeader {
			return nil, ErrNotLeader
		}
		return nil, e.Error()
	}

	switch r := f.Response().(type) {
	case *fsmExecuteResponse:
		return &ExecuteResponse{
			Results: r.results,
			Time:    time.Since(start).Seconds(),
			Raft:    RaftResponse{f.Index(), s.raftID},
		}, r.error
	case *fsmGenericResponse:
		return nil, r.error
	default:
		panic("unsupported type")
	}
}
1131258
func Execute(main interface{}) error {
	com, err := Command(main)
	if err != nil {
		return fmt.Errorf("getting command: %v", err)
	}

	return com.Execute()
}