everything

package module
v0.0.0-...-9d3dbcb Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT-0 Imports: 9 Imported by: 0

README

everything-sdk-go

Pure Go port of the Everything SDK IPC client which does not load or wrap Everything32.dll / Everything64.dll.

It talks to the running Everything process with the same WM_COPYDATA protocol just like the official SDK.

Usage

package main

import (
    "context"
    "fmt"
    "log"
    "time"

    everything "github.com/fakeboboliu/everything-sdk-go"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
    defer cancel()

    results, err := everything.Query(ctx, "ext:go;mp4", nil)
    if err != nil {
        log.Fatal(err)
    }

    for _, item := range results.Items {
        fmt.Println(item.FullPathName())
    }
}

Request extra fields with IPC v2:

opts := everything.DefaultQueryOptions
opts.MaxResults = 100
opts.Sort = everything.SortDateModifiedDescending
opts.RequestFlags = everything.RequestFileName |
    everything.RequestPath | everything.RequestSize | everything.RequestDateModified

results, err := everything.Query(context.Background(), "ext:go;mp4", &opts)

When passing a non-nil QueryOptions, values are sent as-is. Start from DefaultQueryOptions unless you intentionally want protocol zero values such as MaxResults = 0 or RequestFlags = 0.

The package also exposes SDK-style stateful functions such as Everything_SetSearchW, Everything_QueryW, Everything_GetNumResults, and Everything_GetResultFullPathNameW for code that is closer to the C SDK shape.

Performance

Benchmarking shows no significant difference between this pure Go implementation and an SDK wrapper (~42ms on my computer), but you can use pure Go now.

To archive the best performance, only query with the Everything window closed, or the query latency could be 20% higher.

Documentation

Index

Constants

View Source
const AllResults uint32 = 0xffffffff
View Source
const DefaultRequestFlags = RequestFileName | RequestPath
View Source
const SDKVersion = 2

Variables

View Source
var DefaultQueryOptions = QueryOptions{
	MaxResults:   AllResults,
	Sort:         SortNameAscending,
	RequestFlags: DefaultRequestFlags,
}
View Source
var ErrUnsupportedPlatform = errors.New("everything: IPC is supported only on Windows")

Functions

func DeleteRunHistory

func DeleteRunHistory() (bool, error)

func Everything_CleanUp

func Everything_CleanUp()

func Everything_DeleteRunHistory

func Everything_DeleteRunHistory() bool

func Everything_Exit

func Everything_Exit() bool

func Everything_GetBuildNumber

func Everything_GetBuildNumber() uint32

func Everything_GetMajorVersion

func Everything_GetMajorVersion() uint32

func Everything_GetMatchCase

func Everything_GetMatchCase() bool

func Everything_GetMatchPath

func Everything_GetMatchPath() bool

func Everything_GetMatchWholeWord

func Everything_GetMatchWholeWord() bool

func Everything_GetMax

func Everything_GetMax() uint32

func Everything_GetMinorVersion

func Everything_GetMinorVersion() uint32

func Everything_GetNumFileResults

func Everything_GetNumFileResults() uint32

func Everything_GetNumFolderResults

func Everything_GetNumFolderResults() uint32

func Everything_GetNumResults

func Everything_GetNumResults() uint32

func Everything_GetOffset

func Everything_GetOffset() uint32

func Everything_GetRegex

func Everything_GetRegex() bool

func Everything_GetReplyID

func Everything_GetReplyID() uint32

func Everything_GetReplyWindow

func Everything_GetReplyWindow() uintptr

func Everything_GetResultAttributes

func Everything_GetResultAttributes(index uint32) uint32

func Everything_GetResultDateAccessed

func Everything_GetResultDateAccessed(index uint32) (time.Time, bool)

func Everything_GetResultDateCreated

func Everything_GetResultDateCreated(index uint32) (time.Time, bool)

func Everything_GetResultDateModified

func Everything_GetResultDateModified(index uint32) (time.Time, bool)

func Everything_GetResultDateRecentlyChanged

func Everything_GetResultDateRecentlyChanged(index uint32) (time.Time, bool)

