github.com/Kindred87/Obsidian@v0.0.0-20210809203756-86936424b848/filetypes/supported.go (about) 1 package filetypes 2 3 /* 4 When adding a new file extension, use this checklist 5 6 1) new FileExtension const 7 2) new private string variable 8 3) new entry in the fileExtensions slice, preserving the order of the constant values. 9 */ 10 11 // FileExtension represents the file extensions that are supported for use as datasources. 12 type FileExtension int 13 14 // Checklist item #1 15 const ( 16 CSV FileExtension = iota 17 XLSX 18 HTML 19 ) 20 21 //Checklist item #2 22 23 var csv string = "CSV" 24 var xlsx string = "XLSX" 25 var html string = "HTML" 26 27 // Checklist item #3 28 29 var fileExtentions []string = []string{csv, xlsx, html} 30 31 // Methods 32 33 // String returns the string equivalent of the given FileExtension without a prepended dot (.). 34 func (fe FileExtension) String() string { 35 return fileExtentions[fe] 36 } 37 38 // StringWithDot returns the string equivalent of the given FileExtension prepended with a dot (.). 39 func (fe FileExtension) StringWithDot() string { 40 return "." + fe.String() 41 }