// handleSetOption refer to https://dev.mysql.com/doc/internals/en/com-set-option.html
507462
func (cc *clientConn) handleSetOption(data []byte) (err error) {
	if len(data) < 2 {
		return mysql.ErrMalformPacket
	}

	switch binary.LittleEndian.Uint16(data[:2]) {
	case 0:
		cc.capability |= mysql.ClientMultiStatements
		cc.ctx.SetClientCapability(cc.capability)
	case 1:
		cc.capability &^= mysql.ClientMultiStatements
		cc.ctx.SetClientCapability(cc.capability)
	default:
		return mysql.ErrMalformPacket
	}
	if err = cc.writeEOF(0); err != nil {
		return err
	}

	return cc.flush()
}
849431
func (s Service) MethodOptions() []string {
	optionSet := make(map[string]struct{})
	for _, method := range s.Methods {
		for option := range method.Options {
			optionSet[option] = struct{}{}
		}
	}
	if len(optionSet) == 0 {
		return nil
	}
	options := make([]string, 0, len(optionSet))
	for option := range optionSet {
		options = append(options, option)
	}
	sort.Strings(options)
	return options
}
1324864
func (s *Server) Options(path string, h HandlerFunc, opts ...HandlerOption) {
	s.register(http.MethodOptions, path, h, opts...)
}
1327064
func (d *DropDown) SetCurrentOption(index int) *DropDown {
	if index >= 0 && index < len(d.options) {
		d.currentOption = index
		d.list.SetCurrentItem(index)
		if d.selected != nil {
			d.selected(d.options[index].Text, index)
		}
		if d.options[index].Selected != nil {
			d.options[index].Selected()
		}
	} else {
		d.currentOption = -1
		d.list.SetCurrentItem(0) // Set to 0 because -1 means "last item".
		if d.selected != nil {
			d.selected("", -1)
		}
	}
	return d
}
784613
func (s *Section) SetOption(key string, value string) *Section {
	s.Options = s.Options.withSettedOption(key, value)
	return s
}
768848
func (s *SimulatePrincipalPolicyInput) SetResourceHandlingOption(v string) *SimulatePrincipalPolicyInput {
	s.ResourceHandlingOption = &v
	return s
}
858767
func (mh *MethodHandler) Options(options *sparta.LambdaFunctionOptions) *MethodHandler {
	mh.options = options
	return mh
}
112249
func (c *respClient) handleXSelectCmd() error {
	if len(c.args) <= 2 {
		// invalid command format
		return fmt.Errorf("invalid format for XSELECT, must XSELECT db THEN your command")
	}

	if hack.String(upperSlice(c.args[1])) != "THEN" {
		// invalid command format, just resturn here
		return fmt.Errorf("invalid format for XSELECT, must XSELECT db THEN your command")
	}

	index, err := strconv.Atoi(hack.String(c.args[0]))
	if err != nil {
		return fmt.Errorf("invalid db for XSELECT, err %v", err)
	}

	db, err := c.app.ldb.Select(index)
	if err != nil {
		return fmt.Errorf("invalid db for XSELECT, err %v", err)
	}

	c.db = db

	c.cmd = hack.String(lowerSlice(c.args[2]))
	c.args = c.args[3:]

	return nil
}
927306
func (c *configCommand) handleOneArg(args []string) error {
	// If there's an '=', this must be setting a value
	if strings.Contains(args[0], "=") {
		return c.parseSet(args)
	}
	// If there's no reset,	we want to get a single value
	if len(c.reset) == 0 {
		c.action = c.getConfig
		c.keys = args
		return nil
	}
	// Otherwise we have reset and a get arg, which is invalid.
	return errors.New("cannot reset and retrieve values simultaneously")
}
38265
func (r *Router) OPTIONS(path string, handlers ...HandlerFunc) {
	r.Handle("OPTIONS", path, handlers)
}
1371733
func (c *Menu) HandleEvent(event termbox.Event) bool {
	if event.Key == termbox.KeyEnter || event.Key == termbox.KeySpace {
		c.isDone = true
		return true
	}
	currentIdx := c.GetSelectedIndex()
	switch event.Key {
	case termbox.KeyArrowUp:
		c.SelectPrevOption()
	case termbox.KeyArrowDown:
		c.SelectNextOption()
	case termbox.KeyArrowLeft:
		c.SelectPageUpOption()
	case termbox.KeyArrowRight:
		c.SelectPageDownOption()
	}
	if c.vimMode {
		switch event.Ch {
		case 'j':
			c.SelectNextOption()
		case 'k':
			c.SelectPrevOption()
		}
		if event.Key == termbox.KeyCtrlF {
			c.SelectPageDownOption()
		} else if event.Key == termbox.KeyCtrlB {
			c.SelectPageUpOption()
		}
	}
	if c.GetSelectedIndex() != currentIdx {
		return true
	}
	return false
}
451999
func (r *Router) OPTIONS(route string, handler interface{}) *Router {
	r.Handle(MethodOPTIONS, route, handler)
	return r
}
779227
func (c *Config) ProcessOptions(options ...Option) {
	for _, opt := range options {
		if opt != nil {
			opt(c)
		}
	}
}
1111167
func (app *App) OPTIONS(route string, handler interface{}) *App {
	app.defaultRouter.Handle(MethodOPTIONS, route, handler)
	return app
}
235156
func (h *HCI) Option(opts ...Option) error {
	var err error
	for _, opt := range opts {
		err = opt(h)
	}
	return err
}
462151
func (db *Database) Options(opts ...Option) {
	for _, opt := range opts {
		opt(db)
	}
}
1247493
func (g *routeGroup) Options(path string, h ...Handler) {
	g.handle(OPTIONS, path, h)
}