func Everything_GetResultDateRun

func Everything_GetResultDateRun(index uint32) (time.Time, bool)

func Everything_GetResultExtensionA

func Everything_GetResultExtensionA(index uint32) string

func Everything_GetResultExtensionW

func Everything_GetResultExtensionW(index uint32) string

func Everything_GetResultFileListFileNameA

func Everything_GetResultFileListFileNameA(index uint32) string

func Everything_GetResultFileListFileNameW

func Everything_GetResultFileListFileNameW(index uint32) string

func Everything_GetResultFileNameA

func Everything_GetResultFileNameA(index uint32) string

func Everything_GetResultFileNameW

func Everything_GetResultFileNameW(index uint32) string

func Everything_GetResultFullPathNameA

func Everything_GetResultFullPathNameA(index uint32) string

func Everything_GetResultFullPathNameW

func Everything_GetResultFullPathNameW(index uint32) string

func Everything_GetResultHighlightedFileNameA

func Everything_GetResultHighlightedFileNameA(index uint32) string

func Everything_GetResultHighlightedFileNameW

func Everything_GetResultHighlightedFileNameW(index uint32) string

func Everything_GetResultHighlightedFullPathAndFileNameA

func Everything_GetResultHighlightedFullPathAndFileNameA(index uint32) string

func Everything_GetResultHighlightedFullPathAndFileNameW

func Everything_GetResultHighlightedFullPathAndFileNameW(index uint32) string

func Everything_GetResultHighlightedPathA

func Everything_GetResultHighlightedPathA(index uint32) string

func Everything_GetResultHighlightedPathW

func Everything_GetResultHighlightedPathW(index uint32) string

func Everything_GetResultPathA

func Everything_GetResultPathA(index uint32) string

func Everything_GetResultPathW

func Everything_GetResultPathW(index uint32) string

func Everything_GetResultRunCount

func Everything_GetResultRunCount(index uint32) uint32

func Everything_GetResultSize

func Everything_GetResultSize(index uint32) (uint64, bool)

func Everything_GetRevision

func Everything_GetRevision() uint32

func Everything_GetRunCountFromFileNameA

func Everything_GetRunCountFromFileNameA(fileName string) uint32

func Everything_GetRunCountFromFileNameW

func Everything_GetRunCountFromFileNameW(fileName string) uint32

func Everything_GetSearchA

func Everything_GetSearchA() string

func Everything_GetSearchW

func Everything_GetSearchW() string

func Everything_GetTotFileResults

func Everything_GetTotFileResults() uint32

func Everything_GetTotFolderResults

func Everything_GetTotFolderResults() uint32

func Everything_GetTotResults

func Everything_GetTotResults() uint32

func Everything_IncRunCountFromFileNameA

func Everything_IncRunCountFromFileNameA(fileName string) uint32

func Everything_IncRunCountFromFileNameW

func Everything_IncRunCountFromFileNameW(fileName string) uint32

func Everything_IsAdmin

func Everything_IsAdmin() bool

func Everything_IsAppData

func Everything_IsAppData() bool

func Everything_IsDBLoaded

func Everything_IsDBLoaded() bool

func Everything_IsFastSort

func Everything_IsFastSort(sort Sort) bool

func Everything_IsFileInfoIndexed

func Everything_IsFileInfoIndexed(fileInfo FileInfoType) bool

func Everything_IsFileResult

func Everything_IsFileResult(index uint32) bool

func Everything_IsFolderResult

func Everything_IsFolderResult(index uint32) bool

func Everything_IsVolumeResult

func Everything_IsVolumeResult(index uint32) bool

func Everything_Query

func Everything_Query(wait bool) bool

func Everything_QueryA

func Everything_QueryA(wait bool) bool

func Everything_QueryW

func Everything_QueryW(wait bool) bool

func Everything_RebuildDB

func Everything_RebuildDB() bool

func Everything_Reset

func Everything_Reset()

func Everything_SaveDB

func Everything_SaveDB() bool

func Everything_SaveRunHistory

