func (t systemSetType) EncodeValue(val interface{}) (string, error) {
	expectedVal, ok := val.(string)
	if !ok {
		return "", ErrSystemVariableCodeFail.New(val, t.String())
	}
	return expectedVal, nil
}
EncodeValue implements SystemVariableType interface.
package sql
import (
	"github.com/dolthub/vitess/go/sqltypes"
	"github.com/dolthub/vitess/go/vt/proto/query"
)
type systemSetType struct {
	SetType
	varName string
}
var _ SystemVariableType = systemSetType{}
func NewSystemSetType(varName string, values ...string) SystemVariableType {
	return systemSetType{MustCreateSetType(values, Collation_Default), varName}
}
func (t systemSetType) Compare(a interface{}, b interface{}) (int, error) {
	if a == nil || b == nil {
		return 0, ErrInvalidSystemVariableValue.New(t.varName, nil)
	}
	ai, err := t.Marshal(a)
	if err != nil {
		return 0, err
	}
	bi, err := t.Marshal(b)
	if err != nil {
		return 0, err
	}
	if ai == bi {
		return 0, nil
	}
	if ai < bi {
		return -1, nil
	}
	return 1, nil
}
func (t systemSetType) Convert(v interface{}) (interface{}, error) {
	switch value := v.(type) {
	case int:
		return t.SetType.Convert(value)
	case uint:
		return t.SetType.Convert(value)
	case int8:
		return t.SetType.Convert(value)
	case uint8:
		return t.SetType.Convert(value)
	case int16:
		return t.SetType.Convert(value)
	case uint16:
		return t.SetType.Convert(value)
	case int32:
		return t.SetType.Convert(value)
	case uint32:
		return t.SetType.Convert(value)
	case int64:
		return t.SetType.Convert(value)
	case uint64:
		return t.SetType.Convert(value)
	case float32:
		return t.Convert(float64(value))
	case float64:
		if value == float64(int64(value)) {
			return t.SetType.Convert(int64(value))
		}
	case string:
		return t.SetType.Convert(value)
	}
	return nil, ErrInvalidSystemVariableValue.New(t.varName, v)
}
func (t systemSetType) MustConvert(v interface{}) interface{} {
	value, err := t.Convert(v)
	if err != nil {
		panic(err)
	}
	return value
}
func (t systemSetType) Promote() Type {
	return t
}
func (t systemSetType) SQL(v interface{}) (sqltypes.Value, error) {
	if v == nil {
		return sqltypes.NULL, nil
	}
	v, err := t.Convert(v)
	if err != nil {
		return sqltypes.Value{}, err
	}
	return sqltypes.MakeTrusted(t.Type(), []byte(v.(string))), nil
}
func (t systemSetType) String() string {
	return "SYSTEM_SET"
}
func (t systemSetType) Type() query.Type {
	return sqltypes.VarChar
}
func (t systemSetType) Zero() interface{} {
	return ""
}