resource

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2018 License: GPL-3.0 Imports: 67 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Added changeType = iota
	Removed
	ChangedType
	ChangedValue
)
View Source
const DATE_LAYOUT = "2006-01-02 15:04:05"

Variables

View Source
var CollectionTypes = []string{
	"Pair",
	"Triplet",
	"Set",
	"OrderedSet",
}
View Source
var ColumnTypes = []ColumnType{
	{
		Name:          "id",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{},
		DataTypes:     []string{"varchar(20)", "varchar(10)"},
		GraphqlType:   graphql.ID,
	},
	{
		Name:          "alias",
		BlueprintType: "string",
		ReclineType:   "string",
		DataTypes:     []string{"varchar(100)", "varchar(20)", "varchar(10)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "date",
		BlueprintType: "date-only",
		ReclineType:   "date",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.DateTime,
	},
	{
		Name:          "time",
		BlueprintType: "time-only",
		ReclineType:   "time",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "day",
		BlueprintType: "string",
		ReclineType:   "string",
		DataTypes:     []string{"varchar(10)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "month",
		BlueprintType: "number",
		ReclineType:   "string",
		Validations:   []string{"min=1,max=12"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "year",
		BlueprintType: "number",
		ReclineType:   "string",
		Validations:   []string{"min=1900,max=2100"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "minute",
		BlueprintType: "number",
		Validations:   []string{"min=0,max=59"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "hour",
		BlueprintType: "number",
		ReclineType:   "string",
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "datetime",
		BlueprintType: "datetime",
		ReclineType:   "date-time",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.DateTime,
	},
	{
		Name:          "email",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"email"},
		Conformations: []string{"email"},
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "namespace",
		BlueprintType: "string",
		ReclineType:   "string",
		DataTypes:     []string{"varchar(200)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "name",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"required"},
		Conformations: []string{"name"},
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "encrypted",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"varchar(100)", "varchar(500)", "varchar(500)", "text"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "json",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"text", "varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "password",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"required"},
		DataTypes:     []string{"varchar(200)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "value",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "truefalse",
		BlueprintType: "boolean",
		ReclineType:   "boolean",
		DataTypes:     []string{"boolean"},
		GraphqlType:   graphql.Boolean,
	},
	{
		Name:          "timestamp",
		BlueprintType: "datetime",
		ReclineType:   "date-time",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.DateTime,
	},
	{
		Name:          "location",
		BlueprintType: "string",
		ReclineType:   "geo_point",
		DataTypes:     []string{"varchar(50)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "location.latitude",
		BlueprintType: "number",
		ReclineType:   "number",
		Validations:   []string{"latitude"},
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "location.longitude",
		BlueprintType: "number",
		ReclineType:   "number",
		Validations:   []string{"longitude"},
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "location.altitude",
		BlueprintType: "number",
		ReclineType:   "number",
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "color",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"iscolor"},
		DataTypes:     []string{"varchar(50)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "rating.10",
		BlueprintType: "number",
		ReclineType:   "string",
		Validations:   []string{"min=0,max=10"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "measurement",
		ReclineType:   "number",
		BlueprintType: "number",
		DataTypes:     []string{"int(10)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "float",
		ReclineType:   "number",
		BlueprintType: "number",
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "label",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "content",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"text"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "html",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"text"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "file",
		BlueprintType: "file",
		ReclineType:   "binary",
		Validations:   []string{"base64"},
		DataTypes:     []string{"blob"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "image",
		BlueprintType: "file",
		ReclineType:   "binary",
		Validations:   []string{"base64"},
		DataTypes:     []string{"blob"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "url",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"url"},
		DataTypes:     []string{"varchar(500)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "image",
		BlueprintType: "file",
		ReclineType:   "binary",
		Validations:   []string{"base64"},
		DataTypes:     []string{"text"},
		GraphqlType:   graphql.String,
	},
}
View Source
var ConfigTableStructure = TableInfo{
	TableName: settingsTableName,
	Columns: []api2go.ColumnInfo{
		{
			Name:            "id",
			ColumnName:      "id",
			ColumnType:      "id",
			DataType:        "INTEGER",
			IsPrimaryKey:    true,
			IsAutoIncrement: true,
		},
		{
			Name:       "name",
			ColumnName: "name",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "ConfigType",
			ColumnName: "configtype",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "ConfigState",
			ColumnName: "configstate",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "ConfigEnv",
			ColumnName: "configenv",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "Value",
			ColumnName: "value",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: true,
			IsIndexed:  true,
		},
		{
			Name:       "ValueType",
			ColumnName: "valuetype",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: true,
			IsIndexed:  true,
		},
		{
			Name:       "PreviousValue",
			ColumnName: "previousvalue",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: true,
			IsIndexed:  true,
		},
		{
			Name:         "CreatedAt",
			ColumnName:   "created_at",
			ColumnType:   "datetime",
			DataType:     "timestamp",
			DefaultValue: "current_timestamp",
			IsNullable:   false,
			IsIndexed:    true,
		},
		{
			Name:       "UpdatedAt",
			ColumnName: "updated_at",
			ColumnType: "datetime",
			DataType:   "timestamp",
			IsNullable: true,
			IsIndexed:  true,
		},
	},
}
View Source
var EntityTypeToColumnTypeMap = map[fieldtypes.EntityType]string{
	fieldtypes.DateTime:    "datetime",
	fieldtypes.Id:          "label",
	fieldtypes.Time:        "time",
	fieldtypes.Date:        "date",
	fieldtypes.Ipaddress:   "label",
	fieldtypes.Money:       "measurement",
	fieldtypes.Rating5:     "measurement",
	fieldtypes.Rating10:    "measurement",
	fieldtypes.Rating100:   "measurement",
	fieldtypes.Timestamp:   "timestamp",
	fieldtypes.NumberInt:   "measurement",
	fieldtypes.NumberFloat: "measurement",
	fieldtypes.Boolean:     "truefalse",
	fieldtypes.Latitude:    "location.latitude",
	fieldtypes.Longitude:   "location.longitude",
	fieldtypes.City:        "label",
	fieldtypes.Country:     "label",
	fieldtypes.Continent:   "label",
	fieldtypes.State:       "label",
	fieldtypes.Pincode:     "label",
	fieldtypes.None:        "content",
	fieldtypes.Label:       "label",
	fieldtypes.Name:        "name",
	fieldtypes.Email:       "email",
	fieldtypes.Content:     "content",
	fieldtypes.Json:        "json",
	fieldtypes.Color:       "color",
	fieldtypes.Alias:       "alias",
	fieldtypes.Namespace:   "namespace",
}
View Source
var EntityTypeToDataTypeMap = map[fieldtypes.EntityType]string{
	fieldtypes.DateTime:    "datetime",
	fieldtypes.Id:          "varchar(100)",
	fieldtypes.Time:        "time",
	fieldtypes.Date:        "date",
	fieldtypes.Ipaddress:   "varchar(100)",
	fieldtypes.Money:       "float(11)",
	fieldtypes.Rating5:     "int(4)",
	fieldtypes.Rating10:    "int(4)",
	fieldtypes.Rating100:   "int(4)",
	fieldtypes.Timestamp:   "timestamp",
	fieldtypes.NumberInt:   "int(5)",
	fieldtypes.NumberFloat: "float(11)",
	fieldtypes.Boolean:     "bool",
	fieldtypes.Latitude:    "float(11)",
	fieldtypes.Longitude:   "float(11)",
	fieldtypes.City:        "varchar(100)",
	fieldtypes.Country:     "varchar(100)",
	fieldtypes.Continent:   "varchar(100)",
	fieldtypes.State:       "varchar(100)",
	fieldtypes.Pincode:     "varchar(20)",
	fieldtypes.None:        "varchar(100)",
	fieldtypes.Label:       "varchar(100)",
	fieldtypes.Name:        "varchar(100)",
	fieldtypes.Email:       "varchar(100)",
	fieldtypes.Content:     "text",
	fieldtypes.Json:        "text",
	fieldtypes.Color:       "varchar(10)",
	fieldtypes.Alias:       "varchar(100)",
	fieldtypes.Namespace:   "varchar(100)",
}
View Source
var (
	// Error Unauthorized
	ErrUnauthorized = errors.New("forbidden")
)
View Source
var ReservedWords = []string{}/* 825 elements not displayed */

thanks to https://www.drupal.org/node/141051

View Source
var StandardColumns = []api2go.ColumnInfo{
	{
		Name:            "id",
		ColumnName:      "id",
		DataType:        "INTEGER",
		IsPrimaryKey:    true,
		IsAutoIncrement: true,
		ExcludeFromApi:  true,
		ColumnType:      "id",
	},
	{
		Name:           "version",
		ColumnName:     "version",
		DataType:       "INTEGER",
		ColumnType:     "measurement",
		DefaultValue:   "1",
		ExcludeFromApi: true,
	},
	{
		Name:         "created_at",
		ColumnName:   "created_at",
		DataType:     "timestamp",
		DefaultValue: "current_timestamp",
		ColumnType:   "datetime",
		IsIndexed:    true,
	},
	{
		Name:       "updated_at",
		ColumnName: "updated_at",
		DataType:   "timestamp",
		IsIndexed:  true,
		IsNullable: true,
		ColumnType: "datetime",
	},
	{
		Name:       "reference_id",
		ColumnName: "reference_id",
		DataType:   "varchar(40)",
		IsIndexed:  true,
		IsUnique:   true,
		IsNullable: false,
		ColumnType: "alias",
	},
	{
		Name:       "permission",
		ColumnName: "permission",
		DataType:   "int(11)",
		IsIndexed:  false,
		ColumnType: "value",
	},
}
View Source
var StandardData = []api2go.Api2GoModel{
	{},
}
View Source
var StandardMarketplaces = []Marketplace{
	{
		RootPath: "",
		Endpoint: "https://github.com/daptin/market.git",
		Name:     "daptin",
	},
}
View Source
var StandardRelations = []api2go.TableRelation{
	api2go.NewTableRelation("action", "belongs_to", "world"),
	api2go.NewTableRelation("world", "has_many", "smd"),
	api2go.NewTableRelation("oauth_token", "has_one", "oauth_connect"),
	api2go.NewTableRelation("data_exchange", "has_one", "oauth_token"),
	api2go.NewTableRelation("timeline", "belongs_to", "world"),
	api2go.NewTableRelation("cloud_store", "has_one", "oauth_token"),
	api2go.NewTableRelation("site", "has_one", "cloud_store"),
	api2go.NewTableRelationWithNames("task", "task_executed", "has_one", "user_account", "as_user_id"),
}
View Source
var StandardStreams = []StreamContract{
	{
		StreamName:     "table",
		RootEntityName: "world",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "table_name",
				ColumnType: "label",
			},
			{
				Name:       "reference_id",
				ColumnType: "label",
			},
		},
	},
	{
		StreamName:     "transformed_user",
		RootEntityName: "user_account",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "transformed_user_name",
				ColumnType: "label",
			},
			{
				Name:       "primary_email",
				ColumnType: "label",
			},
		},
		Transformations: []Transformation{
			{
				Operation: "select",
				Attributes: map[string]interface{}{
					"columns": []string{"name", "email"},
				},
			},
			{
				Operation: "rename",
				Attributes: map[string]interface{}{
					"oldName": "name",
					"newName": "transformed_user_name",
				},
			},
			{
				Operation: "rename",
				Attributes: map[string]interface{}{
					"oldName": "email",
					"newName": "primary_email",
				},
			},
		},
	},
}
View Source
var StandardTables = []TableInfo{
	{
		TableName:     "task",
		IsHidden:      true,
		DefaultGroups: adminsGroup,
		Icon:          "fa-clock",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsIndexed:  true,
			},
			{
				Name:       "action_name",
				ColumnName: "action_name",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "entity_name",
				ColumnName: "entity_name",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "schedule",
				ColumnName: "schedule",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "active",
				ColumnName: "active",
				DataType:   "bool",
				ColumnType: "truefalse",
			},
			{
				Name:       "attributes",
				ColumnName: "attributes",
				DataType:   "text",
				ColumnType: "json",
			},
		},
	},
	{
		TableName:     "marketplace",
		IsHidden:      true,
		DefaultGroups: adminsGroup,
		Icon:          "fa-shopping-cart",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsIndexed:  true,
			},
			{
				Name:       "endpoint",
				ColumnName: "endpoint",
				DataType:   "varchar(200)",
				ColumnType: "url",
			},
			{
				Name:         "root_path",
				ColumnName:   "root_path",
				DataType:     "varchar(100)",
				ColumnType:   "label",
				DefaultValue: "''",
			},
		},
	},
	{
		TableName:     "json_schema",
		Icon:          "fa-code",
		DefaultGroups: adminsGroup,
		IsHidden:      true,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "schema_name",
				ColumnName: "schema_name",
				ColumnType: "label",
				DataType:   "varchar(100)",
				IsNullable: false,
			},
			{
				Name:       "json_schema",
				ColumnType: "json",
				DataType:   "text",
				ColumnName: "json_schema",
			},
		},
	},
	{
		TableName:     "timeline",
		Icon:          "fa-clock-o",
		DefaultGroups: adminsGroup,
		IsHidden:      true,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "event_type",
				ColumnName: "event_type",
				ColumnType: "label",
				DataType:   "varchar(50)",
				IsNullable: false,
			},
			{
				Name:       "title",
				ColumnName: "title",
				ColumnType: "label",
				IsIndexed:  true,
				DataType:   "varchar(50)",
				IsNullable: false,
			},
			{
				Name:       "payload",
				ColumnName: "payload",
				ColumnType: "content",
				DataType:   "text",
				IsNullable: true,
			},
		},
	},
	{
		TableName:     "world",
		IsHidden:      true,
		DefaultGroups: adminsGroup,
		Icon:          "fa-home",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "table_name",
				ColumnName: "table_name",
				IsNullable: false,
				IsUnique:   true,
				IsIndexed:  true,
				DataType:   "varchar(200)",
				ColumnType: "name",
			},
			{
				Name:       "world_schema_json",
				ColumnName: "world_schema_json",
				DataType:   "text",
				IsNullable: false,
				ColumnType: "json",
			},
			{
				Name:         "default_permission",
				ColumnName:   "default_permission",
				DataType:     "int(4)",
				IsNullable:   false,
				DefaultValue: "644",
				ColumnType:   "value",
			},
			{
				Name:         "is_top_level",
				ColumnName:   "is_top_level",
				DataType:     "bool",
				IsNullable:   false,
				DefaultValue: "true",
				ColumnType:   "truefalse",
			},
			{
				Name:         "is_hidden",
				ColumnName:   "is_hidden",
				DataType:     "bool",
				IsNullable:   false,
				DefaultValue: "false",
				ColumnType:   "truefalse",
			},
			{
				Name:         "is_join_table",
				ColumnName:   "is_join_table",
				DataType:     "bool",
				IsNullable:   false,
				DefaultValue: "false",
				ColumnType:   "truefalse",
			},
			{
				Name:         "is_state_tracking_enabled",
				ColumnName:   "is_state_tracking_enabled",
				DataType:     "bool",
				IsNullable:   false,
				DefaultValue: "false",
				ColumnType:   "truefalse",
			},
			{
				Name:         "default_order",
				ColumnName:   "default_order",
				DataType:     "varchar(100)",
				IsNullable:   true,
				DefaultValue: "'+id'",
				ColumnType:   "value",
			},
			{
				Name:         "icon",
				ColumnName:   "icon",
				DataType:     "varchar(20)",
				IsNullable:   true,
				DefaultValue: "'fa-star'",
				ColumnType:   "label",
			},
		},
	},
	{
		TableName:     "stream",
		Icon:          "fa-strikethrough",
		DefaultGroups: adminsGroup,
		IsHidden:      true,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "stream_name",
				ColumnName: "stream_name",
				DataType:   "varchar(100)",
				IsNullable: false,
				ColumnType: "label",
				IsIndexed:  true,
			},
			{
				Name:       "stream_contract",
				ColumnName: "stream_contract",
				DataType:   "text",
				IsNullable: false,
				ColumnType: "json",
			},
		},
	},
	{
		TableName:     "user_account",
		Icon:          "fa-child",
		DefaultGroups: []string{"users"},
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				IsIndexed:  true,
				DataType:   "varchar(80)",
				ColumnType: "label",
			},
			{
				Name:       "email",
				ColumnName: "email",
				DataType:   "varchar(80)",
				IsIndexed:  true,
				IsUnique:   true,
				ColumnType: "email",
			},

			{
				Name:       "password",
				ColumnName: "password",
				DataType:   "varchar(100)",
				ColumnType: "password",
				IsNullable: true,
			},
			{
				Name:         "confirmed",
				ColumnName:   "confirmed",
				DataType:     "boolean",
				ColumnType:   "truefalse",
				IsNullable:   false,
				DefaultValue: "false",
			},
		},
		Validations: []ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
			{
				ColumnName: "password",
				Tags:       "required",
			},
			{
				ColumnName: "name",
				Tags:       "required",
			},
		},
		Conformations: []ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
		},
	},
	{
		TableName: "usergroup",
		Icon:      "fa-users",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				IsIndexed:  true,
				DataType:   "varchar(80)",
				ColumnType: "label",
			},
		},
	},
	{
		TableName:     "action",
		DefaultGroups: adminsGroup,
		Icon:          "fa-bolt",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "action_name",
				IsIndexed:  true,
				ColumnName: "action_name",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "label",
				ColumnName: "label",
				IsIndexed:  true,
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:         "instance_optional",
				ColumnName:   "instance_optional",
				IsIndexed:    false,
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "true",
			},
			{
				Name:       "action_schema",
				ColumnName: "action_schema",
				DataType:   "text",
				ColumnType: "json",
			},
		},
	},
	{
		TableName:     "smd",
		IsHidden:      true,
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				IsIndexed:  true,
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "label",
				ColumnName: "label",
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "initial_state",
				ColumnName: "initial_state",
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "events",
				ColumnName: "events",
				DataType:   "text",
				ColumnType: "json",
				IsNullable: false,
			},
		},
	},
	{
		TableName:     "oauth_connect",
		IsHidden:      true,
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				IsUnique:   true,
				IsIndexed:  true,
				DataType:   "varchar(80)",
				ColumnType: "label",
			},
			{
				Name:       "client_id",
				ColumnName: "client_id",
				DataType:   "varchar(150)",
				ColumnType: "label",
			},
			{
				Name:       "client_secret",
				ColumnName: "client_secret",
				DataType:   "varchar(500)",
				ColumnType: "encrypted",
			},
			{
				Name:         "scope",
				ColumnName:   "scope",
				DataType:     "varchar(1000)",
				ColumnType:   "content",
				DefaultValue: "'https://www.googleapis.com/auth/spreadsheets'",
			},
			{
				Name:         "response_type",
				ColumnName:   "response_type",
				DataType:     "varchar(80)",
				ColumnType:   "label",
				DefaultValue: "'code'",
			},
			{
				Name:         "redirect_uri",
				ColumnName:   "redirect_uri",
				DataType:     "varchar(80)",
				ColumnType:   "url",
				DefaultValue: "'/oauth/response'",
			},
			{
				Name:         "auth_url",
				ColumnName:   "auth_url",
				DataType:     "varchar(200)",
				DefaultValue: "'https://accounts.google.com/o/oauth2/auth'",
				ColumnType:   "url",
			},
			{
				Name:         "token_url",
				ColumnName:   "token_url",
				DataType:     "varchar(200)",
				DefaultValue: "'https://accounts.google.com/o/oauth2/token'",
				ColumnType:   "url",
			},
			{
				Name:         "profile_url",
				ColumnName:   "profile_url",
				DataType:     "varchar(200)",
				DefaultValue: "'https://www.googleapis.com/oauth2/v1/userinfo?alt=json'",
				ColumnType:   "url",
			},
			{
				Name:         "profile_email_path",
				ColumnName:   "profile_email_path",
				DataType:     "varchar(200)",
				DefaultValue: "'email'",
				ColumnType:   "label",
			},
			{
				Name:         "allow_login",
				ColumnName:   "allow_login",
				DataType:     "boolean",
				DefaultValue: "false",
				ColumnType:   "truefalse",
			},
		},
	},
	{
		TableName:     "data_exchange",
		IsHidden:      true,
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				ColumnType: "label",
				DataType:   "varchar(200)",
				IsIndexed:  true,
			},
			{
				Name:       "source_attributes",
				ColumnName: "source_attributes",
				ColumnType: "json",
				DataType:   "text",
			},
			{
				Name:       "source_type",
				ColumnName: "source_type",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "target_attributes",
				ColumnName: "target_attributes",
				ColumnType: "json",
				DataType:   "text",
			},
			{
				Name:       "target_type",
				ColumnName: "target_type",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "attributes",
				ColumnName: "attributes",
				ColumnType: "json",
				DataType:   "text",
			},
			{
				Name:       "options",
				ColumnName: "options",
				ColumnType: "json",
				DataType:   "text",
			},
		},
	},
	{
		TableName:     "oauth_token",
		IsHidden:      true,
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "access_token",
				ColumnName: "access_token",
				ColumnType: "encrypted",
				DataType:   "varchar(1000)",
			},
			{
				Name:       "expires_in",
				ColumnName: "expires_in",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:       "refresh_token",
				ColumnName: "refresh_token",
				ColumnType: "encrypted",
				DataType:   "varchar(1000)",
			},
			{
				Name:       "token_type",
				ColumnName: "token_type",
				ColumnType: "label",
				DataType:   "varchar(20)",
			},
		},
	},
	{
		TableName:     "cloud_store",
		DefaultGroups: adminsGroup,
		IsHidden:      true,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "Name",
				ColumnName: "name",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "store_type",
				ColumnName: "store_type",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "store_provider",
				ColumnName: "store_provider",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "root_path",
				ColumnName: "root_path",
				ColumnType: "label",
				DataType:   "varchar(1000)",
			},
			{
				Name:       "store_parameters",
				ColumnName: "store_parameters",
				ColumnType: "json",
				DataType:   "text",
			},
		},
	},
	{
		TableName:     "site",
		DefaultGroups: adminsGroup,
		IsHidden:      true,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "hostname",
				ColumnName: "hostname",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "path",
				ColumnName: "path",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
		},
	},
}
View Source
var StandardTasks = []Task{}
View Source
var SystemActions = []Action{
	{
		Name:             "sync_site_storage",
		Label:            "Sync site storage",
		OnType:           "site",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Path",
				ColumnName: "path",
				ColumnType: "label",
			},
		},
		OutFields: []Outcome{
			{
				Type:   "site.storage.sync",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"cloud_store_id": "$.cloud_store_id",
					"path":           "~path",
				},
			},
		},
	},
	{
		Name:             "restart_daptin",
		Label:            "Restart system",
		OnType:           "world",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "system_json_schema_update",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"json_schema": "!JSON.parse('[{\"name\":\"empty.json\",\"file\":\"data:application/json;base64,e30K\",\"type\":\"application/json\"}]')",
				},
			},
		},
	},
	{
		Name:             "publish_package_to_market",
		Label:            "Update package list",
		OnType:           "marketplace",
		InstanceOptional: false,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "marketplace.package.publish",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"marketplace_id": "$.reference_id",
				},
			},
		},
	},
	{
		Name:             "visit_marketplace_github",
		Label:            "Go to marketplace",
		OnType:           "marketplace",
		InstanceOptional: false,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "client.redirect",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"location": "$subject.endpoint",
					"window":   "_blank",
				}},
		},
	},
	{
		Name:             "refresh_marketplace_packages",
		Label:            "Refresh marketplace",
		OnType:           "marketplace",
		InstanceOptional: false,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "marketplace.package.refresh",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"marketplace_id": "$.reference_id",
				},
			},
		},
	},
	{
		Name:             "generate_random_data",
		Label:            "Generate random data",
		OnType:           "world",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Number of records",
				ColumnName: "count",
				ColumnType: "measurement",
			},
		},
		OutFields: []Outcome{
			{
				Type:   "generate.random.data",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"count":             "~count",
					"table_name":        "$.table_name",
					"user_reference_id": "$user.reference_id",
					"user_account_id":   "$user.id",
				},
			},
		},
		Validations: []ColumnTag{
			{
				ColumnName: "count",
				Tags:       "gt=0",
			},
		},
	},

	{
		Name:             "install_marketplace_package",
		Label:            "Install package from market",
		OnType:           "marketplace",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "package_name",
				ColumnName: "package_name",
				ColumnType: "label",
				IsNullable: false,
			},
		},
		OutFields: []Outcome{
			{
				Type:   "marketplace.package.install",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"package_name":   "~package_name",
					"marketplace_id": "$.reference_id",
				},
			},
		},
	},
	{
		Name:             "export_data",
		Label:            "Export data for backup",
		OnType:           "world",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "__data_export",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"world_reference_id": "$.reference_id",
					"table_name":         "$.table_name",
				},
			},
		},
	},
	{
		Name:             "export_csv_data",
		Label:            "Export CSV data",
		OnType:           "world",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "__csv_data_export",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"world_reference_id": "$.reference_id",
					"table_name":         "$.table_name",
				},
			},
		},
	},
	{
		Name:             "import_data",
		Label:            "Import data from dump",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "JSON Dump file",
				ColumnName: "dump_file",
				ColumnType: "file.json|yaml|toml|hcl",
				IsNullable: false,
			},
			{
				Name:       "truncate_before_insert",
				ColumnName: "truncate_before_insert",
				ColumnType: "truefalse",
			},
		},
		OutFields: []Outcome{
			{
				Type:   "__data_import",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"world_reference_id":       "$.reference_id",
					"execute_middleware_chain": "~execute_middleware_chain",
					"truncate_before_insert":   "~truncate_before_insert",
					"dump_file":                "~dump_file",
					"table_name":               "$.table_name",
					"user":                     "~user",
				},
			},
		},
	},
	{
		Name:             "upload_file",
		Label:            "Upload file to external store",
		OnType:           "cloud_store",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "File",
				ColumnName: "file",
				ColumnType: "file.*",
				IsNullable: false,
			},
		},
		OutFields: []Outcome{
			{
				Type:   "__external_file_upload",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"file":           "~file",
					"oauth_token_id": "$.oauth_token_id",
					"store_provider": "$.store_provider",
					"root_path":      "$.root_path",
				},
			},
		},
	},
	{
		Name:             "upload_system_schema",
		Label:            "Upload features",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Schema file",
				ColumnName: "schema_file",
				ColumnType: "file.json|yaml|toml|hcl",
				IsNullable: false,
			},
		},
		OutFields: []Outcome{
			{
				Type:   "system_json_schema_update",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"json_schema": "~schema_file",
				},
			},
		},
	},
	{
		Name:             "upload_xls_to_system_schema",
		Label:            "Upload xls to entity",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "XLSX file",
				ColumnName: "data_xls_file",
				ColumnType: "file.xls|xlsx",
				IsNullable: false,
			},
			{
				Name:       "Entity name",
				ColumnName: "entity_name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "Create entity if not exists",
				ColumnName: "create_if_not_exists",
				ColumnType: "truefalse",
				IsNullable: false,
			},
			{
				Name:       "Add missing columns",
				ColumnName: "add_missing_columns",
				ColumnType: "truefalse",
				IsNullable: false,
			},
		},
		Validations: []ColumnTag{
			{
				ColumnName: "entity_name",
				Tags:       "required",
			},
		},
		OutFields: []Outcome{
			{
				Type:   "__upload_xlsx_file_to_entity",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"data_xls_file":        "~data_xls_file",
					"entity_name":          "~entity_name",
					"add_missing_columns":  "~add_missing_columns",
					"create_if_not_exists": "~create_if_not_exists",
				},
			},
		},
	},
	{
		Name:             "upload_csv_to_system_schema",
		Label:            "Upload CSV to entity",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "CSV file",
				ColumnName: "data_csv_file",
				ColumnType: "file.csv",
				IsNullable: false,
			},
			{
				Name:       "Entity name",
				ColumnName: "entity_name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "Create entity if not exists",
				ColumnName: "create_if_not_exists",
				ColumnType: "truefalse",
				IsNullable: false,
			},
			{
				Name:       "Add missing columns",
				ColumnName: "add_missing_columns",
				ColumnType: "truefalse",
				IsNullable: false,
			},
		},
		Validations: []ColumnTag{
			{
				ColumnName: "entity_name",
				Tags:       "required",
			},
		},
		OutFields: []Outcome{
			{
				Type:   "__upload_csv_file_to_entity",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"data_csv_file":        "~data_csv_file",
					"entity_name":          "~entity_name",
					"add_missing_columns":  "~add_missing_columns",
					"create_if_not_exists": "~create_if_not_exists",
				},
			},
		},
	},
	{
		Name:             "download_system_schema",
		Label:            "Download system schema",
		OnType:           "world",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:       "__download_cms_config",
				Method:     "EXECUTE",
				Attributes: map[string]interface{}{},
			},
		},
	},
	{
		Name:             "become_an_administrator",
		Label:            "Become Daptin Administrator",
		InstanceOptional: true,
		OnType:           "world",
		InFields:         []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "__become_admin",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"user_account_id": "$user.id",
					"user":            "~user",
				},
			},
		},
	},
	{
		Name:             "signup",
		Label:            "Sign up",
		InstanceOptional: true,
		OnType:           "user_account",
		InFields: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "email",
				IsNullable: false,
			},
			{
				Name:       "password",
				ColumnName: "password",
				ColumnType: "password",
				IsNullable: false,
			},
			{
				Name:       "Password Confirm",
				ColumnName: "passwordConfirm",
				ColumnType: "password",
				IsNullable: false,
			},
		},
		Validations: []ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
			{
				ColumnName: "name",
				Tags:       "required",
			},
			{
				ColumnName: "password",
				Tags:       "eqfield=InnerStructField[passwordConfirm],min=8",
			},
		},
		Conformations: []ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
			{
				ColumnName: "name",
				Tags:       "trim",
			},
		},
		OutFields: []Outcome{
			{
				Type:      "user_account",
				Method:    "POST",
				Reference: "user",
				Attributes: map[string]interface{}{
					"name":      "~name",
					"email":     "~email",
					"password":  "~password",
					"confirmed": "0",
				},
			},
			{
				Type:      "usergroup",
				Method:    "POST",
				Reference: "usergroup",
				Attributes: map[string]interface{}{
					"name": "!'Home group for ' + user.name",
				},
			},
			{
				Type:      "user_account_user_account_id_has_usergroup_usergroup_id",
				Method:    "POST",
				Reference: "user_usergroup",
				Attributes: map[string]interface{}{
					"user_account_id": "$user.reference_id",
					"usergroup_id":    "$usergroup.reference_id",
				},
			},
			{
				Type:   "client.notify",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"type":    "success",
					"title":   "Success",
					"message": "Sign-up successful. Redirecting to sign in",
				},
			},
			{
				Type:   "client.redirect",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"location": "/auth/signin",
					"window":   "self",
					"delay":    2000,
				},
			},
		},
	},
	{
		Name:             "signin",
		Label:            "Sign in",
		InstanceOptional: true,
		OnType:           "user_account",
		InFields: []api2go.ColumnInfo{
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "email",
				IsNullable: false,
			},
			{
				Name:       "password",
				ColumnName: "password",
				ColumnType: "password",
				IsNullable: false,
			},
		},
		OutFields: []Outcome{
			{
				Type:   "jwt.token",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"email":    "~email",
					"password": "~password",
				},
			},
		},
	},
	{
		Name:     "oauth.login.begin",
		Label:    "Authenticate via OAuth",
		OnType:   "oauth_connect",
		InFields: []api2go.ColumnInfo{},
		OutFields: []Outcome{
			{
				Type:   "oauth.client.redirect",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"authenticator": "$.name",
					"scope":         "$.scope",
				},
			},
		},
	},
	{
		Name:             "oauth.login.response",
		Label:            "",
		InstanceOptional: true,
		OnType:           "oauth_token",
		InFields: []api2go.ColumnInfo{
			{
				Name:       "code",
				ColumnName: "code",
				ColumnType: "hidden",
				IsNullable: false,
			},
			{
				Name:       "state",
				ColumnName: "state",
				ColumnType: "hidden",
				IsNullable: false,
			},
			{
				Name:       "authenticator",
				ColumnName: "authenticator",
				ColumnType: "hidden",
				IsNullable: false,
			},
		},
		OutFields: []Outcome{
			{
				Type:           "oauth_connect",
				Method:         "GET",
				SkipInResponse: true,
				Reference:      "connection",
				Attributes: map[string]interface{}{
					"filter":       "~authenticator",
					"page[number]": "1",
					"page[size]":   "1",
				},
			},
			{
				Type:           "oauth.login.response",
				Method:         "EXECUTE",
				SkipInResponse: true,
				Reference:      "auth",
				Attributes: map[string]interface{}{
					"authenticator":     "~authenticator",
					"user_account_id":   "~user.id",
					"user_reference_id": "~user.reference_id",
					"state":             "~state",
					"code":              "~code",
				},
			},
			{
				Type:           "oauth.profile.exchange",
				Method:         "EXECUTE",
				Reference:      "profile",
				SkipInResponse: true,
				Condition:      "$connection[0].allow_login",
				Attributes: map[string]interface{}{
					"authenticator": "~authenticator",
					"token":         "$auth.access_token",
					"tokenInfoUrl":  "$connection[0].token_url",
					"profileUrl":    "$connection[0].profile_url",
				},
			},
			{
				Type:           "user_account",
				Method:         "GET",
				Reference:      "user",
				SkipInResponse: true,
				Condition:      "$connection[0].allow_login",
				Attributes: map[string]interface{}{
					"filter": "!profile.email || profile.emailAddress",
				},
			},
			{
				Type:           "user_account",
				Method:         "POST",
				Reference:      "user",
				SkipInResponse: true,
				Condition:      "!!user || (!user.length && !user.reference_id)",
				Attributes: map[string]interface{}{
					"email":    "!profile.email || profile.emailAddress",
					"name":     "$profile.displayName",
					"password": "$profile.id",
				},
			},
			{
				Type:           "usergroup",
				Method:         "POST",
				Reference:      "usergroup",
				SkipInResponse: true,
				Condition:      "!!user || (!user.length && !user.reference_id)",
				Attributes: map[string]interface{}{
					"name": "!'Home group for ' + profile.emails[0].value",
				},
			},
			{
				Type:           "user_account_user_account_id_has_usergroup_usergroup_id",
				Method:         "POST",
				SkipInResponse: true,
				Condition:      "!!user || (!user.length && !user.reference_id)",
				Attributes: map[string]interface{}{
					"user_account_id": "$user.reference_id",
					"usergroup_id":    "$usergroup.reference_id",
				},
			},
			{
				Type:   "jwt.token",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"email":             "!profile.email || profile.emailAddress",
					"skipPasswordCheck": true,
				},
			},
			{
				Type:   "client.redirect",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"location": "/",
					"window":   "self",
					"delay":    2000,
				},
			},
		},
	},
	{
		Name:             "add_exchange",
		Label:            "Add new data exchange",
		OnType:           "world",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "sheet_id",
				ColumnName: "sheet_id",
				ColumnType: "alias",
				IsNullable: false,
			},
			{
				Name:       "app_key Key",
				ColumnName: "app_key",
				ColumnType: "alias",
				IsNullable: false,
			},
		},
		OutFields: []Outcome{
			{
				Type:   "data_exchange",
				Method: "POST",
				Attributes: map[string]interface{}{
					"name":              "!'Export ' + subject.table_name + ' to excel sheet'",
					"source_attributes": "!JSON.stringify({name: subject.table_name})",
					"source_type":       "self",
					"target_type":       "gsheet-append",
					"options":           "!JSON.stringify({hasHeader: true})",
					"attributes":        "!JSON.stringify([{SourceColumn: '$self.description', TargetColumn: 'Task description'}])",
					"target_attributes": "!JSON.stringify({sheetUrl: 'https://content-sheets.googleapis.com/v4/spreadsheets/' + sheet_id + '/values/A1:append', appKey: app_key})",
				},
			},
		},
	},
}
View Source
var SystemExchanges = []ExchangeContract{}
View Source
var SystemSmds = []LoopbookFsmDescription{}
View Source
var ValidatorInstance *validator.Validate = validator.New()

