github.com/cyverse/go-irodsclient@v0.13.2/fs/fs_entry.go (about)

     1  package fs
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  )
     7  
     8  // EntryType defines types of Entry
     9  type EntryType string
    10  
    11  const (
    12  	// FileEntry is a Entry type for a file
    13  	FileEntry EntryType = "file"
    14  	// DirectoryEntry is a Entry type for a directory
    15  	DirectoryEntry EntryType = "directory"
    16  )
    17  
    18  // Entry is a struct for filesystem entry
    19  type Entry struct {
    20  	ID                int64
    21  	Type              EntryType
    22  	Name              string
    23  	Path              string
    24  	Owner             string
    25  	Size              int64
    26  	DataType          string
    27  	CreateTime        time.Time
    28  	ModifyTime        time.Time
    29  	CheckSumAlgorithm string
    30  	CheckSum          string
    31  }
    32  
    33  // ToString stringifies the object
    34  func (entry *Entry) ToString() string {
    35  	return fmt.Sprintf("<Entry %d %s %s %s %d %s %s %s>", entry.ID, entry.Type, entry.Path, entry.Owner, entry.Size, entry.DataType, entry.CreateTime, entry.ModifyTime)
    36  }
    37  
    38  // IsDir returns if the entry is for directory
    39  func (entry *Entry) IsDir() bool {
    40  	return entry.Type == DirectoryEntry
    41  }