base creation

This commit is contained in:
m
2026-09-03 20:38:47 +02:00
parent 32a61e6a64
commit 80dd164fde
12 changed files with 187 additions and 18 deletions
+51
View File
@@ -0,0 +1,51 @@
package entities
import (
"fmt"
)
type Document struct {
DocumentUUID *string
DocumentName string
DocumentType int
}
const (
ERROR_DOCUMENT_TYPE = "ERROR_DOCUMENT_TYPE"
ERROR_DOCUMENT_MOVE = "ERROR_DOCUMENT_MOVE"
ERROR_DOCUMENT_NOT_PERCISTED = "ERROR_DOCUMENT_NOT_PERCISTED"
)
const (
FILE = 1
DIRECTORY = 2
)
func IsDocumentTypeValid(documentType int) bool {
return IsFile(documentType) || IsDirectory(documentType)
}
func IsFile(documentType int) bool {
return FILE == documentType
}
func IsDirectory(documentType int) bool {
return DIRECTORY == documentType
}
func NewDocument(documentName string, documentType int) (error, *Document) {
documentTypeIsValid := IsDocumentTypeValid(documentType)
if !documentTypeIsValid {
return fmt.Errorf(ERROR_DOCUMENT_TYPE), nil
}
return nil, &Document{
DocumentName: documentName,
DocumentType: documentType,
}
}
+1
View File
@@ -0,0 +1 @@
package entities
+11
View File
@@ -0,0 +1,11 @@
package entities
type User struct {
Username string
}
func NewUser(username string) (error, *User) {
return nil, &User{
Username: username,
}
}