more-kit

module
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT

README

more-kit

Less can be more.

Install

go install gitee.com/Leftyer/more-kit@latest

Quick Start

 # version
 morekit -v 0.1.6


# reference
import "gitee.com/Leftyer/more-kit/pkg/morekit"

Library Usage

# /*---------------  Comp Area ---------------*/

# lossless WebP compression
_ = morekit.CompImage("photo.png", "photo.webp", 3)



# /*---------------  Device Area ---------------*/

# Platform info
_ = morekit.DeviceGetInfo()

# Device ID
_ = morekit.DeviceGetId()

# Device Name
_ = morekit.DeviceGetName()

# Boot Time
_ = morekit.DeviceGetBootTime()

# BIOS UUID
_ = morekit.DeviceGetBIOSUUID()

# CPU Name
_ = morekit.DeviceGetCPUName()

# CPU Cores
_ = morekit.DeviceGetCPUCores()

# Memory GB
_ = morekit.DeviceGetMemoryGB()

# Disk Total GB
_ = morekit.DeviceGetDiskTotalGB()

# IP List
_ = morekit.DeviceGetIPList()

# MAC List
_ = morekit.DeviceGetMACList()

# Default IP
_ = morekit.DeviceGetDefaultIP()



# /*---------------  Folder Area ---------------*/

# Folder exist 0:no clear 1:clear
_ = morekit.FolderIsExist("/tmp", 0)

# Folder copy
_ = morekit.FolderCopy("./input", "./output")

# Folder clear
_ = morekit.FolderClear("./input")



# /*---------------  File Area ---------------*/

# File exist
_ = morekit.FileIsExist("note.txt")

# File copy
_ = morekit.FileCopy("src.txt", "dst.txt")

# File read
_, _ = morekit.FileRead("note.txt")

# File write
_ = morekit.FileWrite("note.txt", "hello")



# /*---------------  Json Area ---------------*/

# Json write
_ = morekit.JsonWrite("cfg.json", struct{ Host string }{"localhost"})

# Json read
_, _ = morekit.JsonRead[struct{ Host string }]("cfg.json")



# /*---------------  Utility Area ---------------*/

# Enc Md5
_ = morekit.EncMd5("kit")

# AppData Path
_ = morekit.AppDataPath("kit")



# /*---------------  Date Area ---------------*/

# Date FormatDay
_ = morekit.DateFormatDay("2025-11-18T14:23:45Z")



# /*---------------  Database Area ---------------*/

# SQLite Plain
cfg := kitdb.DBConfig{DBType: kitdb.DBTypeSQLite, DBName: "app", ConnStr: "./data", Password: ""}
db, _ := morekit.DBCore(cfg)
defer db.Close()

# SQLite Encryption
cfg := kitdb.DBConfig{DBType: kitdb.DBTypeSQLite, DBName: "app", ConnStr: "./data", Password: "123456"}
db, _ := morekit.DBCore(cfg)
defer db.Close()

# PostgreSQL
cfg := kitdb.DBConfig{DBType: kitdb.DBTypePostgreSQL, ConnStr: "host=localhost user=postgres password=123 dbname=test port=5432 sslmode=disable"}
db, _ := morekit.DBCore(cfg)
defer db.Close()



# /*---------------  Network Area ---------------*/

# Network IsPortActivate(TCP)
isOk := morekit.NetworkIsPortActivate(8080)

# Network FreePort(TCP 2000–60000)
p := morekit.NetworkGetFreePort()

License

MIT – see LICENSE for details.

Directories

Path Synopsis
cmd
morekit command
* main.go main-difine * by:Leftyer * dt:2025-11-01
* main.go main-difine * by:Leftyer * dt:2025-11-01
internal
kitComp
* kitComp.go Comp-difine * by:Leftyer * dt:2025-11-01
* kitComp.go Comp-difine * by:Leftyer * dt:2025-11-01
kitDB
* kitDB_Pgsql.go PostgreSQL-define * by:Leftyer * dt:2025-11-01
* kitDB_Pgsql.go PostgreSQL-define * by:Leftyer * dt:2025-11-01
kitDate
* kitDate.go Date-difine * by:Leftyer * dt:2025-11-01
* kitDate.go Date-difine * by:Leftyer * dt:2025-11-01
kitDevice
* kitDevice.go Device-difine * by:Leftyer * dt:2025-11-01
* kitDevice.go Device-difine * by:Leftyer * dt:2025-11-01
kitFile
* kitFile.go File-difine * by:Leftyer * dt:2025-11-01
* kitFile.go File-difine * by:Leftyer * dt:2025-11-01
kitNetwork
* kitNetwork.go Network-define * by:Leftyer * dt:2025-11-21
* kitNetwork.go Network-define * by:Leftyer * dt:2025-11-21
kitTemplate
* kitTemplate.go Template-difine * by:Leftyer * dt:2025-11-01
* kitTemplate.go Template-difine * by:Leftyer * dt:2025-11-01
kitUtility
* kitUtility.go Utility-difine * by:Leftyer * dt:2025-11-01
* kitUtility.go Utility-difine * by:Leftyer * dt:2025-11-01
pkg
morekit
* morekit.go Kit-difine * by:Leftyer * dt:2025-11-01
* morekit.go Kit-difine * by:Leftyer * dt:2025-11-01

Jump to

Keyboard shortcuts

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