oss

package
v1.0.51 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 12 Imported by: 5

Documentation

Overview

Package oss 操作系统相关.

包括 Abs目录, Mod模块,

Index

Examples

Constants

View Source
const DefaultDirFileMod os.FileMode = 0o771
View Source
const DefaultFileMode os.FileMode = 0o664

Variables

View Source
var ErrNotDefined = errors.New("OS is not defined")

ErrNotDefined 系统不支持.

Functions

func Abs

func Abs(path string) (string, error)

func Exec added in v0.2.11

func Exec(name string, args ...string) error

Exec 执行命令.

func ExecOut added in v0.2.11

func ExecOut(name string, args ...string) (string, error)

ExecOut 获取执行结果.

func Exist added in v0.2.11

func Exist(paths ...string) bool

func GetMod

func GetMod(name string) *debug.Module

func GetModByInfo

func GetModByInfo(info *debug.BuildInfo, name string) *debug.Module

func IsDarwin added in v0.5.41

func IsDarwin() bool

IsDarwin 是否是 Darwin 系统.

func IsDir added in v0.2.15

func IsDir(paths ...string) bool

func IsFile added in v0.2.15

func IsFile(paths ...string) bool

func IsLinux added in v0.5.41

func IsLinux() bool

IsLinux 是否是 Linux 系统.

func IsWindows added in v0.5.41

func IsWindows() bool

IsWindows 是否是 Windows 系统.

func MkdirParent added in v0.2.19

func MkdirParent(path string)

func Open added in v0.2.11

func Open(file string) error

Open 打开文件.

func Show added in v0.2.11

func Show(file string) error

Show 在目录中显示.

func SignalClose

func SignalClose(errorer Errorer, closers ...Closer) context.Context

func UniqueID added in v0.5.42

func UniqueID() int

UniqueID 唯一ID.

Example
package main

import (
	"fmt"

	"github.com/xuender/oils/oss"
)

func main() {
	id1 := oss.UniqueID()
	id2 := oss.UniqueID()

	fmt.Println(id1 == id2)

}
Output:

false

func UniqueString added in v0.5.42

func UniqueString(prefix string) string

UniqueString 唯一字符串.

Types

type Closer added in v0.1.5

type Closer interface {
	Close() error
}

type Errorer added in v0.1.5

type Errorer interface {
	Error(error)
}

type StateCode

type StateCode = int
const (
	Test StateCode = iota
	Play
	Run
	Build
)

func State

func State() StateCode

func StateByFile

func StateByFile(file string) StateCode

type Unique added in v0.5.42

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

Unique 唯一.

func NewUnique added in v0.5.42

func NewUnique() *Unique

NewUnique 新建唯一.

func (*Unique) ID added in v0.5.42

func (p *Unique) ID() int

ID 唯一整数.

func (*Unique) StringID added in v0.5.42

func (p *Unique) StringID(prefix string) string

StringID 唯一字符串.

Jump to

Keyboard shortcuts

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