jslibHelper

package
v0.0.0-...-08474b0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IsCacheReady bool
	JslibCache   sync.Map
)

Functions

func GetJsFunsParams

func GetJsFunsParams(runtime *goja.Runtime, funName string) (res string, err error)

func InitJslibCache

func InitJslibCache(tenantId consts.TenantId) (err error)

func LoadCacheIfNeeded

func LoadCacheIfNeeded(tenantId consts.TenantId) (err error)

func LoadServerJslibs

func LoadServerJslibs(tenantId consts.TenantId, runtime *goja.Runtime, require *require.RequireModule, projectId uint)

func SetJslibCache

func SetJslibCache(tenantId consts.TenantId, id uint, val Jslib)

Types

type JsFunc

type JsFunc struct {
	Name string `json:"name"`
	Args string `json:"args"`
}

type Jslib

type Jslib struct {
	Id uint `json:"id"`

	Name      string    `json:"name"`
	Desc      string    `json:"desc"`
	Script    string    `json:"script" gorm:"type:text"`
	ProjectId uint      `json:"projectId"`
	UpdatedAt time.Time `json:"updatedAt"`
	Functions []JsFunc
}

func GetJslibCache

func GetJslibCache(tenantId consts.TenantId, id uint) (val Jslib)

type SysJslib

type SysJslib struct {
	ID        uint       `gorm:"primary_key" sql:"type:INT(10) UNSIGNED NOT NULL" json:"id"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`

	Deleted  bool `json:"-" gorm:"default:false"`
	Disabled bool `json:"disabled,omitempty" gorm:"default:false"`

	Name       string `json:"name"`
	ScriptFile string `json:"scriptFile" gorm:"type:text" validate:"required"`
	TypesFile  string `json:"typesFile" gorm:"type:text"`

	CreateUser string `json:"createUser"`
	UpdateUser string `json:"updateUser"`

	ProjectId uint `json:"projectId"`
}

func (SysJslib) TableName

func (SysJslib) TableName() string

Jump to

Keyboard shortcuts

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