file

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllCodeFiles = []*CodeFile{}
View Source
var AllCodeFilesLock sync.Mutex

A mutex to protect the AllCodeFiles.

View Source
var AllConfigFiles = []*ConfigFile{}

Functions

This section is empty.

Types

type CodeFile

type CodeFile struct {
	// Cloc data
	CodeCount    uint32 `json:"code"`
	CommentCount uint32 `json:"comment_count"`
	BlankCount   uint32 `json:"blank_count"`
	TotalLines   uint32 `json:"total_lines"`

	FileMetadata
	FileContent

	// Code language
	Language string `json:"language"`
}

func NewCodeFile

func NewCodeFile(path string) (*CodeFile, error)

NewFile creates a new CodeFile

func (*CodeFile) AddFileContent

func (f *CodeFile) AddFileContent(content string)

func (*CodeFile) Analyze

func (f *CodeFile) Analyze(ctx context.Context) (*CodeFile, error)

type ConfigFile

type ConfigFile struct {
	FileMetadata
	FileContent
}

type FileContent

type FileContent struct {
	Size    uint64 `json:"size"`
	Content string `json:"content"`
}

type FileMetadata

type FileMetadata struct {
	// File metadata
	LastModifiedAt uint64   `json:"last_modified_at"`
	FileType       FileType `json:"file_type"`
	Name           string   `json:"name"`
	Path           string   `json:"path"`
	Directory      string   `json:"directory"`
	FileExtension  string   `json:"file_extension"`
}

Struct memory alignment consideration

type FileType

type FileType uint8

File types

const (
	CODE_FILE FileType = iota // Code file
	CONFIG_FILE
)

Jump to

Keyboard shortcuts

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