feat: Add ent-based sqlite3 storage

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
m.nabokikh
2020-12-31 02:07:32 +04:00
parent 674631c9ab
commit 11859166d0
31 changed files with 1878 additions and 4 deletions

View File

@@ -0,0 +1,46 @@
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
/* Original SQL table:
create table connector
(
id text not null primary key,
type text not null,
name text not null,
resource_version text not null,
config blob
);
*/
// Connector holds the schema definition for the Client entity.
type Connector struct {
ent.Schema
}
// Fields of the Connector.
func (Connector) Fields() []ent.Field {
return []ent.Field{
field.Text("id").
SchemaType(textSchema).
NotEmpty().
Unique(),
field.Text("type").
SchemaType(textSchema).
NotEmpty(),
field.Text("name").
SchemaType(textSchema).
NotEmpty(),
field.Text("resource_version").
SchemaType(textSchema),
field.Bytes("config"),
}
}
// Edges of the Connector.
func (Connector) Edges() []ent.Edge {
return []ent.Edge{}
}