easyjs

package
v0.0.0-...-3241ae0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

* @Author: wangjun haodreams@163.com * @Date: 2024-11-06 22:14:40 * @LastEditors: wangjun haodreams@163.com * @LastEditTime: 2024-11-18 23:08:45 * @FilePath: \ai_tradee:\go\src\gitee.com\haodreams\golib\easyjs\dayjs.go * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE

* @Author: wangjun haodreams@163.com * @Date: 2024-11-05 22:32:47 * @LastEditors: wangjun haodreams@163.com * @LastEditTime: 2024-11-20 09:52:27 * @FilePath: \golib\easyjs\easyjs.go * @Description: 这个包比js包更合理更科学

* @Author: wangjun haodreams@163.com * @Date: 2024-11-06 23:35:14 * @LastEditors: wangjun haodreams@163.com * @LastEditTime: 2024-11-24 12:53:33 * @FilePath: \golib\easyjs\iconv.go * @Description: 数据转换

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConverJsType

func ConverJsType(t string) string

func Exports

func Exports(obj any) string

func GetJsDir

func GetJsDir() string

func Init

func Init(vm *goja.Runtime)

YYYY/MM/DD HH:mm:ss 初始化js需要的组件

func NewDayjs

func NewDayjs(vm *goja.Runtime, arg any) *goja.Object

func ParseTime

func ParseTime(arg any) int64

解析时间,返回毫秒

func Register

func Register(vm *goja.Runtime, objs ...any)

注册一个对象 性能测试结果看 go的对象比js对象性能高

func RunScript

func RunScript(vm *goja.Runtime, name string, src string) (goja.Value, error)

需要用这个替换已有的

func SetJsDir

func SetJsDir(dir string)

func Stack

func Stack(vm *goja.Runtime) string

Types

type Dayjs

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

func (*Dayjs) Export

func (m *Dayjs) Export() string

func (*Dayjs) Format

func (m *Dayjs) Format(fmt string) string

func (*Dayjs) Name

func (m *Dayjs) Name() string

type Exporter

type Exporter interface {
	Export() string
}

type Iconv

type Iconv struct {
}

数据转换

func (*Iconv) GBK

func (m *Iconv) GBK(text string) string

UTF8 转 GBK 编码

func (*Iconv) UTF8

func (m *Iconv) UTF8(text string) string

GBK 转 UTF8 编码

type Namer

type Namer interface {
	Name() string
}

type System

type System struct {
}

func (*System) AppendFile

func (m *System) AppendFile(path, data string) any

*

  • @description: 追加的方式文件
  • @param {*} path
  • @param {string} data
  • @return {*}

func (*System) Copy

func (m *System) Copy(text string)

复制到剪切板

func (*System) CreateProcess

func (m *System) CreateProcess(binPath string) int

获取一个进程的PID

func (*System) Exit

func (m *System) Exit()

系统退出函数

func (*System) FileModiTime

func (m *System) FileModiTime(path string) int64

*

  • @description: 获取文件的更新时间
  • @param {string} path
  • @return {*}

func (*System) GET

func (m *System) GET(url string) any

func (*System) GetValue

func (m *System) GetValue(key string) string

*

  • @description: 获取配置文件
  • @param {string} key
  • @return {*}

func (*System) IsDir

func (m *System) IsDir(path string) bool

*

  • @description: 是否是一个目录
  • @param {string} path
  • @return {*}

func (*System) IsExist

func (m *System) IsExist(path string) bool

*

  • @description: 文件或目录是否存在
  • @param {string} path
  • @return {*}

func (*System) IsFile

func (m *System) IsFile(path string) bool

*

  • @description: 是否是一个文件
  • @param {string} path
  • @return {*}

func (*System) IsTradeDay

func (m *System) IsTradeDay() bool

是否是交易日

func (*System) IsWorkday

func (m *System) IsWorkday() bool

是否是工作日

func (*System) Kill

func (m *System) Kill(pid int) any

获取一个进程的PID

func (*System) Mkdir

func (m *System) Mkdir(path string) bool

*

  • @description: 新建一个目录
  • @param {string} path
  • @return {*}

func (*System) Name

func (m *System) Name() string

func (*System) POST

func (m *System) POST(url string, jsdata string) any

func (*System) PostJSON

func (m *System) PostJSON(url string, jsdata string) any

func (*System) ReadDir

func (m *System) ReadDir(path string) (paths []string)

读取文件目录

func (*System) ReadFile

func (m *System) ReadFile(path, msg string) any

读取文件

func (*System) ReadLines

func (m *System) ReadLines(path, msg string) []string

读取全部行,出错显示msg+错误提示

func (*System) Remove

func (m *System) Remove(path string) any

*

  • @description: 删除文件
  • @param {string} path
  • @return {*}

func (*System) RemoveFile

func (m *System) RemoveFile(path string) any

*

  • @description: 读取文件的内容
  • @param {string} path
  • @return {*}

func (*System) Sleep

func (m *System) Sleep(ms int)

func (*System) WriteFile

func (m *System) WriteFile(path, data string) any

*

  • @description: 写文件
  • @param {*} path
  • @param {string} data
  • @return {*}

Directories

Path Synopsis
* @Date: 2021-08-15 23:11:38 * @LastEditors: wangjun haodreams@163.com * @LastEditTime: 2024-11-01 09:27:25 * @FilePath: \golib\js\jstask\boss.go * @Description:
* @Date: 2021-08-15 23:11:38 * @LastEditors: wangjun haodreams@163.com * @LastEditTime: 2024-11-01 09:27:25 * @FilePath: \golib\js\jstask\boss.go * @Description:

Jump to

Keyboard shortcuts

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