Functions

func BcryptCheckStringHash

func BcryptCheckStringHash(newString, hash string) bool

func BcryptHashString

func BcryptHashString(password string) (string, error)

func BeginsWith added in v0.6.2

func BeginsWith(longerString string, smallerString string) bool

func BuildOutcome

func BuildOutcome(inFieldMap map[string]interface{}, outcome Outcome) (*api2go.Api2GoModel, api2go.Request, error)

func CheckAllTableStatus

func CheckAllTableStatus(initConfig *CmsConfig, db database.DatabaseConnection, tx *sqlx.Tx)

func CheckAuditTables added in v0.2.1

func CheckAuditTables(config *CmsConfig)

func CheckErr

func CheckErr(err error, message ...interface{}) bool

func CheckInfo added in v0.6.2

func CheckInfo(err error, message ...interface{})

func CheckRelations

func CheckRelations(config *CmsConfig)

func CheckTable

func CheckTable(tableInfo *TableInfo, db database.DatabaseConnection, tx *sqlx.Tx)

func CopyFile added in v0.4.0

func CopyFile(src, dst string) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

func CreateAMapOfColumnsWeWantInTheFinalTable

func CreateAMapOfColumnsWeWantInTheFinalTable(tableInfo *TableInfo) (map[string]bool, map[string]api2go.ColumnInfo)