func Everything_SaveRunHistory() bool

func Everything_SetMatchCase

func Everything_SetMatchCase(enabled bool)

func Everything_SetMatchPath

func Everything_SetMatchPath(enabled bool)

func Everything_SetMatchWholeWord

func Everything_SetMatchWholeWord(enabled bool)

func Everything_SetMax

func Everything_SetMax(max uint32)

func Everything_SetOffset

func Everything_SetOffset(offset uint32)

func Everything_SetRegex

func Everything_SetRegex(enabled bool)

func Everything_SetReplyID

func Everything_SetReplyID(id uint32)

func Everything_SetReplyWindow

func Everything_SetReplyWindow(hwnd uintptr)

func Everything_SetRequestFlags

func Everything_SetRequestFlags(flags RequestFlag)

func Everything_SetRunCountFromFileNameA

func Everything_SetRunCountFromFileNameA(fileName string, runCount uint32) bool

func Everything_SetRunCountFromFileNameW

func Everything_SetRunCountFromFileNameW(fileName string, runCount uint32) bool

func Everything_SetSearchA

func Everything_SetSearchA(search string)

func Everything_SetSearchW

func Everything_SetSearchW(search string)

func Everything_SetSort

func Everything_SetSort(sort Sort)

func Everything_SortResultsByPath

func Everything_SortResultsByPath()

func Everything_UpdateAllFolderIndexes

func Everything_UpdateAllFolderIndexes() bool

func Exit

func Exit() (bool, error)

func GetBuildNumber

func GetBuildNumber() (uint32, error)

func GetMajorVersion

func GetMajorVersion() (uint32, error)

func GetMinorVersion

func GetMinorVersion() (uint32, error)

func GetRevision

func GetRevision() (uint32, error)

func GetRunCountFromFileName

func GetRunCountFromFileName(fileName string) (uint32, error)

func GetSearch

func GetSearch() string

func IncRunCountFromFileName

func IncRunCountFromFileName(fileName string) (uint32, error)

func IsAdmin

func IsAdmin() (bool, error)

func IsAppData

func IsAppData() (bool, error)

func IsDBLoaded

func IsDBLoaded() (bool, error)

func IsFastSort

func IsFastSort(sort Sort) (bool, error)

func IsFileInfoIndexed

func IsFileInfoIndexed(fileInfo FileInfoType) (bool, error)

func RebuildDB

func RebuildDB() (bool, error)

func SaveDB

func SaveDB() (bool, error)

func SaveRunHistory

func SaveRunHistory() (bool, error)

func SetRunCountFromFileName

func SetRunCountFromFileName(fileName string, runCount uint32) (bool, error)

func SetSearch

func SetSearch(search string)

func UpdateAllFolderIndexes

func UpdateAllFolderIndexes() (bool, error)

Types

type Client

type Client struct{}

func NewClient

func NewClient() *Client

func (*Client) Query

func (c *Client) Query(ctx context.Context, search string, opts *QueryOptions) (*Results, error)

type ErrorCode

type ErrorCode uint32
const (
	OK ErrorCode = iota
	ErrorMemory
	ErrorIPC
	ErrorRegisterClassEx
	ErrorCreateWindow
	ErrorCreateThread
	ErrorInvalidIndex
	ErrorInvalidCall
	ErrorInvalidRequest
	ErrorInvalidParameter
)

func Everything_GetLastError

func Everything_GetLastError() ErrorCode

func (ErrorCode) Error

func (e ErrorCode) Error() string

type FileInfoType

type FileInfoType uint32
const (
	FileInfoFileSize FileInfoType = iota + 1
	FileInfoFolderSize
	FileInfoDateCreated
	FileInfoDateModified
	FileInfoDateAccessed
	FileInfoAttributes
)

type ItemFlag

type ItemFlag uint32
const (
	ItemFolder ItemFlag = 0x00000001
	ItemDrive  ItemFlag = 0x00000002
	ItemRoot            = ItemDrive
)

type QueryOptions

