fquery

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMode

type FileMode string

FileMode 以文本形式表示文件模式,例如:"drwxrwxrwx"

type ID

type ID int64

ID ...

type Item

type Item struct {
	URI  string `json:"uri"` // 这个字段是可选的
	Name string `json:"name"`

	Size        int64    `json:"size"`
	Mode        FileMode `json:"mode"`
	ContentType MIMEType `json:"type"`
	Dir         bool     `json:"dir"`
	File        bool     `json:"file"`
	Link        bool     `json:"link"`

	CreatedAt lang.Time `json:"created_at"`
	UpdatedAt lang.Time `json:"updated_at"`
}

Item ...

type Location

type Location struct {
	MaskLength int               `json:"mask"`     // 基础 URI (aka.mask) 包含的 elements 数量
	HostIndex  int               `json:"host"`     // 主机信息 (user@hostname:port)在 elements 中的 index
	Elements   []string          `json:"elements"` // 解析后的各个部分
	Query      map[string]string `json:"query"`    // 查询参数
}

Location 表示要查询的位置; (URI)& (BaseAt+PathElements) 应该至少有一组参数; 如果都为空,则返回默认位置; 如果都有赋值,则按照 (BaseAt+PathElements) 的位置查询;

func ParseLocation

func ParseLocation(str string) (*Location, error)

ParseLocation 把字符串解析为 Location

func (*Location) HasSameMask

func (inst *Location) HasSameMask(other *Location) bool

HasSameMask 判断是否具有相同的 mask

func (*Location) IsAbs

func (inst *Location) IsAbs() bool

IsAbs 判断这个 Location 是否是一个绝对位置 (绝对 URI)

func (*Location) IsEmpty

func (inst *Location) IsEmpty() bool

IsEmpty 判断这个 Location 是否为空

func (*Location) Normalize

func (inst *Location) Normalize() (*Location, error)

Normalize 标准化这个 Location

func (*Location) SetQueryParam

func (inst *Location) SetQueryParam(name, value string)

SetQueryParam ...

func (*Location) String

func (inst *Location) String() string

func (*Location) URI

func (inst *Location) URI() afs.URI

URI ...

type MIMEType

type MIMEType = mimetypes.Type // string

MIMEType 表示一个文件类型 (RFC 6838

const (
	TypeFile    MIMEType = "fs/file"
	TypeFolder  MIMEType = "fs/folder"
	TypeLink    MIMEType = "fs/link"
	TypeUnknown MIMEType = "fs/unknown"
)

定义一些常用的文件类型

type Query

type Query struct {
	URI      afs.URI  `json:"uri"`      // 完整的 URI
	Ref      afs.URI  `json:"ref"`      // Ref-URI, 如果 URI 的值是一个相对位置,则以 Ref 为参照基础
	Location Location `json:"location"` // 解析后的 URI

	Self  *Item                  `json:"self"`
	Items []*Item                `json:"items"`
	Types map[MIMEType]*TypeInfo `json:"types"`
}

Query ...

type Service

type Service interface {
	Query(ctx context.Context, q *Query) (*Query, error)
}

Service ...

type TypeInfo

type TypeInfo struct {
	mimetypes.Info

	Suffix string `json:"suffix"`
}

TypeInfo ...

type VO

type VO struct {
	vo.Base

	Query Query `json:"fquery"`
}

VO ...

Jump to

Keyboard shortcuts

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