func CreateGuestActionListHandler

func CreateGuestActionListHandler(initConfig *CmsConfig) func(*gin.Context)

func CreateIndexes

func CreateIndexes(initConfig *CmsConfig, db *sqlx.Tx)

func CreatePostActionHandler

func CreatePostActionHandler(initConfig *CmsConfig, configStore *ConfigStore, cruds map[string]*DbResource, actionPerformers []ActionPerformerInterface) func(*gin.Context)

func CreateRelations

func CreateRelations(initConfig *CmsConfig, db *sqlx.Tx)

func CreateTable

func CreateTable(tableInfo *TableInfo, db *sqlx.Tx)

func CreateUniqueConstraints

func CreateUniqueConstraints(initConfig *CmsConfig, db *sqlx.Tx)

func Decrypt

func Decrypt(key []byte, cryptoText string) (string, error)

Decrypt from base64 to decrypted string

func Encrypt

func Encrypt(key []byte, text string) (string, error)

Encrypt string to base64 crypto using AES

func EndsWithCheck added in v0.2.1

func EndsWithCheck(str string, endsWith string) bool

func GetActionMapByTypeName

func GetActionMapByTypeName(db database.DatabaseConnection) (map[string]map[string]interface{}, error)

func GetAdminUserIdAndUserGroupId

