resource

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApplyLogger hclog.Logger = logger.HcLog().Named("apply")
View Source
var ImportLogger hclog.Logger = logger.HcLog().Named("import")
View Source
var LoadLogger hclog.Logger = logger.HcLog().Named("import.load")

Functions

func Apply

func Apply(flags *Flags, config *raiden.Config) error

Migrate resource :

[ ] migrate table

[x] create table name, schema and columns
[x] create table rls enable
[x] create table rls force
[x] create table with primary key
[x] create table with relation (ordered table by relation)
[x] create table with acl (rls)
[x] delete table (cascade)
[x] update table name, schema
[x] update table rls enable
[x] update table rls force
[x] update table with relation - create, update and delete (ordered table by relation)
[x] create table with acl (rls), for now all rls outside manage from raiden will be delete
[x] update table column add new column
[x] update table column delete column
[x] update table column set default schema
[x] update table column set set data type
[x] update table column set unique column
[x] update table column set nullable

[ ] migrate role

[x] create new role
[x] create role with connection limit
[x] create role with inherit
[ ] create role with is replicate - unsupported now because need superuser role
[ ] create role with is super user - unsupported now because need superuser role
[x] create role with can bypass rls, can create db, can create role, can login
[x] create role with valid until
[x] delete role
[ ] update name
[x] update connection limit
[x] update inherit
[ ] update is replicate
[ ] update is super user
[x] update can bypass rls
[x] update can create db
[x] update can create role
[x] update can login
[x] update valid until

[x] migrate function (Rpc)

[x] migrate storage

[x] create new storage
[x] update storage
[x] delete storage
[ ] add storage acl
[ ] update storage acl

func FindImportResource

func FindImportResource[T any](data []T, input generator.GenerateInput, findFunc func(item T, inputData generator.GenerateInput) bool) (item T, found bool)

func Import

func Import(flags *Flags, config *raiden.Config) error

List of import resource [x] import table, relation, column specification and acl [x] import role [x] import function [x] import storage

func ImportDecorateFunc

func ImportDecorateFunc[T any](data []T, findFunc func(T, generator.GenerateInput) bool, stateChan chan any) generator.GenerateFn

func Migrate

func Migrate(config *raiden.Config, importState *state.LocalState, projectPath string, resource *MigrateData) (errors []error)

func PreRun

func PreRun(projectPath string) error

func PrintApplyChangeReport

func PrintApplyChangeReport(migrateData MigrateData)

func PrintImportReport

func PrintImportReport(report ImportReport, dryRun bool)

func RegisterModels

func RegisterModels(list ...any)

func RegisterRole

func RegisterRole(list ...raiden.Role)

func RegisterRpc

func RegisterRpc(list ...raiden.Rpc)

func RegisterStorages

func RegisterStorages(list ...raiden.Bucket)

func UpdateLocalStateFromApply

func UpdateLocalStateFromApply(projectPath string, localState *state.LocalState, stateChan chan any) (done chan error)

func UpdateLocalStateFromImport

func UpdateLocalStateFromImport(localState *state.LocalState, stateChan chan any) (done chan error)

----- Update imported data in local state -----

Types

type Flags

type Flags struct {
	ProjectPath   string
	RpcOnly       bool
	RolesOnly     bool
	ModelsOnly    bool
	StoragesOnly  bool
	AllowedSchema string
	DebugMode     bool
	TraceMode     bool
	Generate      generate.Flags
	DryRun        bool
}

Flags is struct to binding options when import and apply is run binart

func (*Flags) All

func (f *Flags) All() bool

LoadAll is function to check is all resource need to import or apply

func (*Flags) BindLog

func (f *Flags) BindLog(cmd *cobra.Command)

func (Flags) CheckAndActivateDebug

func (f Flags) CheckAndActivateDebug(cmd *cobra.Command)

type ImportReport

type ImportReport struct {
	Table   int
	Role    int
	Rpc     int
	Storage int
}

----- Print import report -----

type MigrateData

type MigrateData struct {
	Tables   []tables.MigrateItem
	Roles    []roles.MigrateItem
	Rpc      []rpc.MigrateItem
	Policies []policies.MigrateItem
	Storages []storages.MigrateItem
}

type Resource

type Resource struct {
	Tables    []objects.Table
	Policies  objects.Policies
	Roles     []objects.Role
	Functions []objects.Function
	Storages  []objects.Bucket
}

func Load

func Load(flags *Flags, cfg *raiden.Config) (*Resource, error)

The Load function loads resources based on the provided flags and project ID, and returns a resource objects or an error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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