type QueryOptions struct {
	MatchPath      bool
	MatchCase      bool
	MatchWholeWord bool
	Regex          bool
	Offset         uint32
	MaxResults     uint32
	Sort           Sort
	RequestFlags   RequestFlag
}

type RequestFlag

type RequestFlag uint32
const (
	RequestFileName RequestFlag = 1 << iota
	RequestPath
	RequestFullPathAndFileName
	RequestExtension
	RequestSize
	RequestDateCreated
	RequestDateModified
	RequestDateAccessed
	RequestAttributes
	RequestFileListFileName
	RequestRunCount
	RequestDateRun
	RequestDateRecentlyChanged
	RequestHighlightedFileName
	RequestHighlightedPath
	RequestHighlightedFullPathAndFileName
)

func Everything_GetRequestFlags

func Everything_GetRequestFlags() RequestFlag

func Everything_GetResultListRequestFlags

func Everything_GetResultListRequestFlags() RequestFlag

func (RequestFlag) Has

func (f RequestFlag) Has(flag RequestFlag) bool

type Result

type Result struct {
	Flags ItemFlag

	Name             string
	Path             string
	FullPath         string
	Extension        string
	FileListFileName string

	Size      uint64
	SizeValid bool

	DateCreated         time.Time
	DateCreatedValid    bool
	DateModified        time.Time
	DateModifiedValid   bool
	DateAccessed        time.Time
	DateAccessedValid   bool
	DateRun             time.Time
	DateRunValid        bool
	DateRecentlyChanged time.Time
	DateRecentlyValid   bool

	Attributes      uint32
	AttributesValid bool
	RunCount        uint32
	RunCountValid   bool

	HighlightedName     string
	HighlightedPath     string
	HighlightedFullPath string
}

func (Result) FullPathName

func (r Result) FullPathName() string

func (Result) IsFile

func (r Result) IsFile() bool

func (Result) IsFolder

func (r Result) IsFolder() bool

func (Result) IsVolume

func (r Result) IsVolume() bool

type Results

type Results struct {
	QueryVersion int
	TotalItems   uint32
	TotalFiles   uint32
	TotalFolders uint32
	TotalCounts  bool
	Offset       uint32
	RequestFlags RequestFlag
	Sort         Sort
	Items        []Result
}

func Query

func Query(ctx context.Context, search string, opts *QueryOptions) (*Results, error)

func (*Results) Len

func (r *Results) Len() int

func (*Results) NumFileResults

func (r *Results) NumFileResults() uint32

func (*Results) NumFolderResults

func (r *Results) NumFolderResults() uint32

type Sort

type Sort uint32
const (
	SortNameAscending Sort = iota + 1
	SortNameDescending
	SortPathAscending
	SortPathDescending
	SortSizeAscending
	SortSizeDescending
	SortExtensionAscending
	SortExtensionDescending
	SortTypeNameAscending
	SortTypeNameDescending
	SortDateCreatedAscending
	SortDateCreatedDescending
	SortDateModifiedAscending
	SortDateModifiedDescending
	SortAttributesAscending
	SortAttributesDescending
	SortFileListFileNameAscending
	SortFileListFileNameDescending
	SortRunCountAscending
	SortRunCountDescending
	SortDateRecentlyChangedAscending
	SortDateRecentlyChangedDescending
	SortDateAccessedAscending
	SortDateAccessedDescending
	SortDateRunAscending
	SortDateRunDescending
)

func Everything_GetResultListSort

func Everything_GetResultListSort() Sort

func Everything_GetSort

func Everything_GetSort() Sort

type TargetMachine

type TargetMachine uint32
const (
	TargetMachineX86 TargetMachine = iota + 1
	TargetMachineX64
	TargetMachineARM
	TargetMachineARM64
)

func Everything_GetTargetMachine

func Everything_GetTargetMachine() TargetMachine

func GetTargetMachine

func GetTargetMachine() (TargetMachine, error)

type Version

type Version struct {
	Major    uint32
	Minor    uint32
	Revision uint32
	Build    uint32
}

func GetVersion

func GetVersion() (Version, error)

Jump to

Keyboard shortcuts

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