func GetAdminUserIdAndUserGroupId(db database.DatabaseConnection) (int64, int64)

func GetDataArray added in v0.2.1

func GetDataArray(sheet *xlsx.Sheet) (dataMap []map[string]interface{}, columnNames []string, err error)

func GetFakeRow added in v0.4.0

func GetFakeRow(columns []api2go.ColumnInfo) map[string]interface{}

func GetMD5Hash

func GetMD5Hash(text string) string

func GetOauthConnectionById

func GetOauthConnectionById(authenticatorId int64, dbResource *DbResource) (*oauth2.Config, string, error)

func GetOauthConnectionDescription

func GetOauthConnectionDescription(authenticator string, dbResource *DbResource) (*oauth2.Config, string, error)

func GetObjectByWhereClause

func GetObjectByWhereClause(objType string, db database.DatabaseConnection, queries ...squirrel.Eq) ([]map[string]interface{}, error)

func GetTokensScope added in v0.6.0

func GetTokensScope(tokUrl string, scope string, clientId string, clientSecret string, token string) (map[string]interface{}, error)

func GetValidatedInFields

func GetValidatedInFields(actionRequest *ActionRequest, action Action) (map[string]interface{}, error)

func GetWorldTableMapBy

func GetWorldTableMapBy(col string, db database.DatabaseConnection) (map[string]map[string]interface{}, error)

func GroupNamesToIds added in v0.6.4

func GroupNamesToIds(db database.DatabaseConnection, groupsName []string) []int64

func ImportDataFiles added in v0.2.1

func ImportDataFiles(initConfig *CmsConfig, db database.DatabaseConnection, cruds map[string]*DbResource)

func ImportDataMapArray added in v0.6.2

func ImportDataMapArray(data []map[string]interface{}, crud *DbResource, req api2go.Request) []error

func ImportDataStringArray added in v0.6.2

func ImportDataStringArray(data [][]string, headers []string, entityName string, crud *DbResource, req api2go.Request) []error

func InArray added in v0.6.8

func InArray(val []string, ar string) (exists bool)

func InfoErr added in v0.2.1

func InfoErr(err error, message ...interface{}) bool

func InitialiseColumnManager added in v0.2.1

func InitialiseColumnManager()

func IsReservedWord added in v0.2.1

func IsReservedWord(w string) bool

func MakeCreateTableQuery

func MakeCreateTableQuery(tableInfo *TableInfo, sqlDriverName string) string

func NewClientNotification

func NewClientNotification(notificationType string, message string, title string) map[string]interface{}

func NewMapStringScan

func NewMapStringScan(columnNames []string) *mapStringScan

func NewResponse

func NewResponse(metadata map[string]interface{}, result interface{}, statusCode int, pagination *api2go.Pagination) api2go.Responder

func PrintRelations added in v0.5.7

func PrintRelations(relations []api2go.TableRelation)

func PrintTableInfo added in v0.5.7

func PrintTableInfo(info *TableInfo, title string)

func ReferenceIdToIntegerId

func ReferenceIdToIntegerId(typeName string, referenceId string, db database.DatabaseConnection) (int64, error)

func RegisterTranslations added in v0.6.9

func RegisterTranslations()

func RowsToMap

func RowsToMap(rows *sqlx.Rows, typeName string) ([]map[string]interface{}, error)

convert the result of db.QueryRowx => rows to array of data can be used on any *sqlx.Rows and assign a typeName

func SmallSnakeCaseText added in v0.2.1

func SmallSnakeCaseText(str string) string

func UpdateActionTable

func UpdateActionTable(initConfig *CmsConfig, db database.DatabaseConnection) error

func UpdateExchanges

func UpdateExchanges(initConfig *CmsConfig, db database.DatabaseConnection)

func UpdateMarketplaces added in v0.4.0

func UpdateMarketplaces(initConfig *CmsConfig, db database.DatabaseConnection)

func UpdateStandardData added in v0.6.3

func UpdateStandardData(initConfig *CmsConfig, db database.DatabaseConnection)

func UpdateStateMachineDescriptions

func UpdateStateMachineDescriptions(initConfig *CmsConfig, db database.DatabaseConnection)

func UpdateStreams added in v0.4.0

func UpdateStreams(initConfig *CmsConfig, db database.DatabaseConnection)

func UpdateTasksData added in v0.6.9

func UpdateTasksData(initConfig *CmsConfig, db database.DatabaseConnection) error

func UpdateWorldTable

func UpdateWorldTable(initConfig *CmsConfig, db *sqlx.Tx)

func ValueOf

func ValueOf(x interface{}) interface{}

Types

type Action

type Action struct {
	Name             string // Name of the action
	Label            string
	OnType           string
	InstanceOptional bool
	ReferenceId      string
	InFields         []api2go.ColumnInfo
	OutFields        []Outcome
	Validations      []ColumnTag
	Conformations    []ColumnTag
}

Action is a set of `Outcome` based on set of Input values on a particular data type New actions can be defined and added using JSON or YAML files Actions are stored and reloaded from the `action` table of the storage

type ActionPerformerInterface

type ActionPerformerInterface interface {
	DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)
	Name() string
}

func NewBecomeAdminPerformer

func NewBecomeAdminPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

Create a new action performer for becoming administrator action

func NewDownloadCmsConfigPerformer

func NewDownloadCmsConfigPerformer(initConfig *CmsConfig) (ActionPerformerInterface, error)

func NewExportCsvDataPerformer added in v0.6.9

func NewExportCsvDataPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewExportDataPerformer added in v0.2.1

func NewExportDataPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewFileUploadActionPerformer added in v0.2.1

