Repository: oom-ai/oomstore
Pull request #784 (2021-12-23 02:46:48)

refactor: enum renaming
Make enums more readable.


Patch:
diff --git a/internal/database/database.go b/internal/database/database.go
index 63a50a0a..8ebbe938 100644
--- a/internal/database/database.go
+++ b/internal/database/database.go
@@ -28,15 +28,15 @@ import (
 
 func OpenOnlineStore(opt types.OnlineStoreConfig) (online.Store, error) {
 	switch opt.Backend {
-	case types.POSTGRES:
+	case types.BackendPostgres:
 		return onlinePG.Open(opt.Postgres)
-	case types.REDIS:
+	case types.BackendRedis:
 		return onlineRedis.Open(opt.Redis), nil
-	case types.MYSQL:
+	case types.BackendMySQL:
 		return onlineMySQL.Open(opt.MySQL)
-	case types.DYNAMODB:
+	case types.BackendDynamoDB:
 		return onlineDynamoDB.Open(opt.DynamoDB)
-	case types.CASSANDRA:
+	case types.BackendCassandra:
 		return onlineCassandra.Open(opt.Cassandra)
 	default:
 		return nil, fmt.Errorf("unsupported backend: %s", opt.Backend)
@@ -45,11 +45,11 @@ func OpenOnlineStore(opt types.OnlineStoreConfig) (online.Store, error) {
 
 func OpenMetadataStore(opt types.MetadataStoreConfig) (metadata.Store, error) {
 	switch opt.Backend {
-	case types.POSTGRES:
+	case types.BackendPostgres:
 		return metadataPG.Open(context.Background(), opt.Postgres)
-	case types.MYSQL:
+	case types.BackendMySQL:
 		return metadataMySQL.Open(context.Background(), opt.MySQL)
-	case types.SQLite:
+	case types.BackendSQLite:
 		return metadataSQLite.Open(context.Background(), opt.SQLite)
 	default:
 		return nil, fmt.Errorf("unsupported backend: %s", opt.Backend)
@@ -58,11 +58,11 @@ func OpenMetadataStore(opt types.MetadataStoreConfig) (metadata.Store, error) {
 
 func CreateMetadataDatabase(ctx context.Context, opt types.MetadataStoreConfig) error {
 	switch opt.Backend {
-	case types.POSTGRES:
+	case types.BackendPostgres:
 		return metadataPG.CreateDatabase(ctx, *opt.Postgres)
-	case types.MYSQL:
+	case types.BackendMySQL:
 		return metadataMySQL.CreateDatabase(ctx, *opt.MySQL)
-	case types.SQLite:
+	case types.BackendSQLite:
 		return metadataSQLite.CreateDatabase(ctx, *opt.SQLite)
 	default:
 		return fmt.Errorf("unsupported backend: %s", opt.Backend)
@@ -71,15 +71,15 @@ func CreateMetadataDatabase(ctx context.Context, opt types.MetadataStoreConfig)
 
 func OpenOfflineStore(ctx context.Context, opt types.OfflineStoreConfig) (offline.Store, error) {
 	switch opt.Backend {
-	case types.POSTGRES:
+	case types.BackendPostgres:
 		return offlinePG.Open(opt.Postgres)
-	case types.MYSQL:
+	case types.BackendMySQL:
 		return offlineMySQL.Open(opt.MySQL)
-	case types.SNOWFLAKE:
+	case types.BackendSnowflake:
 		return offlineSnowflake.Open(opt.Snowflake)
-	case types.BIGQUERY:
+	case types.BackendBigQuery:
 		return offlineBigQuery.Open(ctx, opt.BigQuery)
-	case types.REDSHIFT:
+	case types.BackendRedshift:
 		return offlineRedshift.Open(opt.Redshift)
 	default:
 		return nil, fmt.Errorf("unsupported backend: %s", opt.Backend)
diff --git a/internal/database/dbutil/database.go b/internal/database/dbutil/database.go
index 71357886..8c329af7 100644
--- a/internal/database/dbutil/database.go
+++ b/internal/database/dbutil/database.go
@@ -42,7 +42,7 @@ var OpenRedshiftDB = OpenPostgresDB
 
 func DeserializeString(i interface{}, backend types.BackendType) string {
 	switch backend {
-	case types.MYSQL:
+	case types.BackendMySQL:
 		return string(i.([]byte))
 	default:
 		return i.(string)
@@ -51,18 +51,18 @@ func DeserializeString(i interface{}, backend types.BackendType) string {
 
 func IsTableNotFoundError(err error, backend types.BackendType) bool {
 	switch backend {
-	case types.SQLite:
+	case types.BackendSQLite:
 		// https://github.com/mattn/go-sqlite3/issues/244
 		if sqliteErr, ok := err.(sqlite3.Error); ok {
 			return sqliteErr.Code == sqlite3.ErrError
 		}
 
 	// https://dev.mysql.com/doc/mysql-errors/5.7/en/server-error-reference.html#error_er_no_such_table
-	case types.MYSQL:
+	case types.BackendMySQL:
 		if e2, ok := err.(*mysql.MySQLError); ok {
 			return e2.Number == 1146
 		}
-	case types.POSTGRES:
+	case types.BackendPostgres:
 		if e2, ok := err.(*pq.Error); ok {
 			return e2.Code == pgerrcode.UndefinedTable
 		}
diff --git a/internal/database/dbutil/db_opt.go b/internal/database/dbutil/db_opt.go
index 561c7bd7..04254f1a 100644
--- a/internal/database/dbutil/db_opt.go
+++ b/internal/database/dbutil/db_opt.go
@@ -25,7 +25,7 @@ type DBOpt struct {
 
 func (d *DBOpt) ExecContext(ctx context.Context, query string, args []interface{}) error {
 	switch d.Backend {
-	case types.BIGQUERY:
+	case types.BackendBigQuery:
 		_, err := d.BigQueryDB.Query(query).Read(ctx)
 		return err
 	default:
@@ -41,16 +41,16 @@ func (d *DBOpt) BuildInsertQuery(tableName string, records []interface{}, column
 
 	var columnStr string
 	switch d.Backend {
-	case types.POSTGRES, types.SNOWFLAKE, types.REDSHIFT:
+	case types.BackendPostgres, types.BackendSnowflake, types.BackendRedshift:
 		columnStr = Quote(`"`, columns...)
 		tableName = fmt.Sprintf(`"%s"`, tableName)
-	case types.MYSQL, types.SQLite, types.BIGQUERY:
+	case types.BackendMySQL, types.BackendSQLite, types.BackendBigQuery:
 		columnStr = Quote("`", columns...)
 		tableName = fmt.Sprintf("`%s`", tableName)
 	}
 
 	switch d.Backend {
-	case types.BIGQUERY:
+	case types.BackendBigQuery:
 		values := make([]string, 0, len(records))
 		for _, row := range records {
 			values = append(values, fmt.Sprintf("(%s)", strings.Join(cast.ToStringSlice(row), ",")))
diff --git a/internal/database/dbutil/schema.go b/internal/database/dbutil/schema.go
index 5dd41776..d36737c6 100644
--- a/internal/database/dbutil/schema.go
+++ b/internal/database/dbutil/schema.go
@@ -25,11 +25,11 @@ var (
 	createSchemaFuncs = template.FuncMap{
 		"entity": func(entity types.Entity, backend types.BackendType) string {
 			switch backend {
-			case types.CASSANDRA, types.SQLite:
+			case types.BackendCassandra, types.BackendSQLite:
 				return fmt.Sprintf(`"%s" TEXT PRIMARY KEY`, entity.Name)
-			case types.POSTGRES, types.SNOWFLAKE:
+			case types.BackendPostgres, types.BackendSnowflake:
 				return fmt.Sprintf(`"%s" VARCHAR(%d) PRIMARY KEY`, entity.Name, entity.Length)
-			case types.MYSQL:
+			case types.BackendMySQL:
 				return fmt.Sprintf("`%s` VARCHAR(%d) PRIMARY KEY", entity.Name, entity.Length)
 			default:
 				return fmt.Sprintf("%s VARCHAR(%d) PRIMARY KEY", entity.Name, entity.Length)
@@ -38,9 +38,9 @@ var (
 		"columnJoin": func(columns []Column, backend types.BackendType) string {
 			var format string
 			switch backend {
-			case types.POSTGRES, types.SNOWFLAKE, types.CASSANDRA:
+			case types.BackendPostgres, types.BackendSnowflake, types.BackendCassandra:
 				format = `"%s" %s`
-			case types.MYSQL:
+			case types.BackendMySQL:
 				format = "`%s` %s"
 			default:
 				format = "%s %s"
@@ -70,7 +70,7 @@ type CreateSchema struct {
 func BuildCreateSchema(tableName string, entity *types.Entity, features types.FeatureList, backend types.BackendType) (string, error) {
 	var text string
 	switch backend {
-	case types.SNOWFLAKE:
+	case types.BackendSnowflake:
 		text = snowflakeCreateSchema
 	default:
 		text = createSchema
diff --git a/internal/database/dbutil/sql.go b/internal/database/dbutil/sql.go
index 16f3e582..3ca79830 100644
--- a/internal/database/dbutil/sql.go
+++ b/internal/database/dbutil/sql.go
@@ -67,9 +67,9 @@ func Quote(quote string, fields ...string) string {
 func GetColumnFormat(backendType types.BackendType) (string, error) {
 	var columnFormat string
 	switch backendType {
-	case types.POSTGRES, types.SNOWFLAKE, types.REDSHIFT:
+	case types.BackendPostgres, types.BackendSnowflake, types.BackendRedshift:
 		columnFormat = `"%s" %s`
-	case types.MYSQL, types.SQLite, types.BIGQUERY:
+	case types.BackendMySQL, types.BackendSQLite, types.BackendBigQuery:
 		columnFormat = "`%s` %s"
 	default:
 		return "", fmt.Errorf("unsupported backend type %s", backendType)
@@ -80,9 +80,9 @@ func GetColumnFormat(backendType types.BackendType) (string, error) {
 func QuoteFn(backendType types.BackendType) (func(...string) string, error) {
 	var quote string
 	switch backendType {
-	case types.POSTGRES, types.SNOWFLAKE, types.REDSHIFT:
+	case types.BackendPostgres, types.BackendSnowflake, types.BackendRedshift:
 		quote = `"`
-	case types.MYSQL, types.SQLite, types.BIGQUERY:
+	case types.BackendMySQL, types.BackendSQLite, types.BackendBigQuery:
 		quote = "`"
 	default:
 		return nil, fmt.Errorf("unsupported backend type %s", backendType)
diff --git a/internal/database/dbutil/type_mapping.go b/internal/database/dbutil/type_mapping.go
index cd82125a..88d61c50 100644
--- a/internal/database/dbutil/type_mapping.go
+++ b/internal/database/dbutil/type_mapping.go
@@ -11,19 +11,19 @@ import (
 func DBValueType(backend types.BackendType, valueType types.ValueType) (string, error) {
 	var mp map[types.ValueType]string
 	switch backend {
-	case types.POSTGRES:
+	case types.BackendPostgres:
 		mp = valueTypeToPostgresType
-	case types.SQLite:
+	case types.BackendSQLite:
 		mp = valueTypeToSQLiteType
-	case types.MYSQL:
+	case types.BackendMySQL:
 		mp = valueTypeToMySQLType
-	case types.CASSANDRA:
+	case types.BackendCassandra:
 		mp = valueTypeToCassandraType
-	case types.SNOWFLAKE:
+	case types.BackendSnowflake:
 		mp = valueTypeToSnowFlakeType
-	case types.DYNAMODB:
+	case types.BackendDynamoDB:
 		mp = valueTypeToDynamoDBType
-	case types.REDSHIFT:
+	case types.BackendRedshift:
 		mp = valueTypeToRedshiftType
 	default:
 		return "", errdefs.InvalidAttribute(fmt.Errorf("unsupported backend: %s", backend))
@@ -40,17 +40,17 @@ func DBValueType(backend types.BackendType, valueType types.ValueType) (string,
 func ValueType(backend types.BackendType, dbValueType string) (types.ValueType, error) {
 	var mp map[string]types.ValueType
 	switch backend {
-	case types.POSTGRES:
+	case types.BackendPostgres:
 		mp = postgresTypeToValueType
-	case types.MYSQL:
+	case types.BackendMySQL:
 		mp = mysqlTypeToValueType
-	case types.SNOWFLAKE:
+	case types.BackendSnowflake:
 		mp = snowflakeTypeToValueType
-	case types.BIGQUERY:
+	case types.BackendBigQuery:
 		mp = bigQueryTypeToValueType
-	case types.SQLite:
+	case types.BackendSQLite:
 		mp = sqliteTypeToValueType
-	case types.REDSHIFT:
+	case types.BackendRedshift:
 		mp = redshiftTypeToValueType
 	default:
 		return 0, errdefs.InvalidAttribute(fmt.Errorf("unsupported backend: %s", backend))
@@ -66,52 +66,52 @@ func ValueType(backend types.BackendType, dbValueType string) (types.ValueType,
 // Mapping feature value type to database data type
 var (
 	valueTypeToSQLiteType = map[types.ValueType]string{
-		types.STRING:  "text",
-		types.INT64:   "integer",
-		types.FLOAT64: "float",
-		types.BOOL:    "integer",
-		types.BYTES:   "blob",
-		types.TIME:    "timestamp",
+		types.String:  "text",
+		types.Int64:   "integer",
+		types.Float64: "float",
+		types.Bool:    "integer",
+		types.Bytes:   "blob",
+		types.Time:    "timestamp",
 	}
 	valueTypeToMySQLType = map[types.ValueType]string{
-		types.STRING:  "text",
-		types.INT64:   "bigint",
-		types.FLOAT64: "double",
-		types.BOOL:    "bool",
-		types.TIME:    "datetime",
-		types.BYTES:   "varbinary",
+		types.String:  "text",
+		types.Int64:   "bigint",
+		types.Float64: "double",
+		types.Bool:    "bool",
+		types.Time:    "datetime",
+		types.Bytes:   "varbinary",
 	}
 	valueTypeToPostgresType = map[types.ValueType]string{
-		types.STRING:  "text",
-		types.INT64:   "bigint",
-		types.FLOAT64: "double precision",
-		types.BOOL:    "boolean",
-		types.TIME:    "timestamp",
-		types.BYTES:   "bytea",
+		types.String:  "text",
+		types.Int64:   "bigint",
+		types.Float64: "double precision",
+		types.Bool:    "boolean",
+		types.Time:    "timestamp",
+		types.Bytes:   "bytea",
 	}
 	valueTypeToSnowFlakeType = map[types.ValueType]string{
-		types.STRING:  "varchar",
-		types.INT64:   "bigint",
-		types.FLOAT64: "double",
-		types.BOOL:    "boolean",
-		types.TIME:    "timestamp",
-		types.BYTES:   "varbinary",
+		types.String:  "varchar",
+		types.Int64:   "bigint",
+		types.Float64: "double",
+		types.Bool:    "boolean",
+		types.Time:    "timestamp",
+		types.Bytes:   "varbinary",
 	}
 	valueTypeToDynamoDBType = map[types.ValueType]string{
-		types.STRING:  "String",
-		types.INT64:   "BigInteger",
-		types.FLOAT64: "Double",
-		types.BOOL:    "Boolean",
-		types.TIME:    "Date",
-		types.BYTES:   "ByteBuffer",
+		types.String:  "String",
+		types.Int64:   "BigInteger",
+		types.Float64: "Double",
+		types.Bool:    "Boolean",
+		types.Time:    "Date",
+		types.Bytes:   "ByteBuffer",
 	}
 	valueTypeToCassandraType = map[types.ValueType]string{
-		types.STRING:  "text",
-		types.INT64:   "bigint",
-		types.FLOAT64: "double",
-		types.BOOL:    "boolean",
-		types.TIME:    "timestamp",
-		types.BYTES:   "blob",
+		types.String:  "text",
+		types.Int64:   "bigint",
+		types.Float64: "double",
+		types.Bool:    "boolean",
+		types.Time:    "timestamp",
+		types.Bytes:   "blob",
 	}
 	valueTypeToRedshiftType = valueTypeToPostgresType
 )
@@ -119,184 +119,184 @@ var (
 // Mapping database data type to feature value type
 var (
 	postgresTypeToValueType = map[string]types.ValueType{
-		"bigint":    types.INT64,
-		"int8":      types.INT64,
-		"bigserial": types.INT64,
-		"serial8":   types.INT64,
-
-		"boolean": types.BOOL,
-		"bool":    types.BOOL,
-
-		"bytea":       types.BYTES,
-		"jsonb":       types.BYTES,
-		"uuid":        types.BYTES,
-		"bit":         types.BYTES,
-		"bit varying": types.BYTES,
-		"character":   types.BYTES,
-		"char":        types.BYTES,
-		"json":        types.BYTES,
-		"money":       types.BYTES,
-		"numeric":     types.BYTES,
-
-		"character varying": types.STRING,
-		"text":              types.STRING,
-		"varchar":           types.STRING,
-
-		"double precision": types.FLOAT64,
-		"float8":           types.FLOAT64,
-
-		"integer": types.INT64,
-		"int":     types.INT64,
-		"int4":    types.INT64,
-		"serial":  types.INT64,
-		"serial4": types.INT64,
-
-		"real":   types.FLOAT64,
-		"float4": types.FLOAT64,
-
-		"smallint":    types.INT64,
-		"int2":        types.INT64,
-		"smallserial": types.INT64,
-		"serial2":     types.INT64,
-
-		"date":                        types.TIME,
-		"time":                        types.TIME,
-		"time without time zone":      types.TIME,
-		"time with time zone":         types.TIME,
-		"timetz":                      types.TIME,
-		"timestamp":                   types.TIME,
-		"timestamp without time zone": types.TIME,
-		"timestamp with time zone":    types.TIME,
-		"timestamptz":                 types.TIME,
+		"bigint":    types.Int64,
+		"int8":      types.Int64,
+		"bigserial": types.Int64,
+		"serial8":   types.Int64,
+
+		"boolean": types.Bool,
+		"bool":    types.Bool,
+
+		"bytea":       types.Bytes,
+		"jsonb":       types.Bytes,
+		"uuid":        types.Bytes,
+		"bit":         types.Bytes,
+		"bit varying": types.Bytes,
+		"character":   types.Bytes,
+		"char":        types.Bytes,
+		"json":        types.Bytes,
+		"money":       types.Bytes,
+		"numeric":     types.Bytes,
+
+		"character varying": types.String,
+		"text":              types.String,
+		"varchar":           types.String,
+
+		"double precision": types.Float64,
+		"float8":           types.Float64,
+
+		"integer": types.Int64,
+		"int":     types.Int64,
+		"int4":    types.Int64,
+		"serial":  types.Int64,
+		"serial4": types.Int64,
+
+		"real":   types.Float64,
+		"float4": types.Float64,
+
+		"smallint":    types.Int64,
+		"int2":        types.Int64,
+		"smallserial": types.Int64,
+		"serial2":     types.Int64,
+
+		"date":                        types.Time,
+		"time":                        types.Time,
+		"time without time zone":      types.Time,
+		"time with time zone":         types.Time,
+		"timetz":                      types.Time,
+		"timestamp":                   types.Time,
+		"timestamp without time zone": types.Time,
+		"timestamp with time zone":    types.Time,
+		"timestamptz":                 types.Time,
 	}
 	bigQueryTypeToValueType = map[string]types.ValueType{
-		"bool":     types.BOOL,
-		"bytes":    types.BYTES,
-		"datetime": types.TIME,
-		"string":   types.STRING,
-
-		"bigint":   types.INT64,
-		"smallint": types.INT64,
-		"int64":    types.INT64,
-		"integer":  types.INT64,
-		"int":      types.INT64,
-
-		"float64": types.FLOAT64,
-		"numeric": types.FLOAT64,
-		"decimal": types.FLOAT64,
+		"bool":     types.Bool,
+		"bytes":    types.Bytes,
+		"datetime": types.Time,
+		"string":   types.String,
+
+		"bigint":   types.Int64,
+		"smallint": types.Int64,
+		"int64":    types.Int64,
+		"integer":  types.Int64,
+		"int":      types.Int64,
+
+		"float64": types.Float64,
+		"numeric": types.Float64,
+		"decimal": types.Float64,
 	}
 	mysqlTypeToValueType = map[string]types.ValueType{
-		"boolean": types.BOOL,
-		"bool":    types.BOOL,
-
-		"binary":    types.BYTES,
-		"varbinary": types.BYTES,
-
-		"integer":   types.INT64,
-		"int":       types.INT64,
-		"smallint":  types.INT64,
-		"bigint":    types.INT64,
-		"tinyint":   types.INT64,
-		"mediumint": types.INT64,
-
-		"double": types.FLOAT64,
-		"float":  types.FLOAT64,
-
-		"text":    types.STRING,
-		"varchar": types.STRING,
-		"char":    types.STRING,
-
-		"date":      types.TIME,
-		"time":      types.TIME,
-		"datetime":  types.TIME,
-		"timestamp": types.TIME,
-		"year":      types.TIME,
+		"boolean": types.Bool,
+		"bool":    types.Bool,
+
+		"binary":    types.Bytes,
+		"varbinary": types.Bytes,
+
+		"integer":   types.Int64,
+		"int":       types.Int64,
+		"smallint":  types.Int64,
+		"bigint":    types.Int64,
+		"tinyint":   types.Int64,
+		"mediumint": types.Int64,
+
+		"double": types.Float64,
+		"float":  types.Float64,
+
+		"text":    types.String,
+		"varchar": types.String,
+		"char":    types.String,
+
+		"date":      types.Time,
+		"time":      types.Time,
+		"datetime":  types.Time,
+		"timestamp": types.Time,
+		"year":      types.Time,
 	}
 	// TODO: add type NUMBER, DECIMAL, NUMERIC
 	snowflakeTypeToValueType = map[string]types.ValueType{
-		"boolean": types.BOOL,
-
-		"binary":    types.BYTES,
-		"varbinary": types.BYTES,
-
-		"integer":  types.INT64,
-		"int":      types.INT64,
-		"smallint": types.INT64,
-		"bigint":   types.INT64,
-		"tinyint":  types.INT64,
-		"byteint":  types.INT64,
-
-		"double":           types.FLOAT64,
-		"double precision": types.FLOAT64,
-		"real":             types.FLOAT64,
-		"float":            types.FLOAT64,
-		"float4":           types.FLOAT64,
-		"float8":           types.FLOAT64,
-
-		"string":    types.STRING,
-		"text":      types.STRING,
-		"varchar":   types.STRING,
-		"char":      types.STRING,
-		"character": types.STRING,
-
-		"date":      types.TIME,
-		"time":      types.TIME,
-		"datetime":  types.TIME,
-		"timestamp": types.TIME,
+		"boolean": types.Bool,
+
+		"binary":    types.Bytes,
+		"varbinary": types.Bytes,
+
+		"integer":  types.Int64,
+		"int":      types.Int64,
+		"smallint": types.Int64,
+		"bigint":   types.Int64,
+		"tinyint":  types.Int64,
+		"byteint":  types.Int64,
+
+		"double":           types.Float64,
+		"double precision": types.Float64,
+		"real":             types.Float64,
+		"float":            types.Float64,
+		"float4":           types.Float64,
+		"float8":           types.Float64,
+
+		"string":    types.String,
+		"text":      types.String,
+		"varchar":   types.String,
+		"char":      types.String,
+		"character": types.String,
+
+		"date":      types.Time,
+		"time":      types.Time,
+		"datetime":  types.Time,
+		"timestamp": types.Time,
 	}
 	sqliteTypeToValueType = map[string]types.ValueType{
-		"integer":   types.INT64,
-		"float":     types.FLOAT64,
-		"blob":      types.BYTES,
-		"text":      types.STRING,
-		"timestamp": types.TIME,
-		"datetime":  types.TIME,
+		"integer":   types.Int64,
+		"float":     types.Float64,
+		"blob":      types.Bytes,
+		"text":      types.String,
+		"timestamp": types.Time,
+		"datetime":  types.Time,
 	}
 	// Redshift data type: https://docs.aws.amazon.com/redshift/latest/dg/c_Supported_data_types.html
 	redshiftTypeToValueType = map[string]types.ValueType{
-		"bigint": types.INT64,
-		"int8":   types.INT64,
-
-		"boolean": types.BOOL,
-		"bool":    types.BOOL,
-
-		"character":      types.BYTES,
-		"char":           types.BYTES,
-		"nchar":          types.BYTES,
-		"bpchar":         types.BYTES,
-		"varbyte":        types.BYTES,
-		"varbinary":      types.BYTES,
-		"binary varying": types.BYTES,
-		"numeric":        types.BYTES,
-		"decimal":        types.BYTES,
-
-		"character varying": types.STRING,
-		"text":              types.STRING,
-		"varchar":           types.STRING,
-		"nvarchar":          types.STRING,
-
-		"double precision": types.FLOAT64,
-		"float8":           types.FLOAT64,
-		"float":            types.FLOAT64,
-
-		"integer": types.INT64,
-		"int":     types.INT64,
-		"int4":    types.INT64,
-
-		"real":   types.FLOAT64,
-		"float4": types.FLOAT64,
-
-		"smallint": types.INT64,
-		"int2":     types.INT64,
-
-		"date":                        types.TIME,
-		"time":                        types.TIME,
-		"time without time zone":      types.TIME,
-		"time with time zone":         types.TIME,
-		"timetz":                      types.TIME,
-		"timestamp":                   types.TIME,
-		"timestamp without time zone": types.TIME,
-		"timestamp with time zone":    types.TIME,
-		"timestamptz":                 types.TIME,
+		"bigint": types.Int64,
+		"int8":   types.Int64,
+
+		"boolean": types.Bool,
+		"bool":    types.Bool,
+
+		"character":      types.Bytes,
+		"char":           types.Bytes,
+		"nchar":          types.Bytes,
+		"bpchar":         types.Bytes,
+		"varbyte":        types.Bytes,
+		"varbinary":      types.Bytes,
+		"binary varying": types.Bytes,
+		"numeric":        types.Bytes,
+		"decimal":        types.Bytes,
+
+		"character varying": types.String,
+		"text":              types.String,
+		"varchar":           types.String,
+		"nvarchar":          types.String,
+
+		"double precision": types.Float64,
+		"float8":           types.Float64,
+		"float":            types.Float64,
+
+		"integer": types.Int64,
+		"int":     types.Int64,
+		"int4":    types.Int64,
+
+		"real":   types.Float64,
+		"float4": types.Float64,
+
+		"smallint": types.Int64,
+		"int2":     types.Int64,
+
+		"date":                        types.Time,
+		"time":                        types.Time,
+		"time without time zone":      types.Time,
+		"time with time zone":         types.Time,
+		"timetz":                      types.Time,
+		"timestamp":                   types.Time,
+		"timestamp without time zone": types.Time,
+		"timestamp with time zone":    types.Time,
+		"timestamptz":                 types.Time,
 	}
 )
diff --git a/internal/database/offline/bigquery/import.go b/internal/database/offline/bigquery/import.go
index 6371afad..4e7f1055 100644
--- a/internal/database/offline/bigquery/import.go
+++ b/internal/database/offline/bigquery/import.go
@@ -72,17 +72,17 @@ func (db *DB) Import(ctx context.Context, opt offline.ImportOpt) (int64, error)
 
 func convertValueTypeToBigQueryType(t types.ValueType) (bigquery.FieldType, error) {
 	switch t {
-	case types.STRING:
+	case types.String:
 		return bigquery.StringFieldType, nil
-	case types.INT64:
+	case types.Int64:
 		return bigquery.IntegerFieldType, nil
-	case types.BOOL:
+	case types.Bool:
 		return bigquery.BooleanFieldType, nil
-	case types.FLOAT64:
+	case types.Float64:
 		return bigquery.FloatFieldType, nil
-	case types.BYTES:
+	case types.Bytes:
 		return bigquery.BytesFieldType, nil
-	case types.TIME:
+	case types.Time:
 		return bigquery.TimeFieldType, nil
 	default:
 		return "", fmt.Errorf("unsupported value type %s", t)
diff --git a/internal/database/offline/bigquery/join.go b/internal/database/offline/bigquery/join.go
index 6d71f85a..b9844e91 100644
--- a/internal/database/offline/bigquery/join.go
+++ b/internal/database/offline/bigquery/join.go
@@ -28,7 +28,7 @@ func (db *DB) Join(ctx context.Context, opt offline.JoinOpt) (*types.JoinResult,
 		return nil, nil
 	}
 	dbOpt := dbutil.DBOpt{
-		Backend:    types.BIGQUERY,
+		Backend:    types.BackendBigQuery,
 		BigQueryDB: db.Client,
 		DatasetID:  &db.datasetID,
 	}
@@ -51,7 +51,7 @@ func (db *DB) Join(ctx context.Context, opt offline.JoinOpt) (*types.JoinResult,
 			Features:            featureList,
 			RevisionRanges:      revisionRanges,
 			EntityRowsTableName: entityRowsTableName,
-		}, types.MYSQL)
+		}, types.BackendMySQL)
 		if err != nil {
 			return nil, err
 		}
@@ -62,7 +62,7 @@ func (db *DB) Join(ctx context.Context, opt offline.JoinOpt) (*types.JoinResult,
 	}
 
 	//// Step 3: read joined results
-	return readJoinedTable(ctx, db, entityRowsTableName, tableNames, tableToFeatureMap, opt.ValueNames, types.MYSQL)
+	return readJoinedTable(ctx, db, entityRowsTableName, tableNames, tableToFeatureMap, opt.ValueNames, types.BackendMySQL)
 }
 
 func joinOneGroup(ctx context.Context, db *DB, opt offline.JoinOneGroupOpt, backendType types.BackendType) (string, error) {
diff --git a/internal/database/offline/bigquery/join_helper.go b/internal/database/offline/bigquery/join_helper.go
index 3a418e79..5bbb9e2a 100644
--- a/internal/database/offline/bigquery/join_helper.go
+++ b/internal/database/offline/bigquery/join_helper.go
@@ -60,17 +60,17 @@ func dropTable(ctx context.Context, db *DB, tableName string) error {
 
 func convertValueTypeToBigQuerySQLType(t types.ValueType) (string, error) {
 	switch t {
-	case types.STRING:
+	case types.String:
 		return "STRING", nil
-	case types.INT64:
+	case types.Int64:
 		return "BIGINT", nil
-	case types.BOOL:
+	case types.Bool:
 		return "BOOL", nil
-	case types.FLOAT64:
+	case types.Float64:
 		return "FLOAT64", nil
-	case types.BYTES:
+	case types.Bytes:
 		return "BYTES", nil
-	case types.TIME:
+	case types.Time:
 		return "DATETIME", nil
 	default:
 		return "", fmt.Errorf("unsupported value type %s", t)
diff --git a/internal/database/offline/bigquery/store.go b/internal/database/offline/bigquery/store.go
index 828efe85..ee502300 100644
--- a/internal/database/offline/bigquery/store.go
+++ b/internal/database/offline/bigquery/store.go
@@ -14,7 +14,7 @@ import (
 	"google.golang.org/api/option"
 )
 
-const BackendType = types.BIGQUERY
+const BackendType = types.BackendBigQuery
 
 var _ offline.Store = &DB{}
 
diff --git a/internal/database/offline/mysql/store.go b/internal/database/offline/mysql/store.go
index f1361280..cff8171b 100644
--- a/internal/database/offline/mysql/store.go
+++ b/internal/database/offline/mysql/store.go
@@ -29,15 +29,15 @@ func Open(option *types.MySQLOpt) (*DB, error) {
 }
 
 func (db *DB) Import(ctx context.Context, opt offline.ImportOpt) (int64, error) {
-	return sqlutil.Import(ctx, db.DB, opt, dbutil.LoadDataFromSource(types.MYSQL, MySQLBatchSize), types.MYSQL)
+	return sqlutil.Import(ctx, db.DB, opt, dbutil.LoadDataFromSource(types.BackendMySQL, MySQLBatchSize), types.BackendMySQL)
 }
 
 func (db *DB) Export(ctx context.Context, opt offline.ExportOpt) (<-chan types.ExportRecord, <-chan error) {
-	return sqlutil.Export(ctx, db.DB, opt, types.MYSQL)
+	return sqlutil.Export(ctx, db.DB, opt, types.BackendMySQL)
 }
 
 func (db *DB) Join(ctx context.Context, opt offline.JoinOpt) (*types.JoinResult, error) {
-	return sqlutil.Join(ctx, db.DB, opt, types.MYSQL)
+	return sqlutil.Join(ctx, db.DB, opt, types.BackendMySQL)
 }
 
 func (db *DB) TableSchema(ctx context.Context, tableName string) (*types.DataTableSchema, error) {
diff --git a/internal/database/offline/postgres/store.go b/internal/database/offline/postgres/store.go
index cb650262..2378c339 100644
--- a/internal/database/offline/postgres/store.go
+++ b/internal/database/offline/postgres/store.go
@@ -10,7 +10,7 @@ import (
 	"github.com/oom-ai/oomstore/pkg/oomstore/types"
 )
 
-const BackendType = types.POSTGRES
+const BackendType = types.BackendPostgres
 
 var _ offline.Store = &DB{}
 
@@ -28,15 +28,15 @@ func Open(option *types.PostgresOpt) (*DB, error) {
 }
 
 func (db *DB) Import(ctx context.Context, opt offline.ImportOpt) (int64, error) {
-	return sqlutil.Import(ctx, db.DB, opt, loadDataFromSource, types.POSTGRES)
+	return sqlutil.Import(ctx, db.DB, opt, loadDataFromSource, types.BackendPostgres)
 }
 
 func (db *DB) Export(ctx context.Context, opt offline.ExportOpt) (<-chan types.ExportRecord, <-chan error) {
-	return sqlutil.Export(ctx, db.DB, opt, types.POSTGRES)
+	return sqlutil.Export(ctx, db.DB, opt, types.BackendPostgres)
 }
 
 func (db *DB) Join(ctx context.Context, opt offline.JoinOpt) (*types.JoinResult, error) {
-	return sqlutil.Join(ctx, db.DB, opt, types.POSTGRES)
+	return sqlutil.Join(ctx, db.DB, opt, types.BackendPostgres)
 }
 
 func (db *DB) TableSchema(ctx context.Context, tableName string) (*types.DataTableSchema, error) {
diff --git a/internal/database/offline/redshift/store.go b/internal/database/offline/redshift/store.go
index d4f90c4e..2d2eb66c 100644
--- a/internal/database/offline/redshift/store.go
+++ b/internal/database/offline/redshift/store.go
@@ -10,7 +10,7 @@ import (
 	"github.com/oom-ai/oomstore/pkg/oomstore/types"
 )
 
-const BackendType = types.REDSHIFT
+const BackendType = types.BackendRedshift
 
 const RedshiftBatchSize = 20
 
diff --git a/internal/database/offline/snowflake/store.go b/internal/database/offline/snowflake/store.go
index d733f9f4..b7a1ba22 100644
--- a/internal/database/offline/snowflake/store.go
+++ b/internal/database/offline/snowflake/store.go
@@ -44,15 +44,15 @@ func Open(opt *types.SnowflakeOpt) (*DB, error) {
 }
 
 func (db *DB) Import(ctx context.Context, opt offline.ImportOpt) (int64, error) {
-	return sqlutil.Import(ctx, db.DB, opt, dbutil.LoadDataFromSource(types.SNOWFLAKE, SnowflakeBatchSize), types.SNOWFLAKE)
+	return sqlutil.Import(ctx, db.DB, opt, dbutil.LoadDataFromSource(types.BackendSnowflake, SnowflakeBatchSize), types.BackendSnowflake)
 }
 
 func (db *DB) Export(ctx context.Context, opt offline.ExportOpt) (<-chan types.ExportRecord, <-chan error) {
-	return sqlutil.Export(ctx, db.DB, opt, types.SNOWFLAKE)
+	return sqlutil.Export(ctx, db.DB, opt, types.BackendSnowflake)
 }
 
 func (db *DB) Join(ctx context.Context, opt offline.JoinOpt) (*types.JoinResult, error) {
-	return sqlutil.Join(ctx, db.DB, opt, types.SNOWFLAKE)
+	return sqlutil.Join(ctx, db.DB, opt, types.BackendSnowflake)
 }
 
 func (db *DB) TableSchema(ctx context.Context, tableName string) (*types.DataTableSchema, error) {
diff --git a/internal/database/offline/sqlite/store.go b/internal/database/offline/sqlite/store.go
index fd29fbfa..d333c4f6 100644
--- a/internal/database/offline/sqlite/store.go
+++ b/internal/database/offline/sqlite/store.go
@@ -30,15 +30,15 @@ func Open(option *types.SQLiteOpt) (*DB, error) {
 }
 
 func (db *DB) Import(ctx context.Context, opt offline.ImportOpt) (int64, error) {
-	return sqlutil.Import(ctx, db.DB, opt, dbutil.LoadDataFromSource(types.SQLite, SQLiteBatchSize), types.SQLite)
+	return sqlutil.Import(ctx, db.DB, opt, dbutil.LoadDataFromSource(types.BackendSQLite, SQLiteBatchSize), types.BackendSQLite)
 }
 
 func (db *DB) Export(ctx context.Context, opt offline.ExportOpt) (<-chan types.ExportRecord, <-chan error) {
-	return sqlutil.Export(ctx, db.DB, opt, types.SQLite)
+	return sqlutil.Export(ctx, db.DB, opt, types.BackendSQLite)
 }
 
 func (db *DB) Join(ctx context.Context, opt offline.JoinOpt) (*types.JoinResult, error) {
-	return sqlutil.Join(ctx, db.DB, opt, types.SQLite)
+	return sqlutil.Join(ctx, db.DB, opt, types.BackendSQLite)
 }
 
 func (db *DB) TableSchema(ctx context.Context, tableName string) (*types.DataTableSchema, error) {
diff --git a/internal/database/offline/sqlutil/export.go b/internal/database/offline/sqlutil/export.go
index bc029b2d..34ad3cf1 100644
--- a/internal/database/offline/sqlutil/export.go
+++ b/internal/database/offline/sqlutil/export.go
@@ -55,7 +55,7 @@ func Export(ctx context.Context, db *sqlx.DB, opt offline.ExportOpt, backendType
 				if record[i+1] == nil {
 					continue
 				}
-				if backendType == types.SNOWFLAKE {
+				if backendType == types.BackendSnowflake {
 
 					v, err := deserializeByTag(record[i+1], f.ValueType)
 					if err != nil {
@@ -64,7 +64,7 @@ func Export(ctx context.Context, db *sqlx.DB, opt offline.ExportOpt, backendType
 					}
 					record[i+1] = v
 				} else {
-					if f.ValueType == types.STRING {
+					if f.ValueType == types.String {
 						record[i+1] = cast.ToString(record[i+1])
 					}
 				}
@@ -92,18 +92,18 @@ func deserializeByTag(i interface{}, valueType types.ValueType) (interface{}, er
 	}
 
 	switch valueType {
-	case types.STRING:
+	case types.String:
 		return s, nil
 
-	case types.INT64:
+	case types.Int64:
 		x, err := strconv.ParseInt(s, 10, 64)
 		return x, err
 
-	case types.FLOAT64:
+	case types.Float64:
 		x, err := strconv.ParseFloat(s, 64)
 		return x, err
 
-	case types.BOOL:
+	case types.Bool:
 		if s == "1" {
 			return true, nil
 		} else if s == "0" {
@@ -111,11 +111,11 @@ func deserializeByTag(i interface{}, valueType types.ValueType) (interface{}, er
 		} else {
 			return nil, fmt.Errorf("invalid bool value: %s", s)
 		}
-	case types.TIME:
+	case types.Time:
 		x, err := strconv.ParseInt(s, 10, 64)
 		return time.UnixMilli(x), err
 
-	case types.BYTES:
+	case types.Bytes:
 		return []byte(s), nil
 	default:
 		return "", fmt.Errorf("unsupported value type: %s", valueType)
diff --git a/internal/database/offline/sqlutil/join_helper.go b/internal/database/offline/sqlutil/join_helper.go
index 0b6ebec8..9235cb6d 100644
--- a/internal/database/offline/sqlutil/join_helper.go
+++ b/internal/database/offline/sqlutil/join_helper.go
@@ -18,7 +18,7 @@ const (
 )
 
 func supportIndex(backendType types.BackendType) bool {
-	for _, b := range []types.BackendType{types.SNOWFLAKE, types.REDSHIFT, types.BIGQUERY} {
+	for _, b := range []types.BackendType{types.BackendSnowflake, types.BackendRedshift, types.BackendBigQuery} {
 		if b == backendType {
 			return false
 		}
@@ -99,7 +99,7 @@ func PrepareEntityRowsTable(ctx context.Context,
 	// TODO: infer db_type from value_type
 	var entityType, valueType, qtTableName string
 	switch dbOpt.Backend {
-	case types.BIGQUERY:
+	case types.BackendBigQuery:
 		entityType = "STRING"
 		valueType = "STRING"
 		qtTableName = fmt.Sprintf("%s.%s", *dbOpt.DatasetID, qt(tableName))
@@ -153,7 +153,7 @@ func insertEntityRows(ctx context.Context,
 	columns = append(columns, valueNames...)
 
 	format := `%s`
-	if dbOpt.Backend == types.BIGQUERY {
+	if dbOpt.Backend == types.BackendBigQuery {
 		format = `"%s"`
 	}
 	for entityRow := range entityRows {
diff --git a/internal/database/online/cassandra/import.go b/internal/database/online/cassandra/import.go
index 7d5070e0..cc62b648 100644
--- a/internal/database/online/cassandra/import.go
+++ b/internal/database/online/cassandra/import.go
@@ -17,7 +17,7 @@ func (db *DB) Import(ctx context.Context, opt online.ImportOpt) error {
 	columns := append([]string{opt.Entity.Name}, opt.FeatureList.Names()...)
 	tableName := sqlutil.OnlineTableName(opt.Revision.ID)
 
-	table, err := dbutil.BuildCreateSchema(tableName, opt.Entity, opt.FeatureList, types.CASSANDRA)
+	table, err := dbutil.BuildCreateSchema(tableName, opt.Entity, opt.FeatureList, types.BackendCassandra)
 	if err != nil {
 		return err
 	}
diff --git a/internal/database/online/cassandra/store.go b/internal/database/online/cassandra/store.go
index dd7f63b9..8b1e5e98 100644
--- a/internal/database/online/cassandra/store.go
+++ b/internal/database/online/cassandra/store.go
@@ -11,7 +11,7 @@ import (
 
 const (
 	BatchSize   = 1000
-	BackendType = types.CASSANDRA
+	BackendType = types.BackendCassandra
 )
 
 type DB struct {
diff --git a/internal/database/online/dynamodb/store.go b/internal/database/online/dynamodb/store.go
index a9087247..1f07f4ee 100644
--- a/internal/database/online/dynamodb/store.go
+++ b/internal/database/online/dynamodb/store.go
@@ -11,7 +11,7 @@ import (
 	"github.com/oom-ai/oomstore/pkg/oomstore/types"
 )
 
-const BackendType = types.DYNAMODB
+const BackendType = types.BackendDynamoDB
 
 var _ online.Store = &DB{}
 
diff --git a/internal/database/online/dynamodb/util.go b/internal/database/online/dynamodb/util.go
index 1f41fbcf..10e6e873 100644
--- a/internal/database/online/dynamodb/util.go
+++ b/internal/database/online/dynamodb/util.go
@@ -15,7 +15,7 @@ func serializeByTag(i interface{}, valueType types.ValueType) (out interface{},
 	}()
 
 	switch valueType {
-	case types.TIME:
+	case types.Time:
 		return i.(time.Time).UnixMilli(), nil
 	default:
 		return i, nil
@@ -28,13 +28,13 @@ func deserializeByTag(i interface{}, valueType types.ValueType) (interface{}, er
 	}
 
 	switch valueType {
-	case types.INT64:
+	case types.Int64:
 		v, ok := i.(float64)
 		if !ok {
 			return "", fmt.Errorf("not float64 %v", i)
 		}
 		return int64(v), nil
-	case types.TIME:
+	case types.Time:
 		v, ok := i.(float64)
 		if !ok {
 			return "", fmt.Errorf("not float64 %v", i)
diff --git a/internal/database/online/mysql/store.go b/internal/database/online/mysql/store.go
index 79ce60f5..c3f44bdc 100644
--- a/internal/database/online/mysql/store.go
+++ b/internal/database/online/mysql/store.go
@@ -11,7 +11,7 @@ import (
 	"github.com/oom-ai/oomstore/pkg/oomstore/types"
 )
 
-const BackendType = types.MYSQL
+const BackendType = types.BackendMySQL
 
 var _ online.Store = &DB{}
 
diff --git a/internal/database/online/postgres/store.go b/internal/database/online/postgres/store.go
index f593207e..13b03c85 100644
--- a/internal/database/online/postgres/store.go
+++ b/internal/database/online/postgres/store.go
@@ -12,7 +12,7 @@ import (
 	"github.com/oom-ai/oomstore/pkg/oomstore/types"
 )
 
-const BackendType = types.POSTGRES
+const BackendType = types.BackendPostgres
 
 var _ online.Store = &DB{}
 
diff --git a/internal/database/online/redis/util.go b/internal/database/online/redis/util.go
index 5483b3d3..369b85eb 100644
--- a/internal/database/online/redis/util.go
+++ b/internal/database/online/redis/util.go
@@ -16,22 +16,22 @@ func SerializeByTag(i interface{}, valueType types.ValueType) (s string, err err
 	}()
 
 	switch valueType {
-	case types.STRING:
+	case types.String:
 		return i.(string), nil
-	case types.INT64:
+	case types.Int64:
 		return strconv.FormatInt(int64(i.(int64)), SerializeIntBase), nil
-	case types.FLOAT64:
+	case types.Float64:
 		return strconv.FormatFloat(i.(float64), 'f', -1, 64), nil
-	case types.BOOL:
+	case types.Bool:
 		if i.(bool) {
 			return "1", nil
 		} else {
 			return "0", nil
 		}
-	case types.TIME:
+	case types.Time:
 		return strconv.FormatInt(i.(time.Time).UnixMilli(), SerializeIntBase), nil
 
-	case types.BYTES:
+	case types.Bytes:
 		return string(i.([]byte)), nil
 	default:
 		return "", fmt.Errorf("unable to serialize %#v of type %T to string", i, i)
@@ -97,18 +97,18 @@ func DeserializeByTag(i interface{}, valueType types.ValueType) (interface{}, er
 	}
 
 	switch valueType {
-	case types.STRING:
+	case types.String:
 		return s, nil
 
-	case types.INT64:
+	case types.Int64:
 		x, err := strconv.ParseInt(s, SerializeIntBase, 64)
 		return x, err
 
-	case types.FLOAT64:
+	case types.Float64:
 		x, err := strconv.ParseFloat(s, 64)
 		return x, err
 
-	case types.BOOL:
+	case types.Bool:
 		if s == "1" {
 			return true, nil
 		} else if s == "0" {
@@ -116,11 +116,11 @@ func DeserializeByTag(i interface{}, valueType types.ValueType) (interface{}, er
 		} else {
 			return nil, fmt.Errorf("invalid bool value: %s", s)
 		}
-	case types.TIME:
+	case types.Time:
 		x, err := strconv.ParseInt(s, SerializeIntBase, 64)
 		return time.UnixMilli(x), err
 
-	case types.BYTES:
+	case types.Bytes:
 		return []byte(s), nil
 	default:
 		return "", fmt.Errorf("unsupported value type: %s", valueType)
diff --git a/internal/database/online/sqlite/store.go b/internal/database/online/sqlite/store.go
index d86e187c..cc542bc3 100644
--- a/internal/database/online/sqlite/store.go
+++ b/internal/database/online/sqlite/store.go
@@ -11,7 +11,7 @@ import (
 	"github.com/oom-ai/oomstore/pkg/oomstore/types"
 )
 
-const BackendType = types.SQLite
+const BackendType = types.BackendSQLite
 
 var _ online.Store = &DB{}
 
diff --git a/internal/database/online/sqlutil/util.go b/internal/database/online/sqlutil/util.go
index 255f3a4a..91c44919 100644
--- a/internal/database/online/sqlutil/util.go
+++ b/internal/database/online/sqlutil/util.go
@@ -18,13 +18,13 @@ func deserializeByTag(i interface{}, valueType types.ValueType, backend types.Ba
 	}
 
 	switch valueType {
-	case types.STRING:
-		if backend == types.MYSQL {
+	case types.String:
+		if backend == types.BackendMySQL {
 			return string(i.([]byte)), nil
 		}
 		return i, nil
-	case types.BOOL:
-		if backend == types.MYSQL || backend == types.SQLite {
+	case types.Bool:
+		if backend == types.BackendMySQL || backend == types.BackendSQLite {
 			if i == int64(1) {
 				return true, nil
 			} else if i == int64(0) {
diff --git a/pkg/oomstore/types/config.go b/pkg/oomstore/types/config.go
index 087cc60e..d054856c 100644
--- a/pkg/oomstore/types/config.go
+++ b/pkg/oomstore/types/config.go
@@ -8,15 +8,15 @@ import (
 type BackendType string
 
 const (
-	POSTGRES  BackendType = "postgres"
-	REDIS     BackendType = "redis"
-	MYSQL     BackendType = "mysql"
-	SQLite    BackendType = "sqlite"
-	SNOWFLAKE BackendType = "snowflake"
-	DYNAMODB  BackendType = "dynamodb"
-	CASSANDRA BackendType = "cassandra"
-	BIGQUERY  BackendType = "bigquery"
-	REDSHIFT  BackendType = "redshift"
+	BackendPostgres  BackendType = "postgres"
+	BackendRedis     BackendType = "redis"
+	BackendMySQL     BackendType = "mysql"
+	BackendSQLite    BackendType = "sqlite"
+	BackendSnowflake BackendType = "snowflake"
+	BackendDynamoDB  BackendType = "dynamodb"
+	BackendCassandra BackendType = "cassandra"
+	BackendBigQuery  BackendType = "bigquery"
+	BackendRedshift  BackendType = "redshift"
 )
 
 type OomStoreConfig struct {
@@ -125,11 +125,11 @@ func (cfg *OomStoreConfig) Validate() error {
 func (cfg *MetadataStoreConfig) Validate() error {
 	n := 0
 	if cfg.Postgres != nil {
-		cfg.Backend = POSTGRES
+		cfg.Backend = BackendPostgres
 		n++
 	}
 	if cfg.MySQL != nil {
-		cfg.Backend = MYSQL
+		cfg.Backend = BackendMySQL
 		n++
 	}
 	if n != 1 {
@@ -141,19 +141,19 @@ func (cfg *MetadataStoreConfig) Validate() error {
 func (cfg *OnlineStoreConfig) Validate() error {
 	n := 0
 	if cfg.Postgres != nil {
-		cfg.Backend = POSTGRES
+		cfg.Backend = BackendPostgres
 		n++
 	}
 	if cfg.MySQL != nil {
-		cfg.Backend = MYSQL
+		cfg.Backend = BackendMySQL
 		n++
 	}
 	if cfg.Redis != nil {
-		cfg.Backend = REDIS
+		cfg.Backend = BackendRedis
 		n++
 	}
 	if cfg.DynamoDB != nil {
-		cfg.Backend = DYNAMODB
+		cfg.Backend = BackendDynamoDB
 		n++
 	}
 	if n != 1 {
@@ -165,15 +165,15 @@ func (cfg *OnlineStoreConfig) Validate() error {
 func (cfg *OfflineStoreConfig) Validate() error {
 	n := 0
 	if cfg.Postgres != nil {
-		cfg.Backend = POSTGRES
+		cfg.Backend = BackendPostgres
 		n++
 	}
 	if cfg.MySQL != nil {
-		cfg.Backend = MYSQL
+		cfg.Backend = BackendMySQL
 		n++
 	}
 	if cfg.Snowflake != nil {
-		cfg.Backend = SNOWFLAKE
+		cfg.Backend = BackendSnowflake
 		n++
 	}
 	if n != 1 {
diff --git a/pkg/oomstore/types/value_type.go b/pkg/oomstore/types/value_type.go
index 8e5f0acd..058daffc 100644
--- a/pkg/oomstore/types/value_type.go
+++ b/pkg/oomstore/types/value_type.go
@@ -10,22 +10,22 @@ import (
 type ValueType int
 
 const (
-	INVALID ValueType = iota
-	STRING
-	INT64
-	FLOAT64
-	BOOL
-	TIME
-	BYTES
+	Invalid ValueType = iota
+	String
+	Int64
+	Float64
+	Bool
+	Time
+	Bytes
 )
 
 var allValueTypes = map[ValueType]string{
-	STRING:  "string",
-	INT64:   "int64",
-	FLOAT64: "float64",
-	BOOL:    "bool",
-	TIME:    "time",
-	BYTES:   "bytes",
+	String:  "string",
+	Int64:   "int64",
+	Float64: "float64",
+	Bool:    "bool",
+	Time:    "time",
+	Bytes:   "bytes",
 }
 
 func (t ValueType) String() string {
@@ -47,17 +47,17 @@ func (v ValueType) Validate() error {
 func ParseValueType(s string) (ValueType, error) {
 	switch s {
 	case "string":
-		return BYTES, nil
+		return Bytes, nil
 	case "int64":
-		return INT64, nil
+		return Int64, nil
 	case "float64":
-		return FLOAT64, nil
+		return Float64, nil
 	case "bool":
-		return BOOL, nil
+		return Bool, nil
 	case "time":
-		return TIME, nil
+		return Time, nil
 	case "bytes":
-		return BYTES, nil
+		return Bytes, nil
 	}
-	return INVALID, errdefs.InvalidAttribute(fmt.Errorf("Unknown value type: %s", s))
+	return Invalid, errdefs.InvalidAttribute(fmt.Errorf("Unknown value type: %s", s))
 }


Test patch:
diff --git a/internal/database/dbutil/schema_test.go b/internal/database/dbutil/schema_test.go
index 13967fa7..db437a19 100644
--- a/internal/database/dbutil/schema_test.go
+++ b/internal/database/dbutil/schema_test.go
@@ -12,11 +12,11 @@ func TestBuildSchema(t *testing.T) {
 	features := types.FeatureList{
 		&types.Feature{
 			Name:      "age",
-			ValueType: types.INT64,
+			ValueType: types.Int64,
 		},
 		&types.Feature{
 			Name:      "gender",
-			ValueType: types.STRING,
+			ValueType: types.String,
 		},
 	}
 	cases := []struct {
@@ -32,7 +32,7 @@ func TestBuildSchema(t *testing.T) {
 	}{
 		{
 			description: "postgres schema",
-			backend:     types.POSTGRES,
+			backend:     types.BackendPostgres,
 			tableName:   "user",
 			entity: &types.Entity{
 				Name:   "user_id",
@@ -50,7 +50,7 @@ CREATE TABLE user (
 		},
 		{
 			description: "mysql schema",
-			backend:     types.MYSQL,
+			backend:     types.BackendMySQL,
 			tableName:   "user",
 			entity: &types.Entity{
 				Name:   "user_id",
@@ -67,7 +67,7 @@ CREATE TABLE user (
 		},
 		{
 			description: "cassandra schema",
-			backend:     types.CASSANDRA,
+			backend:     types.BackendCassandra,
 			tableName:   "user",
 			entity: &types.Entity{
 				Name: "user_id",
diff --git a/internal/database/metadata/test_impl/feature.go b/internal/database/metadata/test_impl/feature.go
index 0b6743aa..77eceb7e 100644
--- a/internal/database/metadata/test_impl/feature.go
+++ b/internal/database/metadata/test_impl/feature.go
@@ -45,7 +45,7 @@ func TestCreateFeature(t *testing.T, prepareStore PrepareStoreFn, destroyStore D
 		FeatureName: "phone",
 		GroupID:     groupID,
 		Description: "description",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 	}
 
 	_, err := store.CreateFeature(ctx, opt)
@@ -62,7 +62,7 @@ func TestCreateFeatureWithSameName(t *testing.T, prepareStore PrepareStoreFn, de
 	opt := metadata.CreateFeatureOpt{
 		FeatureName: "phone",
 		GroupID:     groupID,
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 	}
 
 	_, err := store.CreateFeature(ctx, opt)
@@ -82,7 +82,7 @@ func TestCreateFeatureWithSQLKeyword(t *testing.T, prepareStore PrepareStoreFn,
 	opt := metadata.CreateFeatureOpt{
 		FeatureName: "user",
 		GroupID:     groupID,
-		ValueType:   types.INT64,
+		ValueType:   types.Int64,
 		Description: "order",
 	}
 
@@ -115,7 +115,7 @@ func TestGetFeature(t *testing.T, prepareStore PrepareStoreFn, destroyStore Dest
 		FeatureName: "phone",
 		GroupID:     groupID,
 		Description: "description",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 	})
 	require.NoError(t, err)
 
@@ -129,7 +129,7 @@ func TestGetFeature(t *testing.T, prepareStore PrepareStoreFn, destroyStore Dest
 	expected := &types.Feature{
 		ID:          1,
 		Name:        "phone",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 		Description: "description",
 		GroupID:     1,
 	}
@@ -148,7 +148,7 @@ func TestGetFeatureByName(t *testing.T, prepareStore PrepareStoreFn, destroyStor
 		FeatureName: "phone",
 		GroupID:     groupID,
 		Description: "description",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 	})
 	require.NoError(t, err)
 
@@ -162,7 +162,7 @@ func TestGetFeatureByName(t *testing.T, prepareStore PrepareStoreFn, destroyStor
 	expected := &types.Feature{
 		ID:          1,
 		Name:        "phone",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 		Description: "description",
 		GroupID:     1,
 	}
@@ -185,7 +185,7 @@ func TestCacheListFeature(t *testing.T, prepareStore PrepareStoreFn, destroyStor
 		FeatureName: "phone",
 		GroupID:     groupID,
 		Description: "description",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 	})
 	require.NoError(t, err)
 	require.NoError(t, store.Refresh())
@@ -244,7 +244,7 @@ func TestListFeature(t *testing.T, prepareStore PrepareStoreFn, destroyStore Des
 		FeatureName: "phone",
 		GroupID:     groupID,
 		Description: "description",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 	})
 	require.NoError(t, err)
 
@@ -303,7 +303,7 @@ func TestUpdateFeature(t *testing.T, prepareStore PrepareStoreFn, destroyStore D
 		FeatureName: "phone",
 		GroupID:     groupID,
 		Description: "description",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 	}
 	id, err := store.CreateFeature(ctx, opt)
 	require.NoError(t, err)
@@ -326,7 +326,7 @@ func TestUpdateFeature(t *testing.T, prepareStore PrepareStoreFn, destroyStore D
 	expected := &types.Feature{
 		ID:          1,
 		Name:        "phone",
-		ValueType:   types.STRING,
+		ValueType:   types.String,
 		Description: "new description",
 		GroupID:     1,
 	}
diff --git a/internal/database/offline/sqlutil/type_tag_test.go b/internal/database/offline/sqlutil/type_tag_test.go
index 84c17905..614e826c 100644
--- a/internal/database/offline/sqlutil/type_tag_test.go
+++ b/internal/database/offline/sqlutil/type_tag_test.go
@@ -8,12 +8,12 @@ import (
 )
 
 var typeMap = map[string]types.ValueType{
-	"boolean":  types.BOOL,
-	"binary":   types.BYTES,
-	"bigint":   types.INT64,
-	"double":   types.FLOAT64,
-	"varchar":  types.STRING,
-	"datetime": types.TIME,
+	"boolean":  types.Bool,
+	"binary":   types.Bytes,
+	"bigint":   types.Int64,
+	"double":   types.Float64,
+	"varchar":  types.String,
+	"datetime": types.Time,
 }
 
 func TestValueType(t *testing.T) {
@@ -21,13 +21,13 @@ func TestValueType(t *testing.T) {
 		input    string
 		expected types.ValueType
 	}{
-		{"boolean", types.BOOL},
-		{"binary", types.BYTES},
-		{"bigint", types.INT64},
-		{"double", types.FLOAT64},
-		{"varchar(32)", types.STRING},
-		{"VARCHAR(64)", types.STRING},
-		{"datetime", types.TIME},
+		{"boolean", types.Bool},
+		{"binary", types.Bytes},
+		{"bigint", types.Int64},
+		{"double", types.Float64},
+		{"varchar(32)", types.String},
+		{"VARCHAR(64)", types.String},
+		{"datetime", types.Time},
 	} {
 		actual, err := sqlutil.GetValueType(typeMap, tt.input)
 		if err != nil {
diff --git a/internal/database/offline/test_impl/export.go b/internal/database/offline/test_impl/export.go
index c05c517f..99440821 100644
--- a/internal/database/offline/test_impl/export.go
+++ b/internal/database/offline/test_impl/export.go
@@ -18,11 +18,11 @@ func TestExport(t *testing.T, prepareStore PrepareStoreFn) {
 	features := []*types.Feature{
 		{
 			Name:      "model",
-			ValueType: types.STRING,
+			ValueType: types.String,
 		},
 		{
 			Name:      "price",
-			ValueType: types.INT64,
+			ValueType: types.Int64,
 		},
 	}
 	buildTestDataTable(ctx, t, store, features, dataTable, &offline.CSVSource{
diff --git a/internal/database/offline/test_impl/import.go b/internal/database/offline/test_impl/import.go
index 5e00a324..79ee6863 100644
--- a/internal/database/offline/test_impl/import.go
+++ b/internal/database/offline/test_impl/import.go
@@ -29,7 +29,7 @@ func TestImport(t *testing.T, prepareStore PrepareStoreFn) {
 		Features: []*types.Feature{
 			{
 				Name:      "price",
-				ValueType: types.INT64,
+				ValueType: types.Int64,
 			},
 			{
 				Name:      "model",
@@ -57,11 +57,11 @@ func TestImport(t *testing.T, prepareStore PrepareStoreFn) {
 		opt.Features = []*types.Feature{
 			{
 				Name:      "price",
-				ValueType: types.INT64,
+				ValueType: types.Int64,
 			},
 			{
 				Name:      "model",
-				ValueType: types.STRING,
+				ValueType: types.String,
 			},
 		}
 		opt.Revision = &revision
@@ -72,8 +72,8 @@ func TestImport(t *testing.T, prepareStore PrepareStoreFn) {
 			DataTable:  dataTable,
 			EntityName: entity.Name,
 			Features: []*types.Feature{
-				{Name: "model", ValueType: types.STRING},
-				{Name: "price", ValueType: types.INT64},
+				{Name: "model", ValueType: types.String},
+				{Name: "price", ValueType: types.Int64},
 			},
 		})
 		records := make([][]interface{}, 0)
diff --git a/internal/database/offline/test_impl/join.go b/internal/database/offline/test_impl/join.go
index fa61d3d2..c2979f90 100644
--- a/internal/database/offline/test_impl/join.go
+++ b/internal/database/offline/test_impl/join.go
@@ -118,17 +118,17 @@ func TestJoin(t *testing.T, prepareStore PrepareStoreFn) {
 func prepareFeatures(oneGroup bool) (types.FeatureList, map[string]types.FeatureList) {
 	price := &types.Feature{
 		Name:      "price",
-		ValueType: types.INT64,
+		ValueType: types.Int64,
 		GroupID:   1,
 	}
 	model := &types.Feature{
 		Name:      "model",
-		ValueType: types.STRING,
+		ValueType: types.String,
 		GroupID:   1,
 	}
 	isActive := &types.Feature{
 		Name:      "is_active",
-		ValueType: types.BOOL,
+		ValueType: types.Bool,
 		GroupID:   2,
 	}
 
diff --git a/internal/database/offline/test_impl/table_schema.go b/internal/database/offline/test_impl/table_schema.go
index 2a0b7fb8..15c2176a 100644
--- a/internal/database/offline/test_impl/table_schema.go
+++ b/internal/database/offline/test_impl/table_schema.go
@@ -22,11 +22,11 @@ func TestTableSchema(t *testing.T, prepareStore PrepareStoreFn, prepareSampleTab
 		Fields: []types.DataTableFieldSchema{
 			{
 				Name:      "user",
-				ValueType: types.STRING,
+				ValueType: types.String,
 			},
 			{
 				Name:      "age",
-				ValueType: types.INT64,
+				ValueType: types.Int64,
 			},
 		},
 	}
diff --git a/internal/database/online/test_impl/util.go b/internal/database/online/test_impl/util.go
index 4fec8ef7..65222eb1 100644
--- a/internal/database/online/test_impl/util.go
+++ b/internal/database/online/test_impl/util.go
@@ -36,31 +36,31 @@ func init() {
 					ID:        1,
 					Name:      "age",
 					GroupID:   1,
-					ValueType: types.INT64,
+					ValueType: types.Int64,
 				},
 				&types.Feature{
 					ID:        2,
 					Name:      "gender",
 					GroupID:   1,
-					ValueType: types.STRING,
+					ValueType: types.String,
 				},
 				&types.Feature{
 					ID:        3,
 					Name:      "account",
 					GroupID:   1,
-					ValueType: types.FLOAT64,
+					ValueType: types.Float64,
 				},
 				&types.Feature{
 					ID:        4,
 					Name:      "is_active",
 					GroupID:   1,
-					ValueType: types.BOOL,
+					ValueType: types.Bool,
 				},
 				&types.Feature{
 					ID:        5,
 					Name:      "register_time",
 					GroupID:   1,
-					ValueType: types.TIME,
+					ValueType: types.Time,
 				},
 			},
 			Revision: &types.Revision{ID: 3, GroupID: 1},
@@ -80,7 +80,7 @@ func init() {
 				ID:        2,
 				Name:      "charge",
 				GroupID:   2,
-				ValueType: types.FLOAT64,
+				ValueType: types.Float64,
 			},
 		}
 
@@ -117,7 +117,7 @@ func importSample(t *testing.T, ctx context.Context, store online.Store, samples
 }
 
 func compareFeatureValue(t *testing.T, expected, actual interface{}, valueType types.ValueType) {
-	if valueType == types.TIME {
+	if valueType == types.Time {
 		expected, ok := expected.(time.Time)
 		require.Equal(t, true, ok)
 
diff --git a/pkg/oomstore/export_test.go b/pkg/oomstore/export_test.go
index bedcfefd..f43288c8 100644
--- a/pkg/oomstore/export_test.go
+++ b/pkg/oomstore/export_test.go
@@ -28,11 +28,11 @@ func TestChannelExport(t *testing.T) {
 	features := types.FeatureList{
 		{
 			Name:      "model",
-			ValueType: types.STRING,
+			ValueType: types.String,
 		},
 		{
 			Name:      "price",
-			ValueType: types.INT64,
+			ValueType: types.Int64,
 		},
 	}
 
diff --git a/pkg/oomstore/feature_test.go b/pkg/oomstore/feature_test.go
index d22a34ee..ee647836 100644
--- a/pkg/oomstore/feature_test.go
+++ b/pkg/oomstore/feature_test.go
@@ -36,9 +36,9 @@ func TestCreateBatchFeature(t *testing.T) {
 			opt: types.CreateFeatureOpt{
 				FeatureName: "model",
 				GroupName:   "device_info",
-				ValueType:   types.STRING,
+				ValueType:   types.String,
 			},
-			valueType: types.STRING,
+			valueType: types.String,
 			group: types.Group{
 				ID:       1,
 				Name:     "device_info",
@@ -51,9 +51,9 @@ func TestCreateBatchFeature(t *testing.T) {
 			opt: types.CreateFeatureOpt{
 				FeatureName: "model",
 				GroupName:   "device_info",
-				ValueType:   types.INT64,
+				ValueType:   types.Int64,
 			},
-			valueType: types.INT64,
+			valueType: types.Int64,
 			group: types.Group{
 				ID:       1,
 				Name:     "device_info",
diff --git a/pkg/oomstore/online_query_test.go b/pkg/oomstore/online_query_test.go
index 49b8eda0..3b6a0be9 100644
--- a/pkg/oomstore/online_query_test.go
+++ b/pkg/oomstore/online_query_test.go
@@ -217,7 +217,7 @@ func prepareFeatures(isConsistent bool, isAvailable bool) types.FeatureList {
 	features := types.FeatureList{
 		{
 			Name:      "model",
-			ValueType: types.STRING,
+			ValueType: types.String,
 			GroupID:   1,
 			Group: &types.Group{
 				EntityID:         1,
@@ -228,7 +228,7 @@ func prepareFeatures(isConsistent bool, isAvailable bool) types.FeatureList {
 		},
 		{
 			Name:      "price",
-			ValueType: types.INT64,
+			ValueType: types.Int64,
 			GroupID:   2,
 			Group: &types.Group{
 				EntityID:         1,
@@ -239,7 +239,7 @@ func prepareFeatures(isConsistent bool, isAvailable bool) types.FeatureList {
 		},
 		{
 			Name:      "age",
-			ValueType: types.INT64,
+			ValueType: types.Int64,
 			GroupID:   3,
 			Group: &types.Group{
 				EntityID:         2,