func NewFileUploadActionPerformer(cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewGenerateJwtTokenPerformer

func NewGenerateJwtTokenPerformer(configStore *ConfigStore, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewGenerateOauth2TokenPerformer added in v0.7.0

func NewGenerateOauth2TokenPerformer(configStore *ConfigStore, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewImportDataPerformer added in v0.2.1

func NewImportDataPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewMakeResponsePerformer added in v0.7.0

func NewMakeResponsePerformer() (ActionPerformerInterface, error)

Create a new action performer for becoming administrator action

func NewMarketplacePackageInstaller added in v0.4.0

func NewMarketplacePackageInstaller(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewNetworkRequestPerformer added in v0.6.0

func NewNetworkRequestPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewOauthLoginBeginActionPerformer

func NewOauthLoginBeginActionPerformer(initConfig *CmsConfig, cruds map[string]*DbResource, configStore *ConfigStore) (ActionPerformerInterface, error)

func NewOauthLoginResponseActionPerformer

func NewOauthLoginResponseActionPerformer(initConfig *CmsConfig, cruds map[string]*DbResource, configStore *ConfigStore) (ActionPerformerInterface, error)

func NewOuathProfileExchangePerformer added in v0.6.0

func NewOuathProfileExchangePerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewRandomDataGeneratePerformer added in v0.4.0

func NewRandomDataGeneratePerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewRefreshMarketplacePackagelistPerformer added in v0.4.0

func NewRefreshMarketplacePackagelistPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewRestarSystemPerformer

func NewRestarSystemPerformer(initConfig *CmsConfig) (ActionPerformerInterface, error)

func NewSyncSiteStorageActionPerformer added in v0.6.9

func NewSyncSiteStorageActionPerformer(cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewUploadCsvFileToEntityPerformer added in v0.6.6

func NewUploadCsvFileToEntityPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

func NewUploadFileToEntityPerformer added in v0.2.1

func NewUploadFileToEntityPerformer(initConfig *CmsConfig, cruds map[string]*DbResource) (ActionPerformerInterface, error)

type ActionRequest

type ActionRequest struct {
	Type       string
	Action     string
	Attributes map[string]interface{}
}

func BuildActionRequest added in v0.6.9

func BuildActionRequest(closer io.ReadCloser, actionType, actionName string, params gin.Params) (*ActionRequest, error)

type ActionResponse

type ActionResponse struct {
	ResponseType string
	Attributes   interface{}
}

func NewActionResponse

func NewActionResponse(responseType string, attrs interface{}) ActionResponse

type ActionRow

type ActionRow struct {
	Name             string
	Label            string
	OnType           string
	InstanceOptional bool `db:"instance_optional"`
	ReferenceId      string
	ActionSchema     string `db:"action_schema"`
}

ActionRow represents an action instance on the database Can be retrieved using GetActionByName

type ActiveTaskInstance added in v0.6.9

type ActiveTaskInstance struct {
	Task          Task
	ActionRequest ActionRequest
	DbResource    *DbResource
}

func (*ActiveTaskInstance) Run added in v0.6.9

func (ati *ActiveTaskInstance) Run()

type AggregateData added in v0.6.2

type AggregateData struct {
	Data []map[string]interface{} `json:"data"`
}

PaginatedFindAll(req Request) (totalCount uint, response Responder, err error)

type AggregationRequest added in v0.6.2

type AggregationRequest struct {
	RootEntity    string
	Join          []string
	GroupBy       []string
	ProjectColumn []string
	Filter        []string
	Query         []Query
	Order         []string
	TimeSample    TimeStamp
	TimeFrom      string
	TimeTo        string
}

type BecomeAdminActionPerformer

type BecomeAdminActionPerformer struct {
	// contains filtered or unexported fields
}

*

Become administrator of daptin action implementation

func (*BecomeAdminActionPerformer) DoAction

func (d *BecomeAdminActionPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

Perform action and try to make the current user the admin of the system Checks CanBecomeAdmin and then invokes BecomeAdmin if true

func (*BecomeAdminActionPerformer) Name

Name of the action

type Change

type Change struct {
	ChangeType changeType
	OldValue   interface{}
	NewValue   interface{}
}

func Diff

func Diff(a, b interface{}) (desc []Change)

Diff returns a slice where each element describes a difference between a and b.

func Fdiff

func Fdiff(a, b interface{}) []Change

Fdiff writes to w a description of the differences between a and b.

type CloudStore added in v0.2.1

type CloudStore struct {
	Id              int64
	RootPath        string
	StoreParameters map[string]interface{}
	UserId          string
	OAutoTokenId    string
	Name            string
	StoreType       string
	StoreProvider   string
	Version         int
	CreatedAt       *time.Time
	UpdatedAt       *time.Time
	DeletedAt       *time.Time
	ReferenceId     string
	Permission      PermissionInstance
}

type CmsConfig

type CmsConfig struct {
	Tables                   []TableInfo
	Imports                  []DataFileImport
	StateMachineDescriptions []LoopbookFsmDescription
	Relations                []api2go.TableRelation
	Actions                  []Action
	ExchangeContracts        []ExchangeContract
	Hostname                 string
	SubSites                 map[string]SubSiteInformation
	Tasks                    []Task
	Streams                  []StreamContract
	MarketplaceHandlers      map[string]*MarketplaceService `json:"-"`
	Marketplaces             []Marketplace
	ActionPerformers         []ActionPerformerInterface
}

func (*CmsConfig) AddRelations added in v0.5.7

func (ti *CmsConfig) AddRelations(relations ...api2go.TableRelation)

type ColumnMap

type ColumnMap struct {
	SourceColumn     string
	SourceColumnType string
	TargetColumn     string
	TargetColumnType string
}

type ColumnMapping

type ColumnMapping []ColumnMap

func (*ColumnMapping) UnmarshalJSON

func (c *ColumnMapping) UnmarshalJSON(payload []byte) error

type ColumnTag added in v0.2.1

type ColumnTag struct {
	ColumnName string
	Tags       string
}

type ColumnType added in v0.2.1

type ColumnType struct {
	BlueprintType string
	Name          string
	Validations   []string
	Conformations []string
	ReclineType   string
	DataTypes     []string
	GraphqlType   *graphql.Scalar
}

func (ColumnType) Fake added in v0.2.1

func (ct ColumnType) Fake() interface{}

type ColumnTypeManager added in v0.2.1

type ColumnTypeManager struct {
	ColumnMap map[string]ColumnType
}
var ColumnManager *ColumnTypeManager

func (*ColumnTypeManager) GetBlueprintType added in v0.2.1

func (ctm *ColumnTypeManager) GetBlueprintType(columnType string) string

func (*ColumnTypeManager) GetFakedata added in v0.2.1

func (ctm *ColumnTypeManager) GetFakedata(colTypeName string) string

func (*ColumnTypeManager) GetGraphqlType added in v0.6.9

func (ctm *ColumnTypeManager) GetGraphqlType(columnType string) *graphql.Scalar

func (*ColumnTypeManager) IsValidValue added in v0.2.1

func (ctm *ColumnTypeManager) IsValidValue(val string, colType string, validator *validator2.Validate) error

type Config

type Config struct {
	Name          string
	ConfigType    string // web/backend/mobile
	ConfigState   string // enabled/disabled
	ConfigEnv     string // debug/test/release
	Value         string
	ValueType     string // number/string/byteslice
	PreviousValue string
	UpdatedAt     time.Time
}

type ConfigStore

type ConfigStore struct {
	// contains filtered or unexported fields
}

func NewConfigStore

func NewConfigStore(db database.DatabaseConnection) (*ConfigStore, error)

func (*ConfigStore) GetConfigIntValueFor added in v0.6.8

func (c *ConfigStore) GetConfigIntValueFor(key string, configtype string) (int, error)

func (*ConfigStore) GetConfigValueFor

func (c *ConfigStore) GetConfigValueFor(key string, configtype string) (string, error)

func (*ConfigStore) GetWebConfig

func (c *ConfigStore) GetWebConfig() map[string]string

func (*ConfigStore) SetConfigIntValueFor added in v0.6.8

func (c *ConfigStore) SetConfigIntValueFor(key string, val int, configtype string) error

func (*ConfigStore) SetConfigValueFor

func (c *ConfigStore) SetConfigValueFor(key string, val string, configtype string) error

func (*ConfigStore) SetDefaultEnv

func (c *ConfigStore) SetDefaultEnv(env string)

type CronjobExecutor added in v0.6.9

type CronjobExecutor interface {
	Execute(attributes map[string]interface{}) error
}

type DaptinError added in v0.5.7

type DaptinError struct {
	Message string
	Code    string
}

func NewDaptinError added in v0.5.7

func NewDaptinError(str string, code string) *DaptinError

func (*DaptinError) Error added in v0.6.9

func (de *DaptinError) Error() string

type DataFileImport added in v0.2.1

type DataFileImport struct {
	FilePath string
	Entity   string
	FileType string
}

func (DataFileImport) String added in v0.2.1

func (s DataFileImport) String() string

type DataValidationMiddleware added in v0.2.1

type DataValidationMiddleware struct {
	// contains filtered or unexported fields
}

func (*DataValidationMiddleware) InterceptAfter added in v0.2.1

func (dvm *DataValidationMiddleware) InterceptAfter(dr *DbResource, req *api2go.Request, results []map[string]interface{}) ([]map[string]interface{}, error)

func (*DataValidationMiddleware) InterceptBefore added in v0.2.1

func (dvm *DataValidationMiddleware) InterceptBefore(dr *DbResource, req *api2go.Request, objects []map[string]interface{}) ([]map[string]interface{}, error)

func (DataValidationMiddleware) String added in v0.2.1

func (dvm DataValidationMiddleware) String() string

type DatabaseRequestInterceptor

type DatabaseRequestInterceptor interface {
	InterceptBefore(*DbResource, *api2go.Request, []map[string]interface{}) ([]map[string]interface{}, error)
	InterceptAfter(*DbResource, *api2go.Request, []map[string]interface{}) ([]map[string]interface{}, error)
	fmt.Stringer
}

func NewCreateEventHandler

func NewCreateEventHandler() DatabaseRequestInterceptor

func NewDataValidationMiddleware added in v0.2.1

func NewDataValidationMiddleware(cmsConfig *CmsConfig, cruds *map[string]*DbResource) DatabaseRequestInterceptor

func NewDeleteEventHandler

func NewDeleteEventHandler() DatabaseRequestInterceptor

func NewExchangeMiddleware

func NewExchangeMiddleware(cmsConfig *CmsConfig, cruds *map[string]*DbResource) DatabaseRequestInterceptor

Creates a new exchange middleware which is responsible for calling external apis on data updates

func NewFindOneEventHandler

func NewFindOneEventHandler() DatabaseRequestInterceptor

func NewUpdateEventHandler

func NewUpdateEventHandler() DatabaseRequestInterceptor

type DbResource

type DbResource struct {
	ActionHandlerMap map[string]ActionPerformerInterface
	// contains filtered or unexported fields
}

func NewDbResource

func NewDbResource(model *api2go.Api2GoModel, db database.DatabaseConnection, ms *MiddlewareSet, cruds map[string]*DbResource, configStore *ConfigStore, tableInfo TableInfo) *DbResource

func (*DbResource) BecomeAdmin

func (dbResource *DbResource) BecomeAdmin(userId int64) bool

make user by integer `userId` int the administrator and owner of everything Check CanBecomeAdmin before invoking this

func (*DbResource) CanBecomeAdmin

func (dbResource *DbResource) CanBecomeAdmin() bool

Check if someone can invoke the become admin action checks if there is only 1 real user in the system No one can become admin once there are two non admin users

func (*DbResource) Create

func (dr *DbResource) Create(obj interface{}, req api2go.Request) (api2go.Responder, error)

func (*DbResource) CreateWithoutFilter added in v0.6.5

func (dr *DbResource) CreateWithoutFilter(obj interface{}, req api2go.Request) (map[string]interface{}, error)

func (*DbResource) DataStats added in v0.6.2

func (dr *DbResource) DataStats(req AggregationRequest) (AggregateData, error)

func (*DbResource) Delete

func (dr *DbResource) Delete(id string, req api2go.Request) (api2go.Responder, error)

func (*DbResource) DeleteWithoutFilters added in v0.6.5

func (dr *DbResource) DeleteWithoutFilters(id string, req api2go.Request) error

func (*DbResource) DirectInsert added in v0.2.1

func (dr *DbResource) DirectInsert(typeName string, data map[string]interface{}) error

Update the data and set the values using the data map without an validation or transformations Invoked by data import action

func (*DbResource) FindOne

func (dr *DbResource) FindOne(referenceId string, req api2go.Request) (api2go.Responder, error)

FindOne returns an object by its ID Possible Responder success status code 200

func (*DbResource) GetActionByName

func (dr *DbResource) GetActionByName(typeName string, actionName string) (Action, error)

Get an Action instance by `typeName` and `actionName` Check Action instance for usage

func (*DbResource) GetActionPermissionByName

func (dr *DbResource) GetActionPermissionByName(worldId int64, actionName string) (PermissionInstance, error)

Get permission of an action by typeId and actionName Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Special utility function for actions, for other objects use GetObjectPermission

func (*DbResource) GetActionsByType

func (dr *DbResource) GetActionsByType(typeName string) ([]Action, error)

Get list of all actions defined on type `typeName` Returns list of `Action`

func (*DbResource) GetAdminEmailId added in v0.6.9

func (dr *DbResource) GetAdminEmailId() string

func (*DbResource) GetAdminReferenceId added in v0.6.9

func (dr *DbResource) GetAdminReferenceId() string

func (*DbResource) GetAllCloudStores added in v0.2.1

func (resource *DbResource) GetAllCloudStores() ([]CloudStore, error)

func (*DbResource) GetAllMarketplaces added in v0.4.0

func (resource *DbResource) GetAllMarketplaces() ([]Marketplace, error)

func (*DbResource) GetAllObjects added in v0.2.1

func (dr *DbResource) GetAllObjects(typeName string) ([]map[string]interface{}, error)

Get all rows from the table `typeName` Returns an array of Map object, each object has the column name to value mapping Utility method for loading all objects having low count Can be used by actions

func (*DbResource) GetAllRawObjects added in v0.2.1

func (dr *DbResource) GetAllRawObjects(typeName string) ([]map[string]interface{}, error)

Get all rows from the table `typeName` without any processing of the response expect no "__type" column on the returned instances Returns an array of Map object, each object has the column name to value mapping Utility method for loading all objects having low count Can be used by actions

func (*DbResource) GetAllSites added in v0.2.1

func (resource *DbResource) GetAllSites() ([]SubSite, error)

func (*DbResource) GetAllTasks added in v0.6.9

func (resource *DbResource) GetAllTasks() ([]Task, error)

func (*DbResource) GetCloudStoreByName added in v0.6.2

func (resource *DbResource) GetCloudStoreByName(name string) (CloudStore, error)

func (*DbResource) GetCloudStoreByReferenceId added in v0.6.9

func (resource *DbResource) GetCloudStoreByReferenceId(referenceID string) (CloudStore, error)

func (*DbResource) GetContext

func (dr *DbResource) GetContext(key string) interface{}

func (*DbResource) GetFileFromCloudStore added in v0.6.2

func (resource *DbResource) GetFileFromCloudStore(data api2go.ForeignKeyData, filesList []map[string]interface{}) (resp []map[string]interface{}, err error)

resolve a file column from data in column to actual file on a cloud store returns a map containing the metadata of the file and the file contents as base64 encoded can be sent to browser to invoke downloading js and data urls

func (*DbResource) GetIdByWhereClause

func (dr *DbResource) GetIdByWhereClause(typeName string, queries ...squirrel.Eq) ([]int64, error)

Load rows from the database of `typeName` with a where clause to filter rows Converts the queries to sql and run query with where clause Returns list of internal database integer ids

func (*DbResource) GetIdToObject

func (dr *DbResource) GetIdToObject(typeName string, id int64) (map[string]interface{}, error)

func (*DbResource) GetIdToReferenceId

func (dr *DbResource) GetIdToReferenceId(typeName string, id int64) (string, error)

Lookup an integer id and return a string reference id of an object of type `typeName`

func (*DbResource) GetMarketplaceByReferenceId added in v0.4.0

func (resource *DbResource) GetMarketplaceByReferenceId(referenceId string) (Marketplace, error)

func (*DbResource) GetOauthDescriptionByTokenId

func (resource *DbResource) GetOauthDescriptionByTokenId(id int64) (*oauth2.Config, error)

func (*DbResource) GetOauthDescriptionByTokenReferenceId added in v0.2.1

func (resource *DbResource) GetOauthDescriptionByTokenReferenceId(referenceId string) (*oauth2.Config, error)

func (*DbResource) GetObjectByWhereClause added in v0.6.9

func (dr *DbResource) GetObjectByWhereClause(typeName string, column string, val string) (map[string]interface{}, error)

func (*DbResource) GetObjectGroupsByObjectId

func (dr *DbResource) GetObjectGroupsByObjectId(objType string, objectId int64) []auth.GroupPermission

func (*DbResource) GetObjectPermission

func (dr *DbResource) GetObjectPermission(objectType string, referenceId string) PermissionInstance

Get permission of an GetObjectPermission by typeName and string referenceId Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Return a NoPermissionToAnyone if no such object exist

func (*DbResource) GetObjectPermissionByWhereClause

func (dr *DbResource) GetObjectPermissionByWhereClause(objectType string, colName string, colValue string) PermissionInstance

Get permission of an GetObjectPermission by typeName and string referenceId with a simple where clause colName = colValue Use carefully Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Return a NoPermissionToAnyone if no such object exist

func (*DbResource) GetObjectUserGroupsByWhere

func (dr *DbResource) GetObjectUserGroupsByWhere(objType string, colName string, colvalue interface{}) []auth.GroupPermission

Get list of group permissions for objects of typeName where colName=colValue Utility method which makes a join query to load a lot of permissions quickly Used by GetRowPermission

func (*DbResource) GetReferenceIdByWhereClause

func (dr *DbResource) GetReferenceIdByWhereClause(typeName string, queries ...squirrel.Eq) ([]string, error)

Load rows from the database of `typeName` with a where clause to filter rows Converts the queries to sql and run query with where clause Returns list of reference_ids

func (*DbResource) GetReferenceIdToId

func (dr *DbResource) GetReferenceIdToId(typeName string, referenceId string) (int64, error)

Lookup an string reference id and return a internal integer id of an object of type `typeName`

func (*DbResource) GetReferenceIdToObject

func (dr *DbResource) GetReferenceIdToObject(typeName string, referenceId string) (map[string]interface{}, error)

Load an object of type `typeName` using a reference_id Used internally, can be used by actions

func (*DbResource) GetRowPermission

func (dr *DbResource) GetRowPermission(row map[string]interface{}) PermissionInstance

func (*DbResource) GetRowsByWhereClause

func (dr *DbResource) GetRowsByWhereClause(typeName string, where ...squirrel.Eq) ([]map[string]interface{}, [][]map[string]interface{}, error)

func (*DbResource) GetSingleColumnValueByReferenceId

func (dr *DbResource) GetSingleColumnValueByReferenceId(typeName string, selectColumn, matchColumn string, values []string) ([]interface{}, error)

select "column" from "typeName" where matchColumn in (values) returns list of values of the column

func (*DbResource) GetSingleRowByReferenceId

func (dr *DbResource) GetSingleRowByReferenceId(typeName string, referenceId string) (map[string]interface{}, []map[string]interface{}, error)

func (*DbResource) GetTokenByTokenId added in v0.2.1

func (resource *DbResource) GetTokenByTokenId(id int64) (*oauth2.Token, error)

func (*DbResource) GetTokenByTokenName added in v0.6.5

func (resource *DbResource) GetTokenByTokenName(name string) (*oauth2.Token, error)

func (*DbResource) GetTokenByTokenReferenceId added in v0.2.1

func (resource *DbResource) GetTokenByTokenReferenceId(referenceId string) (*oauth2.Token, *oauth2.Config, error)

func (*DbResource) GetTotalCount

func (dr *DbResource) GetTotalCount() uint64

func (*DbResource) GetTotalCountBySelectBuilder added in v0.6.0

func (dr *DbResource) GetTotalCountBySelectBuilder(builder squirrel.SelectBuilder) uint64

func (*DbResource) GetUserEmailIdByUsergroupId added in v0.6.9

func (dr *DbResource) GetUserEmailIdByUsergroupId(usergroupId int64) string

func (*DbResource) GetUserGroupIdByUserId

func (dr *DbResource) GetUserGroupIdByUserId(userId int64) uint64

func (*DbResource) GetUserIdByUsergroupId added in v0.6.9

func (dr *DbResource) GetUserIdByUsergroupId(usergroupId int64) string

func (*DbResource) GetUserPassword added in v0.6.5

func (d *DbResource) GetUserPassword(email string) (string, error)

Returns the bCrypt password hash of a user by looking up on email

func (*DbResource) HandleActionRequest added in v0.6.9

func (db *DbResource) HandleActionRequest(actionRequest *ActionRequest, req api2go.Request) ([]ActionResponse, error)

func (*DbResource) IsUserActionAllowed

func (dr *DbResource) IsUserActionAllowed(userReferenceId string, userGroups []auth.GroupPermission, typeName string, actionName string) bool

Check if a user identified by userReferenceId and belonging to userGroups is allowed to invoke an action `actionName` on type `typeName` Called before invoking an action from the /action/** api Checks EXECUTE on both the type and action for this user The permissions can come from different groups

func (*DbResource) NewActiveTaskInstance added in v0.6.9

func (db *DbResource) NewActiveTaskInstance(task Task) *ActiveTaskInstance

func (*DbResource) PaginatedFindAll

func (dr *DbResource) PaginatedFindAll(req api2go.Request) (totalCount uint, response api2go.Responder, err error)

func (*DbResource) PaginatedFindAllWithoutFilters added in v0.6.5

func (dr *DbResource) PaginatedFindAllWithoutFilters(req api2go.Request) ([]map[string]interface{}, [][]map[string]interface{}, *PaginationData, error)

PaginatedFindAll(req Request) (totalCount uint, response Responder, err error)

func (*DbResource) PutContext

func (dr *DbResource) PutContext(key string, val interface{})

func (*DbResource) ResultToArrayOfMap

func (dr *DbResource) ResultToArrayOfMap(rows *sqlx.Rows, columnMap map[string]api2go.ColumnInfo, includedRelationMap map[string]bool) ([]map[string]interface{}, [][]map[string]interface{}, error)

convert the result of db.QueryRowx => rows to array of data fetches the related objects also expects columnMap to be fetched from rows check usage in exiting source for example includeRelationMap can be nil to include none or map[string]bool{"*": true} to include all relations can be used on any *sqlx.Rows

func (*DbResource) ResultToArrayOfMapRaw added in v0.2.1

func (dr *DbResource) ResultToArrayOfMapRaw(rows *sqlx.Rows, columnMap map[string]api2go.ColumnInfo) ([]map[string]interface{}, error)

convert the result of db.QueryRowx => rows to array of data can be used on any *sqlx.Rows and assign a typeName calls RowsToMap with the current model name

func (*DbResource) StoreToken added in v0.6.5

func (dr *DbResource) StoreToken(token *oauth2.Token, token_type string, oauth_connect_reference_id string) error

func (*DbResource) SyncStorageToPath added in v0.6.9

func (res *DbResource) SyncStorageToPath(cloudStore CloudStore, tempDirectoryPath string) error

func (*DbResource) TruncateTable added in v0.2.1

func (dr *DbResource) TruncateTable(typeName string) error

func (*DbResource) Update

func (dr *DbResource) Update(obj interface{}, req api2go.Request) (api2go.Responder, error)

func (*DbResource) UpdateAccessTokenByTokenId added in v0.2.1

func (resource *DbResource) UpdateAccessTokenByTokenId(id int64, accessToken string, expiresIn int64) error

func (*DbResource) UpdateAccessTokenByTokenReferenceId added in v0.2.1

func (resource *DbResource) UpdateAccessTokenByTokenReferenceId(referenceId string, accessToken string, expiresIn int64) error

func (*DbResource) UpdateWithoutFilters added in v0.6.5

func (dr *DbResource) UpdateWithoutFilters(obj interface{}, req api2go.Request) (map[string]interface{}, error)

Update an object Possible Responder status codes are: - 200 OK: Update successful, however some field(s) were changed, returns updates source - 202 Accepted: Processing is delayed, return nothing - 204 No Content: Update was successful, no fields were changed by the server, return nothing

func (*DbResource) UserGroupNameToId added in v0.6.5

func (dbResource *DbResource) UserGroupNameToId(groupName string) (uint64, error)

Convert group name to the internal integer id should not be used since group names are not unique deprecated

type DefaultTaskScheduler added in v0.6.9

type DefaultTaskScheduler struct {
	// contains filtered or unexported fields
}

func (*DefaultTaskScheduler) AddTask added in v0.6.9

func (dts *DefaultTaskScheduler) AddTask(task Task) error

func (*DefaultTaskScheduler) StartTasks added in v0.6.9

func (dts *DefaultTaskScheduler) StartTasks()

type DownloadCmsConfigActionPerformer

type DownloadCmsConfigActionPerformer struct {
	// contains filtered or unexported fields
}

func (*DownloadCmsConfigActionPerformer) DoAction

func (d *DownloadCmsConfigActionPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*DownloadCmsConfigActionPerformer) Name

type ExchangeContract

type ExchangeContract struct {
	Name             string
	SourceAttributes map[string]interface{} `db:"source_attributes"`
	SourceType       string                 `db:"source_type"`
	TargetAttributes map[string]interface{} `db:"target_attributes"`
	TargetType       string                 `db:"target_type"`
	Attributes       []ColumnMap            `db:"attributes"`
	Options          map[string]interface{}
	ReferenceId      string `db:"reference_id"`
	OauthTokenId     *int64 `db:"oauth_token_id"`
}

type ExchangeExecution

type ExchangeExecution struct {
	ExchangeContract ExchangeContract
	// contains filtered or unexported fields
}

func NewExchangeExecution

func NewExchangeExecution(exchange ExchangeContract, oauthToken *oauth2.Token, oauthConfig *oauth2.Config) *ExchangeExecution

func (*ExchangeExecution) Execute

func (ec *ExchangeExecution) Execute(inFields map[string]interface{}, data []map[string]interface{}) (err error)

type ExchangeInterface

type ExchangeInterface interface {
	Update(target string, data []map[string]interface{}) error
}

type ExportCsvDataPerformer added in v0.6.9

type ExportCsvDataPerformer struct {
	// contains filtered or unexported fields
}

func (*ExportCsvDataPerformer) DoAction added in v0.6.9

func (d *ExportCsvDataPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*ExportCsvDataPerformer) Name added in v0.6.9

func (d *ExportCsvDataPerformer) Name() string

type ExportDataPerformer added in v0.2.1

type ExportDataPerformer struct {
	// contains filtered or unexported fields
}

func (*ExportDataPerformer) DoAction added in v0.2.1

func (d *ExportDataPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*ExportDataPerformer) Name added in v0.2.1

func (d *ExportDataPerformer) Name() string

type ExternalExchange

type ExternalExchange interface {
	ExecuteTarget(row map[string]interface{}, inFieldMap map[string]interface{}) error
}

func NewRestExchangeHandler

func NewRestExchangeHandler(exchangeContext ExchangeContract, oauthToken *oauth2.Token, oauthConfig *oauth2.Config) (ExternalExchange, error)

type Faker added in v0.2.1

type Faker interface {
	Fake() string
}

type FileUploadActionPerformer added in v0.2.1

type FileUploadActionPerformer struct {
	// contains filtered or unexported fields
}

func (*FileUploadActionPerformer) DoAction added in v0.2.1

func (d *FileUploadActionPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*FileUploadActionPerformer) Name added in v0.2.1

type FsmManager

type FsmManager interface {
	ApplyEvent(subject map[string]interface{}, stateMachineEvent StateMachineEvent) (string, error)
}

func NewFsmManager

func NewFsmManager(db database.DatabaseConnection, cruds map[string]*DbResource) FsmManager

type GenerateJwtTokenActionPerformer

type GenerateJwtTokenActionPerformer struct {
	// contains filtered or unexported fields
}

func (*GenerateJwtTokenActionPerformer) DoAction

func (d *GenerateJwtTokenActionPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*GenerateJwtTokenActionPerformer) Name

type GenerateOauth2TokenActionPerformer added in v0.7.0

type GenerateOauth2TokenActionPerformer struct {
	// contains filtered or unexported fields
}

func (*GenerateOauth2TokenActionPerformer) DoAction added in v0.7.0

func (d *GenerateOauth2TokenActionPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*GenerateOauth2TokenActionPerformer) Name added in v0.7.0

type Group added in v0.6.8

type Group struct {
	ColumnName string `json:"column"`
	Order      string `json:"order"`
}

type ImportDataPerformer added in v0.2.1

type ImportDataPerformer struct {
	// contains filtered or unexported fields
}

func (*ImportDataPerformer) DoAction added in v0.2.1

func (d *ImportDataPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*ImportDataPerformer) Name added in v0.2.1

func (d *ImportDataPerformer) Name() string

type LoopbackEventDesc

type LoopbackEventDesc struct {
	// Name is the event name used when calling for a transition.
	Name  string
	Label string
	Color string

	// Src is a slice of source states that the FSM must be in to perform a
	// state transition.
	Src []string

	// Dst is the destination state that the FSM will be in if the transition
	// succeeds.
	Dst string
}

type LoopbookFsmDescription

type LoopbookFsmDescription struct {
	InitialState string
	Name         string
	Label        string
	Events       []LoopbackEventDesc
}

type MakeResponsePerformer added in v0.7.0

type MakeResponsePerformer struct {
}

*

Become administrator of daptin action implementation

func (*MakeResponsePerformer) DoAction added in v0.7.0

func (d *MakeResponsePerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

Perform action and try to make the current user the admin of the system Checks CanBecomeAdmin and then invokes BecomeAdmin if true

func (*MakeResponsePerformer) Name added in v0.7.0

func (d *MakeResponsePerformer) Name() string

Name of the action

type MarketPackage added in v0.4.0

type MarketPackage struct {
	Name     string
	Summary  string
	Location string
}

type Marketplace added in v0.4.0

type Marketplace struct {
	Endpoint    string
	RootPath    string `db:"root_path"`
	Name        string `db:"name"`
	Permission  int    `json:"-"`
	UserId      *int   `json:"-" db:"user_account_id"`
	ReferenceId string `json:"-" db:"reference_id"`
}

type MarketplacePackageInstallActionPerformer added in v0.4.0

type MarketplacePackageInstallActionPerformer struct {
	// contains filtered or unexported fields
}

func (*MarketplacePackageInstallActionPerformer) DoAction added in v0.4.0

func (d *MarketplacePackageInstallActionPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*MarketplacePackageInstallActionPerformer) Name added in v0.4.0

type MarketplaceService added in v0.4.0

type MarketplaceService struct {
	Marketplace Marketplace
	// contains filtered or unexported fields
}

func NewMarketplaceService added in v0.4.0

func NewMarketplaceService(marketplace Marketplace) (*MarketplaceService, error)

func (*MarketplaceService) GetPackage added in v0.4.0

func (mp *MarketplaceService) GetPackage(packageName string) *MarketPackage

func (*MarketplaceService) GetPackageList added in v0.4.0

func (mp *MarketplaceService) GetPackageList() ([]MarketPackage, error)

func (*MarketplaceService) PackageExists added in v0.4.0

func (mp *MarketplaceService) PackageExists(packageName string) bool

func (*MarketplaceService) RefreshRepository added in v0.4.0

func (mp *MarketplaceService) RefreshRepository() error

type MiddlewareSet

type MiddlewareSet struct {
	BeforeCreate  []DatabaseRequestInterceptor
	BeforeFindAll []DatabaseRequestInterceptor
	BeforeFindOne []DatabaseRequestInterceptor
	BeforeUpdate  []DatabaseRequestInterceptor
	BeforeDelete  []DatabaseRequestInterceptor

	AfterCreate  []DatabaseRequestInterceptor
	AfterFindAll []DatabaseRequestInterceptor
	AfterFindOne []DatabaseRequestInterceptor
	AfterUpdate  []DatabaseRequestInterceptor
	AfterDelete  []DatabaseRequestInterceptor
}

type NetworkRequestActionPerformer added in v0.6.0

type NetworkRequestActionPerformer struct {
	// contains filtered or unexported fields
}

func (*NetworkRequestActionPerformer) DoAction added in v0.6.0

func (d *NetworkRequestActionPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*NetworkRequestActionPerformer) Name added in v0.6.0

type OauthLoginBeginActionPerformer

type OauthLoginBeginActionPerformer struct {
	// contains filtered or unexported fields
}

func (*OauthLoginBeginActionPerformer) DoAction

func (d *OauthLoginBeginActionPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*OauthLoginBeginActionPerformer) Name

type OauthLoginResponseActionPerformer

type OauthLoginResponseActionPerformer struct {
	// contains filtered or unexported fields
}

func (*OauthLoginResponseActionPerformer) DoAction

func (d *OauthLoginResponseActionPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*OauthLoginResponseActionPerformer) Name

type ObjectAccessPermissionChecker added in v0.2.1

type ObjectAccessPermissionChecker struct {
}

func (*ObjectAccessPermissionChecker) InterceptAfter added in v0.2.1

func (pc *ObjectAccessPermissionChecker) InterceptAfter(dr *DbResource, req *api2go.Request, results []map[string]interface{}) ([]map[string]interface{}, error)

func (*ObjectAccessPermissionChecker) InterceptBefore added in v0.2.1

func (pc *ObjectAccessPermissionChecker) InterceptBefore(dr *DbResource, req *api2go.Request, results []map[string]interface{}) ([]map[string]interface{}, error)

func (*ObjectAccessPermissionChecker) String added in v0.2.1

type OuathProfileExchangePerformer added in v0.6.0

type OuathProfileExchangePerformer struct {
	// contains filtered or unexported fields
}

func (*OuathProfileExchangePerformer) DoAction added in v0.6.0

func (d *OuathProfileExchangePerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*OuathProfileExchangePerformer) Name added in v0.6.0

type Outcome

type Outcome struct {
	Type           string
	Method         string
	Reference      string
	SkipInResponse bool
	Condition      string
	Attributes     map[string]interface{}
}

Outcome is call to a internal function with attributes as parameters Outcome has a particular `type`, it can be one of the data entities already defined Method is the type of outcome: GET/PUT/POST/DELETE/UPDATE/PATCH/EXECUTE Condition can be specified in JS to be checked, false condition will skip processing the outcome set SkipInResponse to true to not include action outcome in the http response of the action call reference is a name you can assign to the outcome of, which can be used in furthur chained outcomes Attributes is a map of string to interface{} which will be used by the action The attributes are evaluated to generate the actual data to be sent to execution JS scripting can be used to reference existing outcomes by reference names

type PaginationData added in v0.6.5

type PaginationData struct {
	PageNumber uint64
	PageSize   uint64
	TotalCount uint64
}

type PermissionInstance added in v0.5.7

type PermissionInstance struct {
	UserId      string
	UserGroupId []auth.GroupPermission
	Permission  auth.ObjectPermission
}

func (PermissionInstance) CanCreate added in v0.5.7

func (p PermissionInstance) CanCreate(userId string, usergroupId []auth.GroupPermission) bool

func (PermissionInstance) CanDelete added in v0.5.7

func (p PermissionInstance) CanDelete(userId string, usergroupId []auth.GroupPermission) bool

func (PermissionInstance) CanExecute added in v0.5.7

func (p PermissionInstance) CanExecute(userId string, usergroupId []auth.GroupPermission) bool

func (PermissionInstance) CanPeek added in v0.5.7

func (p PermissionInstance) CanPeek(userId string, usergroupId []auth.GroupPermission) bool

func (PermissionInstance) CanRead added in v0.5.7

func (p PermissionInstance) CanRead(userId string, usergroupId []auth.GroupPermission) bool

func (PermissionInstance) CanRefer added in v0.5.7

func (p PermissionInstance) CanRefer(userId string, usergroupId []auth.GroupPermission) bool

func (PermissionInstance) CanUpdate added in v0.5.7

func (p PermissionInstance) CanUpdate(userId string, usergroupId []auth.GroupPermission) bool

func (PermissionInstance) CheckBit added in v0.5.7

func (p1 PermissionInstance) CheckBit(userId string, usergroupId []auth.GroupPermission, bit auth.AuthPermission) bool

type Query added in v0.6.8

type Query struct {
	ColumnName string      `json:"column"`
	Operator   string      `json:"operator"`
	Value      interface{} `json:"value"`
}

type RandomDataGeneratePerformer added in v0.4.0

type RandomDataGeneratePerformer struct {
	// contains filtered or unexported fields
}

func (*RandomDataGeneratePerformer) DoAction added in v0.4.0

func (d *RandomDataGeneratePerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*RandomDataGeneratePerformer) Name added in v0.4.0

type RefreshMarketplacePackagelistPerformer added in v0.4.0

type RefreshMarketplacePackagelistPerformer struct {
	// contains filtered or unexported fields
}

func (*RefreshMarketplacePackagelistPerformer) DoAction added in v0.4.0

func (d *RefreshMarketplacePackagelistPerformer) DoAction(request ActionRequest, inFieldMap map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*RefreshMarketplacePackagelistPerformer) Name added in v0.4.0

type RestExchange

type RestExchange struct {
	Name        string
	Method      string
	Url         string
	Headers     map[string]interface{}
	Body        map[string]interface{}
	QueryParams map[string]interface{}
}

type RestExternalExchange

type RestExternalExchange struct {
	// contains filtered or unexported fields
}

func (*RestExternalExchange) ExecuteTarget

func (g *RestExternalExchange) ExecuteTarget(row map[string]interface{}, inFieldMap map[string]interface{}) error

type RestartSystemActionPerformer

type RestartSystemActionPerformer struct {
	// contains filtered or unexported fields
}

func (*RestartSystemActionPerformer) DoAction

func (d *RestartSystemActionPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*RestartSystemActionPerformer) Name

type StateMachineEvent

type StateMachineEvent interface {
	GetStateMachineInstanceId() string
	GetEventName() string
}

func NewStateMachineEvent added in v0.2.1

func NewStateMachineEvent(machineId string, eventName string) StateMachineEvent

type StateMachineInstance

type StateMachineInstance struct {
	CurrestState   string
	StateMachineId int64
	ObjectId       int64
}

type StatusResponse

type StatusResponse struct {
	Message string
}

type StreamContract added in v0.4.0

type StreamContract struct {
	StreamName      string
	RootEntityName  string
	Columns         []api2go.ColumnInfo
	Relations       []api2go.TableRelation
	Transformations []Transformation
	QueryParams     map[string][]string
}

Stream contract defines column mappings and transformations. Also includes the query params which are to be used in the first place

type StreamProcessor added in v0.4.0

type StreamProcessor struct {
	// contains filtered or unexported fields
}

StreamProcess handles the Read operations, and applies transformations on the data the create a new view

func NewStreamProcessor added in v0.4.0

func NewStreamProcessor(stream StreamContract, cruds map[string]*DbResource) *StreamProcessor

Creates a new stream processor which will apply the given contract

func (*StreamProcessor) Create added in v0.4.0

func (dr *StreamProcessor) Create(obj interface{}, req api2go.Request) (api2go.Responder, error)

Create implementation in accordance with JSONAPI Create is not implemented for streams

func (*StreamProcessor) Delete added in v0.4.0

func (dr *StreamProcessor) Delete(id string, req api2go.Request) (api2go.Responder, error)

Delete implementation in accordance with JSONAPI Delete is not implemented for streams

func (*StreamProcessor) FindOne added in v0.4.0

func (dr *StreamProcessor) FindOne(ID string, req api2go.Request) (api2go.Responder, error)

FindOne implementation in accordance with JSONAPI FindOne is not implemented for streams

func (*StreamProcessor) GetContract added in v0.4.0

func (dr *StreamProcessor) GetContract() StreamContract

Get the contract

func (*StreamProcessor) PaginatedFindAll added in v0.4.0

func (dr *StreamProcessor) PaginatedFindAll(req api2go.Request) (totalCount uint, response api2go.Responder, err error)

FindAll implementation in accordance with JSONAPI FindAll does the initial query to the database and applites the transformation contract on the result rows

func (*StreamProcessor) Update added in v0.4.0

func (dr *StreamProcessor) Update(obj interface{}, req api2go.Request) (api2go.Responder, error)

Update implementation in accordance with JSONAPI Update is not implemented for streams

type SubSite added in v0.2.1

type SubSite struct {
	Id           int64
	Name         string
	Hostname     string
	Path         string
	CloudStoreId *int64 `db:"cloud_store_id"`
	Permission   PermissionInstance
	UserId       *int64 `db:"user_account_id"`
	ReferenceId  string `db:"reference_id"`
}

type SubSiteInformation added in v0.2.1

type SubSiteInformation struct {
	SubSite    SubSite
	CloudStore CloudStore
	SourceRoot string
}

type SyncSiteStorageActionPerformer added in v0.6.9

type SyncSiteStorageActionPerformer struct {
	// contains filtered or unexported fields
}

func (*SyncSiteStorageActionPerformer) DoAction added in v0.6.9

func (d *SyncSiteStorageActionPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*SyncSiteStorageActionPerformer) Name added in v0.6.9

type TableAccessPermissionChecker

type TableAccessPermissionChecker struct {
}

The TableAccessPermissionChecker middleware is resposible for entity level authorization check, before and after the changes

func (*TableAccessPermissionChecker) InterceptAfter

func (pc *TableAccessPermissionChecker) InterceptAfter(dr *DbResource, req *api2go.Request, results []map[string]interface{}) ([]map[string]interface{}, error)

Intercept after check implements if the data should be returned after the data change is complete

func (*TableAccessPermissionChecker) InterceptBefore

func (pc *TableAccessPermissionChecker) InterceptBefore(dr *DbResource, req *api2go.Request, results []map[string]interface{}) ([]map[string]interface{}, error)

Intercept before implemetation for entity level authentication check

func (*TableAccessPermissionChecker) String

func (pc *TableAccessPermissionChecker) String() string

type TableInfo

type TableInfo struct {
	TableName              string `db:"table_name"`
	TableId                int
	DefaultPermission      int64 `db:"default_permission"`
	Columns                []api2go.ColumnInfo
	StateMachines          []LoopbookFsmDescription
	Relations              []api2go.TableRelation
	IsTopLevel             bool `db:"is_top_level"`
	Permission             int64
	UserId                 uint64   `db:"user_account_id"`
	IsHidden               bool     `db:"is_hidden"`
	IsJoinTable            bool     `db:"is_join_table"`
	IsStateTrackingEnabled bool     `db:"is_state_tracking_enabled"`
	IsAuditEnabled         bool     `db:"is_audit_enabled"`
	DefaultGroups          []string `db:"default_groups"`
	Validations            []ColumnTag
	Conformations          []ColumnTag
	DefaultOrder           string
	Icon                   string
}

func (*TableInfo) AddRelation added in v0.5.7

func (ti *TableInfo) AddRelation(relations ...api2go.TableRelation)

func (*TableInfo) GetColumnByName added in v0.6.6

func (ti *TableInfo) GetColumnByName(name string) (*api2go.ColumnInfo, bool)

type Task added in v0.6.9

type Task struct {
	Id             int64
	ReferenceId    string
	Schedule       string
	Active         bool
	Name           string
	Attributes     map[string]interface{}
	AsUserEmail    string
	ActionName     string
	EntityName     string
	AttributesJson string
}

func GetTasks added in v0.6.9

func GetTasks(connection database.DatabaseConnection) ([]Task, error)

type TaskScheduler added in v0.6.9

type TaskScheduler interface {
	StartTasks()
	AddTask(task Task) error
}

func NewTaskScheduler added in v0.6.9

func NewTaskScheduler(cmsConfig *CmsConfig, cruds map[string]*DbResource, configStore *ConfigStore) TaskScheduler

type TimeStamp added in v0.6.2

type TimeStamp string

type TokenResponse added in v0.6.5

type TokenResponse struct {
	oauth2.Token
	Scope string
}

type Transformation added in v0.4.0

type Transformation struct {
	Operation  string
	Attributes map[string]interface{}
}

A Transformation is the representation of column data changing its values according to the attribute map

type UploadCsvFileToEntityPerformer added in v0.6.6

type UploadCsvFileToEntityPerformer struct {
	// contains filtered or unexported fields
}

func (*UploadCsvFileToEntityPerformer) DoAction added in v0.6.6

func (d *UploadCsvFileToEntityPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*UploadCsvFileToEntityPerformer) Name added in v0.6.6

type UploadXlsFileToEntityPerformer added in v0.6.6

type UploadXlsFileToEntityPerformer struct {
	// contains filtered or unexported fields
}

func (*UploadXlsFileToEntityPerformer) DoAction added in v0.6.6

func (d *UploadXlsFileToEntityPerformer) DoAction(request ActionRequest, inFields map[string]interface{}) (api2go.Responder, []ActionResponse, []error)

func (*UploadXlsFileToEntityPerformer) Name added in v0.6.6

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL