Documentation
¶
Index ¶
- Variables
- func AddNotificationByText(notifications []*Notification, destination Notifiable, message string, ...)
- func AddNotifications(notifications []*Notification, destination Notifiable, users []string, ...)
- func CountNotifications(notifications []*Notification, message string) int
- func GetDefaultLanguages() map[string]Language
- func GetGCPToken(token string, tokenType string, user User) (*oauth2.Token, error)
- func GetValueToObjectId(container map[string]interface{}, key string) *primitive.ObjectID
- func InTimeSpan(start, end, checkTime time.Time) bool
- func NewError(i Notifiable, message string, users []string, source string) *[]*Notification
- func NewInfo(i Notifiable, message string, users []string, source string) *[]*Notification
- func NewNotification(notifications []*Notification, message *Message) *[]*Notification
- func NewWarning(i Notifiable, message string, users []string, source string) *[]*Notification
- func NewWarningWithCode(i Notifiable, message string, code NotifyCode, users []string, source string) *[]*Notification
- func Notify(i Notifiable, message *Message, users []string, source string) *[]*Notification
- func ParseMapToStruct(data map[string]interface{}, model interface{}) error
- func SendNotificationToUser(userID string, count int) error
- func SetNotificationService(service NotificationService)
- func UpdateBaseList(model ListItemModel, list interface{}) error
- type Action
- type ActionLog
- type AuditType
- type BaseModel
- func (m *BaseModel) BaseAddItemInArray(request *BaseRequest) BaseResponse
- func (m *BaseModel) BaseCount(request *BaseRequest) BaseResponse
- func (m *BaseModel) BaseDelete(request BaseRequest) BaseResponse
- func (m *BaseModel) BaseDeleteSoft(request BaseRequest) BaseResponse
- func (m *BaseModel) BaseFind(request *BaseRequest) BaseResponse
- func (m *BaseModel) BaseFindOne(request BaseRequest) BaseResponse
- func (m *BaseModel) BaseRemoveField(request BaseRequest, field string) BaseResponse
- func (m *BaseModel) BaseRemoveItemInArray(request *BaseRequest, field string, value string) BaseResponse
- func (m *BaseModel) BaseSwitchItemInArray(request *BaseRequest, field string, value string) BaseResponse
- func (m *BaseModel) BaseUpdate(request BaseRequest) BaseResponse
- func (m *BaseModel) BaseUpdateField(request BaseRequest, field string, value interface{}) BaseResponse
- func (m *BaseModel) BaseUpdateMany(request BaseRequest, values map[string]interface{}) BaseResponse
- func (m *BaseModel) BecomeNew()
- func (m *BaseModel) BecomeNewButKeepID()
- func (m *BaseModel) CompareLabels(labels Labels) bool
- func (m *BaseModel) Err(err error) error
- func (m *BaseModel) False() *bool
- func (m *BaseModel) GetBaseFindOptions(request *BaseRequest) *FindOptions
- func (m *BaseModel) GetExternalID() string
- func (m *BaseModel) GetID() (interface{}, error)
- func (m *BaseModel) GetIDStr() string
- func (m *BaseModel) GetLabels() []Label
- func (m *BaseModel) GetRepoID() string
- func (m *BaseModel) HasLabel(label Label) bool
- func (m *BaseModel) HasLabels(labels []Label) bool
- func (m *BaseModel) IsDeleted() bool
- func (m *BaseModel) IsEmpty() bool
- func (m *BaseModel) IsFalse(condition *bool) bool
- func (m *BaseModel) IsLabeled() bool
- func (m *BaseModel) IsNew() bool
- func (m *BaseModel) IsTrue(condition *bool) bool
- func (m *BaseModel) Label(labels ...Label)
- func (m *BaseModel) LabelFromStrings(strings ...string)
- func (m *BaseModel) LabelIf(label Label, b interface{})
- func (m *BaseModel) LabelTotal() int
- func (m *BaseModel) LastSync() *time.Time
- func (m *BaseModel) NewBool(condition bool) *bool
- func (m *BaseModel) PrepareForSync(externalID interface{}) error
- func (m *BaseModel) SetCreated(user User)
- func (m *BaseModel) SetDeleted(user User)
- func (m *BaseModel) SetID(id string) error
- func (m *BaseModel) SetRecover(user User)
- func (m *BaseModel) SetRepoID(value string)
- func (m *BaseModel) SetUpdated(user User)
- func (m BaseModel) ToJSON(model interface{}) string
- func (m BaseModel) ToRaw(model interface{}) []byte
- func (m *BaseModel) Trace(err error) error
- func (m *BaseModel) True() *bool
- func (m *BaseModel) UnLabel(labels ...Label)
- func (m *BaseModel) ValidateBase() error
- type BaseRequest
- func (m *BaseRequest) AddOrderAsc(fields ...string)
- func (m *BaseRequest) AddOrderDesc(fields ...string)
- func (m *BaseRequest) Clone(model RepositoryModel) (*BaseRequest, error)
- func (m *BaseRequest) CloneModelToNewDomain(domain string) (*BaseRequest, error)
- func (m *BaseRequest) GetFindOptions() *FindOptions
- func (m *BaseRequest) GetObjectsIDs() []*primitive.ObjectID
- func (m *BaseRequest) GetRepoRequest() RepoRequest
- func (m *BaseRequest) HasIDs() bool
- func (m *BaseRequest) SetFindOptions(findOptions *FindOptions)
- func (m *BaseRequest) ToJSON() string
- func (m *BaseRequest) Validate() error
- type BaseResponse
- func NewBaseResponse() *BaseResponse
- func NewBaseResponseFromError(err error) BaseResponse
- func NewBaseResponseFromErrorStr(err string) BaseResponse
- func NewBaseResponseFromErrorWithCode(err error, code int) BaseResponse
- func NewBaseResponseFromModel(model interface{}) BaseResponse
- func NewBaseResponseFromModelAndError(model interface{}, err error) BaseResponse
- func NewBaseResponseFromRepoResponse(repoResponse RepoResponse) BaseResponse
- func (m *BaseResponse) AddID(id *primitive.ObjectID) error
- func (m *BaseResponse) AppendToList(item interface{})
- func (m *BaseResponse) GetAtIndex(index int, model interface{}) error
- func (m *BaseResponse) GetFirst(model interface{}) error
- func (m *BaseResponse) GetList(list interface{}) error
- func (m *BaseResponse) GetListInterface() List
- func (m *BaseResponse) Merge(response BaseResponse) BaseResponse
- func (m *BaseResponse) SetError(err error)
- func (m *BaseResponse) ToJSON() string
- type BulkList
- type ConfigType
- type CustomerWelcome
- type DateRange
- func NewDataRangeFromRange(r *DateRange, add time.Duration) *DateRange
- func NewDataRangeThisWeek() (*DateRange, error)
- func NewDateRange(startDate *time.Time, endDate *time.Time) (*DateRange, error)
- func NewDateRangeFromStartDate(startDate *time.Time) (*DateRange, error)
- func NewDateRangeFromStr(startDate string, endDate string) (DateRange, error)
- func NewDateRangeFromWeekNumber(weekNumber int) (*DateRange, error)
- func NewDateRangeFullDay(startDate *time.Time) DateRange
- func NewDateRangeFullWeek(startDate *time.Time) *DateRange
- func NewDateRangeNextWeek(startDate *time.Time) (*DateRange, error)
- func NewDateRangeWeek(startDate *time.Time) (*DateRange, error)
- func (m DateRange) Add(time time.Duration) *DateRange
- func (m DateRange) AddMonths(months int) DateRange
- func (m DateRange) AdjustHours() DateRange
- func (m DateRange) Difference() time.Duration
- func (m DateRange) ExtractSuccessiveMonthDates() []time.Time
- func (m *DateRange) GetDateRangeInWeek() *DateRange
- func (m DateRange) GetEndYear() int
- func (m DateRange) GetFutureDateRange() DateRange
- func (m DateRange) GetFutureYearDateRange() DateRange
- func (m DateRange) GetPreviousDateRange() DateRange
- func (m DateRange) GetPreviousYearDateRange() DateRange
- func (m DateRange) GetStartYear() int
- func (m DateRange) GetWeek() int
- func (m DateRange) IsEqual(dateRange DateRange) bool
- func (m DateRange) IsEqualOmitTime(dateRange DateRange) bool
- func (m *DateRange) IsNextDateRange(dateRange DateRange) bool
- func (m *DateRange) IsPreviousDateRange(dateRange DateRange) bool
- func (m DateRange) IsValid() bool
- func (m *DateRange) Overlaps(dateRange DateRange) bool
- func (m *DateRange) RangeIn(checkDateRange DateRange) bool
- func (m *DateRange) RecalcDateLimits(dateToInclude *time.Time)
- func (m *DateRange) Set(date []string)
- func (m DateRange) SetEnd() DateRange
- func (m DateRange) SetOneFullDay(day *time.Time) DateRange
- func (m *DateRange) TimeIn(checkTime time.Time) bool
- type Dictionaries
- type Dictionary
- type DictionaryRepo
- func (m *DictionaryRepo) Delete(request *BaseRequest) BaseResponse
- func (m *DictionaryRepo) Find(request *BaseRequest) BaseResponse
- func (m *DictionaryRepo) FindOne(request *BaseRequest) BaseResponse
- func (m *DictionaryRepo) FindOrCreate(request *BaseRequest) BaseResponse
- func (m *DictionaryRepo) GetCollection() (name string, isGlobal bool)
- func (m *DictionaryRepo) GetDictionaryByTag(tag Tag) (dictionary Dictionary, err error)
- func (m *DictionaryRepo) GetDictionaryByTagValueOrNumber(value string, number int) (dictionary *Dictionary, err error)
- func (m *DictionaryRepo) GetFindOptions(request *BaseRequest) *FindOptions
- func (m *DictionaryRepo) GetRepoType() RepoType
- func (m *DictionaryRepo) ToJSON() string
- func (m *DictionaryRepo) Update(request *BaseRequest) BaseResponse
- func (m *DictionaryRepo) UpdateMany(request *BaseRequest, values map[string]interface{}) BaseResponse
- func (m *DictionaryRepo) Validate() error
- type DictionaryType
- type EmailSender
- type FileRepoRequest
- type FileRepoResponse
- type FileRepoType
- type FileRepository
- type Filter
- type FilterOperator
- type FilterOr
- type FindOptions
- func (m *FindOptions) AddAll(name string, value interface{})
- func (m *FindOptions) AddComplex(name string, operation FilterOperator, value interface{})
- func (m *FindOptions) AddEquals(name string, value interface{})
- func (m *FindOptions) AddEqualsCI(name string, value interface{})
- func (m *FindOptions) AddGreat(name string, value interface{})
- func (m *FindOptions) AddGreatOrEqual(name string, value interface{})
- func (m *FindOptions) AddIn(name string, value interface{})
- func (m *FindOptions) AddLess(name string, value interface{})
- func (m *FindOptions) AddLessOrEqual(name string, value interface{})
- func (m *FindOptions) AddMultiple(value FilterOr)
- func (m *FindOptions) AddNil(name string)
- func (m *FindOptions) AddNotEquals(name string, value interface{})
- func (m *FindOptions) AddNotNil(name string)
- func (m *FindOptions) AddOrderAsc(fields ...string)
- func (m *FindOptions) AddOrderDesc(fields ...string)
- func (m *FindOptions) AddRange(nameFrom string, valueFrom interface{}, nameTo string, valueTo interface{})
- func (m *FindOptions) GetTotalOrders() int64
- func (m *FindOptions) Remove(key string)
- func (m *FindOptions) ToJSON() string
- type GCSBucketAdapter
- type GCSBucketInterface
- type GCSClientAdapter
- type GCSClientInterface
- type GCSFileRepository
- func (m *GCSFileRepository) Close()
- func (m *GCSFileRepository) Connect() error
- func (m *GCSFileRepository) Delete() FileRepoResponse
- func (m *GCSFileRepository) Download() FileRepoResponse
- func (m *GCSFileRepository) EmptyBin() FileRepoResponse
- func (m *GCSFileRepository) GetAccess() FileRepoResponse
- func (m *GCSFileRepository) GetFile() io.Reader
- func (m *GCSFileRepository) GetPath() string
- func (m *GCSFileRepository) Mount(fileID string, fileName string, path string, repositoryPath string)
- func (m *GCSFileRepository) Open() FileRepoResponse
- func (m *GCSFileRepository) Save() FileRepoResponse
- func (m *GCSFileRepository) ToJSON() string
- type GCSObjectAdapter
- type GCSObjectInterface
- type GCSObjectIteratorInterface
- type JSON
- type Key
- type Label
- type Labels
- type Language
- type List
- type ListItem
- type ListItemModel
- type LocalFileRepository
- func (m *LocalFileRepository) Close()
- func (m *LocalFileRepository) Delete() FileRepoResponse
- func (m *LocalFileRepository) Download() FileRepoResponse
- func (m *LocalFileRepository) EmptyBin() FileRepoResponse
- func (m *LocalFileRepository) GetAccess() FileRepoResponse
- func (m *LocalFileRepository) GetFile() io.Reader
- func (m *LocalFileRepository) GetPath() string
- func (m *LocalFileRepository) Open() FileRepoResponse
- func (m *LocalFileRepository) Save() FileRepoResponse
- func (m *LocalFileRepository) ToJSON() string
- type Message
- type MiniModel
- type MockBucket
- func (b *MockBucket) CountNonDeletedObjects() int
- func (b *MockBucket) GetAllObjects() map[string]*MockObject
- func (b *MockBucket) Object(path string) GCSObjectInterface
- func (b *MockBucket) Objects(ctx context.Context, query *storage.Query) GCSObjectIteratorInterface
- func (b *MockBucket) ReadObject(path string) ([]byte, error)
- func (b *MockBucket) Reset()
- type MockFileRepository
- func (m *MockFileRepository) Close()
- func (m *MockFileRepository) Delete() FileRepoResponse
- func (m *MockFileRepository) Download() FileRepoResponse
- func (m *MockFileRepository) EmptyBin() FileRepoResponse
- func (m *MockFileRepository) GetAccess() FileRepoResponse
- func (m *MockFileRepository) GetFile() io.Reader
- func (m *MockFileRepository) GetPath() string
- func (m *MockFileRepository) Open() FileRepoResponse
- func (m *MockFileRepository) Save() FileRepoResponse
- func (m *MockFileRepository) ToJSON() string
- type MockFolder
- type MockGCSClient
- type MockIO
- type MockObject
- type MockObjectIterator
- type MockStationSiarRepository
- type MockWriter
- type Model
- type MongoRepository
- func (m *MongoRepository) AddItemInArray(request RepoRequest, field string, value string) RepoResponse
- func (m *MongoRepository) Aggregate(request RepoRequest) RepoResponse
- func (m *MongoRepository) Count(request RepoRequest) RepoResponse
- func (m *MongoRepository) CreateMany(dbModel RepositoryModel, list []interface{}) error
- func (m *MongoRepository) Delete(request RepoRequest) RepoResponse
- func (m *MongoRepository) DeleteAll(dbModel RepositoryModel) error
- func (m *MongoRepository) DeleteDataBasesByCollections(list []utils.Dictionary, exceptions []string) error
- func (m *MongoRepository) DeleteDatabase(connection string, database string) error
- func (m *MongoRepository) DeleteSoft(request RepoRequest) RepoResponse
- func (m *MongoRepository) Find(request RepoRequest) RepoResponse
- func (m *MongoRepository) FindOne(request RepoRequest) RepoResponse
- func (m *MongoRepository) GetCollection() (*mongo.Collection, error)
- func (m *MongoRepository) GetConnection() string
- func (m *MongoRepository) GetDB() (*mongo.Database, error)
- func (m *MongoRepository) GetDataBase() string
- func (m *MongoRepository) GetFilter(filterOptions FindOptions) (map[string]interface{}, error)
- func (m *MongoRepository) GetMongoClient()
- func (m *MongoRepository) GetOrder(filterOptions FindOptions) map[string]interface{}
- func (m *MongoRepository) GetRepoID() string
- func (m *MongoRepository) GetSize(dbModel RepositoryModel) error
- func (m *MongoRepository) GetType() RepoType
- func (m *MongoRepository) Move(request RepoRequest) RepoResponse
- func (m *MongoRepository) RemoveField(request RepoRequest, field string) RepoResponse
- func (m *MongoRepository) RemoveItemInArray(request RepoRequest, field string, value string) RepoResponse
- func (m *MongoRepository) RepoBackup(request RepoRequest, backupID string) RepoResponse
- func (m *MongoRepository) RepoRestore(request RepoRequest, backupID string) RepoResponse
- func (m *MongoRepository) SetRepoID(repoID string) error
- func (m *MongoRepository) SwitchItemInArray(request RepoRequest, field string, value string) RepoResponse
- func (m *MongoRepository) ToJSON() string
- func (m *MongoRepository) Update(request RepoRequest) RepoResponse
- func (m *MongoRepository) UpdateField(request RepoRequest, field string, value interface{}) RepoResponse
- func (m *MongoRepository) UpdateMany(request RepoRequest, values map[string]interface{}) RepoResponse
- type Notifiable
- type Notification
- type NotificationService
- type NotifyCode
- type NotifyLevel2
- type Order
- type Orders
- type Permission
- type PermissionClass
- type PermissionCloud
- func (m *PermissionCloud) AddPermission(permission Permission, user User) error
- func (m *PermissionCloud) AddUser(user User, permissionType PermissionType) error
- func (m *PermissionCloud) GetPermission(user *User) (Permission, error)
- func (m *PermissionCloud) HasDomainRestriction() bool
- func (m *PermissionCloud) HasPermission(token []string, permissionType PermissionType) bool
- func (m *PermissionCloud) HasPermission_v2(user *User, permissionType PermissionType) bool
- func (m PermissionCloud) IsEmpty() bool
- func (m *PermissionCloud) RemovePermission(id string, user User) error
- type PermissionType
- type RepoRequest
- type RepoResponse
- type RepoType
- type Repository
- type RepositoryModel
- type RolePermission
- type RolePermissions
- type SearchTerms
- type SendEmail
- type Sort
- type SourceType
- type SpaceMember
- type SpaceMembers
- type SpaceRole
- type StationRepoResponse
- type StationRepository
- type StationRequest
- type StationSiarRepository
- type StationType
- type StationWeitecRepository
- type Synchronizable
- type SysNotify
- type Tag
- type TagCloud
- type TagKey
- type TagRepo
- type TagRepoList
- type TagType
- type Tags
- func (m *Tags) AddOrReplace(tag Tag)
- func (m *Tags) AddTag(tag Tag) (bool, Tag)
- func (m *Tags) AddTags(tags Tags)
- func (m *Tags) AddValue(value string) (bool, Tag)
- func (m *Tags) Compare(tagRepos *TagRepoList)
- func (m *Tags) GetKeys() []string
- func (m *Tags) HasTag(tag Tag) bool
- func (m *Tags) HasTagAndGet(tag Tag) (bool, Tag)
- func (m *Tags) HasTagByKey(key string) bool
- func (m *Tags) HasTagByKeyAndGetTag(key string) (bool, Tag)
- func (m *Tags) Normalize(tagRepos *TagRepoList) (*Tags, error)
- func (m *Tags) RemoveDuplicates() *Tags
- func (m *Tags) ToArray() []Tag
- func (m *Tags) ToArrayByValues() []string
- func (m *Tags) Total() int
- func (m *Tags) Update(request *BaseRequest, language Language) (*Tags, error)
- type Trace
- type TraceList
- type User
- func (m *User) CheckPassword(request *BaseRequest) (*User, error)
- func (m *User) CloseSession(request *BaseRequest) BaseResponse
- func (m *User) Delete(request *BaseRequest) BaseResponse
- func (m *User) EncryptPassword() error
- func (m *User) Find(request *BaseRequest) BaseResponse
- func (m *User) FindOne(request *BaseRequest) BaseResponse
- func (m *User) FindOrCreate(request *BaseRequest) BaseResponse
- func (m *User) GetCollection() (name string, isGlobal bool)
- func (m *User) GetFindOptions(request *BaseRequest) *FindOptions
- func (m *User) GetFromMap(token map[string]interface{}) error
- func (m *User) GetNotificationUsersIDs() []string
- func (m *User) GetOne(request *BaseRequest) (*User, error)
- func (m *User) GetRepoType() RepoType
- func (m *User) GetSystemUser() (*User, error)
- func (m *User) GetUserLog() *UserLog
- func (m *User) HasSysNotify(sysNotify SysNotify) bool
- func (m *User) IsAdmin() bool
- func (m *User) IsStaff() bool
- func (m *User) IsSystem() bool
- func (m *User) IsValid() bool
- func (m *User) OpenSession(request *BaseRequest) error
- func (m *User) ToArray() []string
- func (m *User) ToJSON() string
- func (m *User) ToRaw() []byte
- func (m *User) Update(request *BaseRequest) BaseResponse
- func (m *User) UpdateRaw(request *BaseRequest) BaseResponse
- func (m *User) Validate() error
- type UserLog
- type UserLogs
- type WeatherData
- type WeatherDataResponse
- type WeatherMetric
- type WeatherObservation
- type WeatherResponse
Constants ¶
This section is empty.
Variables ¶
var ConnectionPool = []Repository{}
var FileConnectionPool = []FileRepository{}
var StationConnectionPool = []StationRepository{}
Functions ¶
func AddNotificationByText ¶
func AddNotificationByText(notifications []*Notification, destination Notifiable, message string, users []string, source string)
func AddNotifications ¶
func AddNotifications(notifications []*Notification, destination Notifiable, users []string, source string)
func CountNotifications ¶
func CountNotifications(notifications []*Notification, message string) int
func GetDefaultLanguages ¶
func GetGCPToken ¶
func GetValueToObjectId ¶
func InTimeSpan ¶
func NewError ¶
func NewError(i Notifiable, message string, users []string, source string) *[]*Notification
func NewInfo ¶
func NewInfo(i Notifiable, message string, users []string, source string) *[]*Notification
func NewNotification ¶
func NewNotification(notifications []*Notification, message *Message) *[]*Notification
func NewWarning ¶
func NewWarning(i Notifiable, message string, users []string, source string) *[]*Notification
func NewWarningWithCode ¶
func NewWarningWithCode(i Notifiable, message string, code NotifyCode, users []string, source string) *[]*Notification
func Notify ¶
func Notify(i Notifiable, message *Message, users []string, source string) *[]*Notification
func ParseMapToStruct ¶
func SendNotificationToUser ¶
SendNotificationToUser sends a notification using the default service
func SetNotificationService ¶
func SetNotificationService(service NotificationService)
SetNotificationService sets the global notification service
func UpdateBaseList ¶
func UpdateBaseList(model ListItemModel, list interface{}) error
Types ¶
type BaseModel ¶
type BaseModel struct {
ID *primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
UserLogs `bson:",inline"`
Language Language `json:"language,omitempty" bson:"language,omitempty"`
// Refers to other system for synchronization
ExternalID string `json:"external_id,omitempty" bson:"external_id,omitempty"`
SyncAt *time.Time `json:"sync_at,omitempty" bson:"sync_at,omitempty"`
Labels *Labels `json:"labels" bson:"labels,omitempty"`
Tags *Tags `json:"tags" bson:"tags,omitempty"`
// Relations with others in same collection
FamilyID string `json:"family_id,omitempty" bson:"family_id,omitempty"`
// Store domain of the model
RepoID string `json:"repo_id,omitempty" bson:"repo_id,omitempty"`
// REMOVE
OriginRepoID string `json:"origin_repo_id,omitempty" bson:"origin_repo_id,omitempty"`
// Interface connection with other collections
SourceID string `json:"source_id,omitempty" bson:"source_id"`
SourceType SourceType `json:"source_tlabype,omitempty" bson:"source_type,omitempty"`
Version int `json:"version,omitempty" bson:"version,omitempty"`
Touched bool `json:"touched,omitempty" bson:"-"`
ParentID string `json:"parent_id" bson:"parent_id,omitempty"`
LabelsNot *Labels `json:"labels_not,omitempty" bson:"-"`
}
func (*BaseModel) BaseAddItemInArray ¶
func (m *BaseModel) BaseAddItemInArray(request *BaseRequest) BaseResponse
func (*BaseModel) BaseCount ¶
func (m *BaseModel) BaseCount(request *BaseRequest) BaseResponse
func (*BaseModel) BaseDelete ¶
func (m *BaseModel) BaseDelete(request BaseRequest) BaseResponse
func (*BaseModel) BaseDeleteSoft ¶
func (m *BaseModel) BaseDeleteSoft(request BaseRequest) BaseResponse
func (*BaseModel) BaseFind ¶
func (m *BaseModel) BaseFind(request *BaseRequest) BaseResponse
func (*BaseModel) BaseFindOne ¶
func (m *BaseModel) BaseFindOne(request BaseRequest) BaseResponse
func (*BaseModel) BaseRemoveField ¶
func (m *BaseModel) BaseRemoveField(request BaseRequest, field string) BaseResponse
func (*BaseModel) BaseRemoveItemInArray ¶
func (m *BaseModel) BaseRemoveItemInArray(request *BaseRequest, field string, value string) BaseResponse
func (*BaseModel) BaseSwitchItemInArray ¶
func (m *BaseModel) BaseSwitchItemInArray(request *BaseRequest, field string, value string) BaseResponse
func (*BaseModel) BaseUpdate ¶
func (m *BaseModel) BaseUpdate(request BaseRequest) BaseResponse
func (*BaseModel) BaseUpdateField ¶
func (m *BaseModel) BaseUpdateField(request BaseRequest, field string, value interface{}) BaseResponse
func (*BaseModel) BaseUpdateMany ¶
func (m *BaseModel) BaseUpdateMany(request BaseRequest, values map[string]interface{}) BaseResponse
func (*BaseModel) BecomeNewButKeepID ¶
func (m *BaseModel) BecomeNewButKeepID()
func (*BaseModel) CompareLabels ¶
func (*BaseModel) GetBaseFindOptions ¶
func (m *BaseModel) GetBaseFindOptions(request *BaseRequest) *FindOptions
func (*BaseModel) GetExternalID ¶
func (*BaseModel) LabelFromStrings ¶
func (*BaseModel) LabelTotal ¶
func (*BaseModel) PrepareForSync ¶
func (*BaseModel) SetCreated ¶
func (*BaseModel) SetDeleted ¶
func (*BaseModel) SetRecover ¶
func (*BaseModel) SetUpdated ¶
func (*BaseModel) ValidateBase ¶
type BaseRequest ¶
type BaseRequest struct {
ID *primitive.ObjectID
SourceID string
PageSize int64
CurrentPage int64
Order *Orders
SearchTerms SearchTerms
Repo Repository
SpaceID string
IncludeDeleted bool
NotNilFields []string
Language Language
IDs interface{}
ExcludedIDs []*primitive.ObjectID
User User
Model RepositoryModel
List interface{}
TargetCollection string
// Puede cambiar el campo ID que por defecto es "_id"
QueryField string
QueryValues interface{}
Target string
DateRange
HTTPClient interface{}
Max int
Min int
Total int
Message string
// contains filtered or unexported fields
}
func NewBaseRequest ¶
func NewBaseRequest(model RepositoryModel, repo Repository, user User) (*BaseRequest, error)
func NewBaseRequestWithModel ¶
func NewBaseRequestWithModel(model RepositoryModel, user User) (*BaseRequest, error)
func (*BaseRequest) AddOrderAsc ¶
func (m *BaseRequest) AddOrderAsc(fields ...string)
func (*BaseRequest) AddOrderDesc ¶
func (m *BaseRequest) AddOrderDesc(fields ...string)
func (*BaseRequest) Clone ¶
func (m *BaseRequest) Clone(model RepositoryModel) (*BaseRequest, error)
func (*BaseRequest) CloneModelToNewDomain ¶
func (m *BaseRequest) CloneModelToNewDomain(domain string) (*BaseRequest, error)
func (*BaseRequest) GetFindOptions ¶
func (m *BaseRequest) GetFindOptions() *FindOptions
func (*BaseRequest) GetObjectsIDs ¶
func (m *BaseRequest) GetObjectsIDs() []*primitive.ObjectID
func (*BaseRequest) GetRepoRequest ¶
func (m *BaseRequest) GetRepoRequest() RepoRequest
func (*BaseRequest) HasIDs ¶
func (m *BaseRequest) HasIDs() bool
func (*BaseRequest) SetFindOptions ¶
func (m *BaseRequest) SetFindOptions(findOptions *FindOptions)
func (*BaseRequest) ToJSON ¶
func (m *BaseRequest) ToJSON() string
func (*BaseRequest) Validate ¶
func (m *BaseRequest) Validate() error
type BaseResponse ¶
type BaseResponse struct {
Code int `json:"code"`
Message string `json:"message"`
// Es un error crítico
StrError string `json:"str_error"`
Error error `json:"error"`
// Son errores no críticos
Errors []error `json:"errors"`
TotalRows int64 `json:"total_rows"`
TotalPages int64 `json:"total_pages"`
PageSize int64 `json:"page_size"`
CurrentPage int64 `json:"current_page"`
List interface{} `json:"list"`
Token string `json:"token"`
ExternalToken string `json:"external_token"`
Status string `json:"status"`
}
func NewBaseResponse ¶
func NewBaseResponse() *BaseResponse
func NewBaseResponseFromError ¶
func NewBaseResponseFromError(err error) BaseResponse
func NewBaseResponseFromErrorStr ¶
func NewBaseResponseFromErrorStr(err string) BaseResponse
func NewBaseResponseFromErrorWithCode ¶
func NewBaseResponseFromErrorWithCode(err error, code int) BaseResponse
func NewBaseResponseFromModel ¶
func NewBaseResponseFromModel(model interface{}) BaseResponse
func NewBaseResponseFromModelAndError ¶
func NewBaseResponseFromModelAndError(model interface{}, err error) BaseResponse
func NewBaseResponseFromRepoResponse ¶
func NewBaseResponseFromRepoResponse(repoResponse RepoResponse) BaseResponse
func (*BaseResponse) AppendToList ¶
func (m *BaseResponse) AppendToList(item interface{})
func (*BaseResponse) GetAtIndex ¶
func (m *BaseResponse) GetAtIndex(index int, model interface{}) error
func (*BaseResponse) GetFirst ¶
func (m *BaseResponse) GetFirst(model interface{}) error
func (*BaseResponse) GetList ¶
func (m *BaseResponse) GetList(list interface{}) error
func (*BaseResponse) GetListInterface ¶
func (m *BaseResponse) GetListInterface() List
func (*BaseResponse) Merge ¶
func (m *BaseResponse) Merge(response BaseResponse) BaseResponse
func (*BaseResponse) SetError ¶
func (m *BaseResponse) SetError(err error)
func (*BaseResponse) ToJSON ¶
func (m *BaseResponse) ToJSON() string
type ConfigType ¶
const ( ConfigTypeNone ConfigType = "" ConfigTypeTag ConfigType = "config_type_tag" ConfigTypeDictionary ConfigType = "config_type_dictionary" )
type CustomerWelcome ¶
type CustomerWelcome struct {
Email EmailSender
}
func (*CustomerWelcome) Welcome ¶
func (welcomer *CustomerWelcome) Welcome(name, email string) error
type DateRange ¶
type DateRange struct {
StartDate *time.Time `json:"start_date,omitempty" bson:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty" bson:"end_date,omitempty"`
}
func NewDataRangeThisWeek ¶
func NewDateRangeFromStr ¶
func NewDateRangeFullDay ¶
func NewDateRangeFullWeek ¶
func (DateRange) AdjustHours ¶
func (DateRange) Difference ¶
func (DateRange) ExtractSuccessiveMonthDates ¶
func (*DateRange) GetDateRangeInWeek ¶
func (DateRange) GetEndYear ¶
func (DateRange) GetFutureDateRange ¶
func (DateRange) GetFutureYearDateRange ¶
func (DateRange) GetPreviousDateRange ¶
func (DateRange) GetPreviousYearDateRange ¶
func (DateRange) GetStartYear ¶
func (DateRange) IsEqualOmitTime ¶
func (*DateRange) IsNextDateRange ¶
func (*DateRange) IsPreviousDateRange ¶
func (*DateRange) RecalcDateLimits ¶
type Dictionaries ¶
type Dictionaries []Dictionary
func (Dictionaries) ToRaw ¶
func (m Dictionaries) ToRaw() []byte
type Dictionary ¶
func NewDictionary ¶
func NewDictionary(tag Tag, group int) (*Dictionary, error)
func (*Dictionary) ToJSON ¶
func (m *Dictionary) ToJSON() string
func (*Dictionary) ToRaw ¶
func (m *Dictionary) ToRaw() []byte
func (*Dictionary) Validate ¶
func (m *Dictionary) Validate() error
type DictionaryRepo ¶
type DictionaryRepo struct {
ConfigType ConfigType `json:"config_type" bson:"config_type"`
BaseModel `bson:",inline"`
DictionaryType DictionaryType `json:"dictionary_type" bson:"dictionary_type"`
DictionarySecondaryType AuditType `json:"dictionary_secondary_type" bson:"dictionary_secondary_type"`
Dictionaries Dictionaries `json:"dictionaries" bson:"dictionaries"`
}
func GetDictionaryRepo ¶
func GetDictionaryRepo(request *BaseRequest, dictionaryType DictionaryType, auditType AuditType, language Language) (*DictionaryRepo, error)
func NewDictionaryRepo ¶
func NewDictionaryRepo(dictionaryType DictionaryType, dictionaries Dictionaries) (*DictionaryRepo, error)
func (*DictionaryRepo) Delete ¶
func (m *DictionaryRepo) Delete(request *BaseRequest) BaseResponse
func (*DictionaryRepo) Find ¶
func (m *DictionaryRepo) Find(request *BaseRequest) BaseResponse
func (*DictionaryRepo) FindOne ¶
func (m *DictionaryRepo) FindOne(request *BaseRequest) BaseResponse
func (*DictionaryRepo) FindOrCreate ¶
func (m *DictionaryRepo) FindOrCreate(request *BaseRequest) BaseResponse
func (*DictionaryRepo) GetCollection ¶
func (m *DictionaryRepo) GetCollection() (name string, isGlobal bool)
func (*DictionaryRepo) GetDictionaryByTag ¶
func (m *DictionaryRepo) GetDictionaryByTag(tag Tag) (dictionary Dictionary, err error)
func (*DictionaryRepo) GetDictionaryByTagValueOrNumber ¶
func (m *DictionaryRepo) GetDictionaryByTagValueOrNumber(value string, number int) (dictionary *Dictionary, err error)
func (*DictionaryRepo) GetFindOptions ¶
func (m *DictionaryRepo) GetFindOptions(request *BaseRequest) *FindOptions
func (*DictionaryRepo) GetRepoType ¶
func (m *DictionaryRepo) GetRepoType() RepoType
func (*DictionaryRepo) ToJSON ¶
func (m *DictionaryRepo) ToJSON() string
func (*DictionaryRepo) Update ¶
func (m *DictionaryRepo) Update(request *BaseRequest) BaseResponse
func (*DictionaryRepo) UpdateMany ¶
func (m *DictionaryRepo) UpdateMany(request *BaseRequest, values map[string]interface{}) BaseResponse
func (*DictionaryRepo) Validate ¶
func (m *DictionaryRepo) Validate() error
type DictionaryType ¶
const ( DictionaryTypeNone DictionaryType = "" DictionaryTypeImpact DictionaryType = "dictionary_type_impact" DictionaryTypeProbability DictionaryType = "dictionary_type_probability" DictionaryTypeRating DictionaryType = "dictionary_type_rating" DictionaryTypeRI DictionaryType = "dictionary_type_ri" DictionaryTypeRC DictionaryType = "dictionary_type_rc" DictionaryTypeRcStrength DictionaryType = "dictionary_type_rc_strength" DictionaryTypeRcEvaluation DictionaryType = "dictionary_type_rc_evaluation" DictionaryTypeRcEfficiency DictionaryType = "dictionary_type_rc_efficiency" )
func GetDictionaryType ¶
func GetDictionaryType(name string) (DictionaryType, error)
type EmailSender ¶
type FileRepoRequest ¶
type FileRepoRequest struct {
FileID string
Folder string
FileName string
File io.Reader
RepoType FileRepoType
User User
}
func (*FileRepoRequest) ToJSON ¶
func (m *FileRepoRequest) ToJSON() string
type FileRepoResponse ¶
type FileRepoType ¶
const ( FileRepoNone FileRepoType = "" FileRepoLocal FileRepoType = "file_repo_local" FileRepoS3 FileRepoType = "file_repo_s3" FileRepoGoogle FileRepoType = "file_repo_google" FileRepoOffice365 FileRepoType = "file_repo_office365" FileRepoMockup FileRepoType = "file_repo_mockup" )
func (FileRepoType) GetFileRepoType ¶
func (m FileRepoType) GetFileRepoType(s string) FileRepoType
type FileRepository ¶
type FileRepository interface {
Save() FileRepoResponse
Delete() FileRepoResponse
EmptyBin() FileRepoResponse
GetAccess() FileRepoResponse
Download() FileRepoResponse
GetPath() string
GetFile() io.Reader
Open() FileRepoResponse
Close()
}
func NewFileRepository ¶
func NewFileRepository(request FileRepoRequest) (FileRepository, error)
type Filter ¶
type Filter struct {
Key string `json:"key"`
Operator FilterOperator `json:"operator"`
Value interface{} `json:"value"`
}
type FilterOperator ¶
const ( FilterOperatorEquals FilterOperator = "=" FilterOperatorEqualsWithCaseInsensitive FilterOperator = "equal_ci" FilterOperatorNotEquals FilterOperator = "!=" FilterOperatorIn FilterOperator = "in" FilterOperatorNotIn FilterOperator = "not_in" FilterOperatorSize FilterOperator = "size" FilterOperatorGreat FilterOperator = "greater" FilterOperatorLess FilterOperator = "less" FilterOperatorGreatOrEqual FilterOperator = "greater_or_equal" FilterOperatorLessOrEqual FilterOperator = "less_or_equal" FilterOperatorAll FilterOperator = "all" FilterOperatorContains FilterOperator = "contains" FilterOperatorGroupsOfArrays FilterOperator = "groups_of_arrays" FilterOperatorGroupBy FilterOperator = "group_by" FilterOperatorNotNil FilterOperator = "not_nil" FilterOperatorNil FilterOperator = "nil" )
type FindOptions ¶
type FindOptions struct {
Filters []Filter `json:"filters"`
FiltersOr []FilterOr `json:"filters_or"`
Order *Orders `json:"order"`
Pipeline interface{} `json:"pipeline"`
}
func NewFindOptions ¶
func NewFindOptions() *FindOptions
func (*FindOptions) AddAll ¶
func (m *FindOptions) AddAll(name string, value interface{})
func (*FindOptions) AddComplex ¶
func (m *FindOptions) AddComplex(name string, operation FilterOperator, value interface{})
func (*FindOptions) AddEquals ¶
func (m *FindOptions) AddEquals(name string, value interface{})
func (*FindOptions) AddEqualsCI ¶
func (m *FindOptions) AddEqualsCI(name string, value interface{})
AddEqualsCI adds a filter to the FindOptions that matches the specified field with the given value, ignoring case.
func (*FindOptions) AddGreat ¶
func (m *FindOptions) AddGreat(name string, value interface{})
func (*FindOptions) AddGreatOrEqual ¶
func (m *FindOptions) AddGreatOrEqual(name string, value interface{})
func (*FindOptions) AddIn ¶
func (m *FindOptions) AddIn(name string, value interface{})
func (*FindOptions) AddLess ¶
func (m *FindOptions) AddLess(name string, value interface{})
func (*FindOptions) AddLessOrEqual ¶
func (m *FindOptions) AddLessOrEqual(name string, value interface{})
func (*FindOptions) AddMultiple ¶
func (m *FindOptions) AddMultiple(value FilterOr)
func (*FindOptions) AddNil ¶
func (m *FindOptions) AddNil(name string)
func (*FindOptions) AddNotEquals ¶
func (m *FindOptions) AddNotEquals(name string, value interface{})
func (*FindOptions) AddNotNil ¶
func (m *FindOptions) AddNotNil(name string)
func (*FindOptions) AddOrderAsc ¶
func (m *FindOptions) AddOrderAsc(fields ...string)
func (*FindOptions) AddOrderDesc ¶
func (m *FindOptions) AddOrderDesc(fields ...string)
func (*FindOptions) AddRange ¶
func (m *FindOptions) AddRange(nameFrom string, valueFrom interface{}, nameTo string, valueTo interface{})
func (*FindOptions) GetTotalOrders ¶
func (m *FindOptions) GetTotalOrders() int64
func (*FindOptions) Remove ¶
func (m *FindOptions) Remove(key string)
func (*FindOptions) ToJSON ¶
func (m *FindOptions) ToJSON() string
type GCSBucketAdapter ¶ added in v1.5.0
type GCSBucketAdapter struct {
*storage.BucketHandle
}
func (*GCSBucketAdapter) Object ¶ added in v1.5.0
func (a *GCSBucketAdapter) Object(name string) GCSObjectInterface
func (*GCSBucketAdapter) Objects ¶ added in v1.5.0
func (a *GCSBucketAdapter) Objects(ctx context.Context, query *storage.Query) GCSObjectIteratorInterface
type GCSBucketInterface ¶ added in v1.5.0
type GCSBucketInterface interface {
Object(name string) GCSObjectInterface
Objects(ctx context.Context, query *storage.Query) GCSObjectIteratorInterface
}
GCSBucketInterface representa un bucket de GCS
type GCSClientAdapter ¶ added in v1.5.0
Adaptadores para que storage.Client implemente GCSClientInterface
func (*GCSClientAdapter) Bucket ¶ added in v1.5.0
func (a *GCSClientAdapter) Bucket(name string) GCSBucketInterface
type GCSClientInterface ¶ added in v1.5.0
type GCSClientInterface interface {
Bucket(name string) GCSBucketInterface
Close() error
}
GCSClientInterface permite inyectar un mock para tests
type GCSFileRepository ¶
type GCSFileRepository struct {
FileID string
FileName string
Path string
File io.Reader
RepositoryPath string
User User
// contains filtered or unexported fields
}
func NewGCSFileRepository ¶
func NewGCSFileRepository(request FileRepoRequest) (GCSFileRepository, error)
func (*GCSFileRepository) Close ¶
func (m *GCSFileRepository) Close()
func (*GCSFileRepository) Connect ¶
func (m *GCSFileRepository) Connect() error
func (*GCSFileRepository) Delete ¶
func (m *GCSFileRepository) Delete() FileRepoResponse
func (*GCSFileRepository) Download ¶
func (m *GCSFileRepository) Download() FileRepoResponse
func (*GCSFileRepository) EmptyBin ¶
func (m *GCSFileRepository) EmptyBin() FileRepoResponse
func (*GCSFileRepository) GetAccess ¶
func (m *GCSFileRepository) GetAccess() FileRepoResponse
func (*GCSFileRepository) GetFile ¶
func (m *GCSFileRepository) GetFile() io.Reader
func (*GCSFileRepository) GetPath ¶
func (m *GCSFileRepository) GetPath() string
func (*GCSFileRepository) Mount ¶
func (m *GCSFileRepository) Mount(fileID string, fileName string, path string, repositoryPath string)
func (*GCSFileRepository) Open ¶
func (m *GCSFileRepository) Open() FileRepoResponse
func (*GCSFileRepository) Save ¶
func (m *GCSFileRepository) Save() FileRepoResponse
func (*GCSFileRepository) ToJSON ¶
func (m *GCSFileRepository) ToJSON() string
type GCSObjectAdapter ¶ added in v1.5.0
type GCSObjectAdapter struct {
*storage.ObjectHandle
}
func (*GCSObjectAdapter) Attrs ¶ added in v1.5.0
func (a *GCSObjectAdapter) Attrs(ctx context.Context) (*storage.ObjectAttrs, error)
type GCSObjectInterface ¶ added in v1.5.0
type GCSObjectInterface interface {
Delete(ctx context.Context) error
Attrs(ctx context.Context) (*storage.ObjectAttrs, error)
}
GCSObjectInterface representa un objeto en GCS
type GCSObjectIteratorInterface ¶ added in v1.5.0
type GCSObjectIteratorInterface interface {
Next() (*storage.ObjectAttrs, error)
}
GCSObjectIteratorInterface representa un iterador de objetos
type Label ¶
const ( LabelNone Label = "" LabelClient Label = "client" LabelEnterprise Label = "enterprise" LabelContactPerson Label = "contact_person" LabelField Label = "field" LabelPlot Label = "plot" LabelDomain Label = "domain" LabelUser Label = "user" LabelSystem Label = "system" LabelMember Label = "member" LabelHidden Label = "hidden" LabelHeritage Label = "heritage" LabelGuest Label = "guest" LabelStaff Label = "staff" LabelAdmin Label = "admin" LabelProcesable Label = "procesable" LabelTemplate Label = "template" LabelSpaceRole Label = "space_role" LabelGlobal Label = "global" LabelQueued Label = "queued" LabelEpicTask Label = "epic_task" LabelCompleted Label = "completed" LabelInactive Label = "inactive" LabelLink Label = "link" LabelDraft Label = "draft" LabelError Label = "error" LabelSupport Label = "support" LabelNoData Label = "no_data" LabelNeedRefresh Label = "need_refresh" )
func NewLabelFromString ¶
type Language ¶
type Language string
func GetTemplatesLanguages ¶
func GetTemplatesLanguages() []Language
func GetTranslatedLanguages ¶
func GetTranslatedLanguages() []Language
func NewLanguage ¶
type ListItem ¶
type ListItemModel ¶
type LocalFileRepository ¶
type LocalFileRepository struct {
FileID string
FileName string
Path string
File io.Reader
RepositoryPath string
}
func NewLocalFileRepository ¶
func NewLocalFileRepository(request FileRepoRequest) (LocalFileRepository, error)
func (*LocalFileRepository) Close ¶
func (m *LocalFileRepository) Close()
func (*LocalFileRepository) Delete ¶
func (m *LocalFileRepository) Delete() FileRepoResponse
func (*LocalFileRepository) Download ¶
func (m *LocalFileRepository) Download() FileRepoResponse
func (*LocalFileRepository) EmptyBin ¶
func (m *LocalFileRepository) EmptyBin() FileRepoResponse
func (*LocalFileRepository) GetAccess ¶
func (m *LocalFileRepository) GetAccess() FileRepoResponse
func (*LocalFileRepository) GetFile ¶
func (m *LocalFileRepository) GetFile() io.Reader
func (*LocalFileRepository) GetPath ¶
func (m *LocalFileRepository) GetPath() string
func (*LocalFileRepository) Open ¶
func (m *LocalFileRepository) Open() FileRepoResponse
func (*LocalFileRepository) Save ¶
func (m *LocalFileRepository) Save() FileRepoResponse
func (*LocalFileRepository) ToJSON ¶
func (m *LocalFileRepository) ToJSON() string
type Message ¶
type Message struct {
Text string
Level NotifyLevel2
Code NotifyCode
}
type MockBucket ¶ added in v1.5.0
type MockBucket struct {
Name string
ObjectsMap map[string]*MockObject
// contains filtered or unexported fields
}
MockBucket simula storage.BucketHandle
func (*MockBucket) CountNonDeletedObjects ¶ added in v1.5.0
func (b *MockBucket) CountNonDeletedObjects() int
CountNonDeletedObjects cuenta objetos no eliminados (helper para tests)
func (*MockBucket) GetAllObjects ¶ added in v1.5.0
func (b *MockBucket) GetAllObjects() map[string]*MockObject
GetAllObjects retorna todos los objetos del bucket (helper para tests)
func (*MockBucket) Object ¶ added in v1.5.0
func (b *MockBucket) Object(path string) GCSObjectInterface
Object retorna o crea un objeto mock
func (*MockBucket) Objects ¶ added in v1.5.0
func (b *MockBucket) Objects(ctx context.Context, query *storage.Query) GCSObjectIteratorInterface
Objects retorna un iterador de objetos que coinciden con el query
func (*MockBucket) ReadObject ¶ added in v1.5.0
func (b *MockBucket) ReadObject(path string) ([]byte, error)
ReadObject lee el contenido de un objeto (helper para tests)
func (*MockBucket) Reset ¶ added in v1.5.0
func (b *MockBucket) Reset()
Reset limpia todos los objetos del bucket (helper para tests)
type MockFileRepository ¶
func NewMockupFileRepository ¶
func NewMockupFileRepository(request FileRepoRequest) (MockFileRepository, error)
func (*MockFileRepository) Close ¶
func (m *MockFileRepository) Close()
func (*MockFileRepository) Delete ¶
func (m *MockFileRepository) Delete() FileRepoResponse
func (*MockFileRepository) Download ¶
func (m *MockFileRepository) Download() FileRepoResponse
func (*MockFileRepository) EmptyBin ¶
func (m *MockFileRepository) EmptyBin() FileRepoResponse
func (*MockFileRepository) GetAccess ¶
func (m *MockFileRepository) GetAccess() FileRepoResponse
func (*MockFileRepository) GetFile ¶
func (m *MockFileRepository) GetFile() io.Reader
func (*MockFileRepository) GetPath ¶
func (m *MockFileRepository) GetPath() string
func (*MockFileRepository) Open ¶
func (m *MockFileRepository) Open() FileRepoResponse
func (*MockFileRepository) Save ¶
func (m *MockFileRepository) Save() FileRepoResponse
func (*MockFileRepository) ToJSON ¶
func (m *MockFileRepository) ToJSON() string
type MockFolder ¶
type MockGCSClient ¶ added in v1.5.0
type MockGCSClient struct {
Buckets map[string]*MockBucket
// contains filtered or unexported fields
}
MockGCSClient simula storage.Client para tests
func NewMockGCSClient ¶ added in v1.5.0
func NewMockGCSClient() *MockGCSClient
NewMockGCSClient crea un nuevo cliente GCS mock
func (*MockGCSClient) Bucket ¶ added in v1.5.0
func (m *MockGCSClient) Bucket(name string) GCSBucketInterface
Bucket retorna o crea un bucket mock
func (*MockGCSClient) Close ¶ added in v1.5.0
func (m *MockGCSClient) Close() error
Close simula el cierre del cliente
func (*MockGCSClient) GetBucket ¶ added in v1.5.0
func (m *MockGCSClient) GetBucket(name string) *MockBucket
GetBucket retorna el bucket mock real (helper para tests)
type MockIO ¶
type MockIO struct {
Folders []*MockFolder
}
func (*MockIO) AddFile ¶
func (m *MockIO) AddFile(repo MockFileRepository) error
func (*MockIO) CountFiles ¶
func (*MockIO) Delete ¶
func (m *MockIO) Delete(repo MockFileRepository) error
type MockObject ¶ added in v1.5.0
type MockObject struct {
Path string
Data []byte
Deleted bool
// contains filtered or unexported fields
}
MockObject simula storage.ObjectHandle
func (*MockObject) Attrs ¶ added in v1.5.0
func (o *MockObject) Attrs(ctx context.Context) (*storage.ObjectAttrs, error)
Attrs retorna los atributos del objeto
func (*MockObject) Delete ¶ added in v1.5.0
func (o *MockObject) Delete(ctx context.Context) error
Delete marca el objeto como eliminado
func (*MockObject) NewWriter ¶ added in v1.5.0
func (o *MockObject) NewWriter(ctx context.Context) *MockWriter
NewWriter crea un nuevo writer mock para este objeto
type MockObjectIterator ¶ added in v1.5.0
type MockObjectIterator struct {
// contains filtered or unexported fields
}
MockObjectIterator simula el iterador de objetos
func (*MockObjectIterator) Next ¶ added in v1.5.0
func (it *MockObjectIterator) Next() (*storage.ObjectAttrs, error)
Next retorna el siguiente objeto en el iterador
type MockStationSiarRepository ¶
type MockStationSiarRepository struct {
APIKey string
BaseURL string
StationName string
DateRange *DateRange
}
func NewMockStationSIARRepository ¶
func NewMockStationSIARRepository(request StationRequest) (MockStationSiarRepository, error)
func (*MockStationSiarRepository) GetData ¶
func (m *MockStationSiarRepository) GetData() StationRepoResponse
func (*MockStationSiarRepository) ToJSON ¶
func (m *MockStationSiarRepository) ToJSON() string
type MockWriter ¶ added in v1.5.0
type MockWriter struct {
Object *MockObject
Buffer *bytes.Buffer
Closed bool
ChunkSize int
// contains filtered or unexported fields
}
MockWriter simula storage.Writer
func (*MockWriter) Close ¶ added in v1.5.0
func (w *MockWriter) Close() error
Close finaliza la escritura y guarda los datos en el objeto
type MongoRepository ¶
type MongoRepository struct {
Error error
ConnectionString string
RepoID string
DataBase string
Collection string
// contains filtered or unexported fields
}
func NewMongoRepository ¶
func NewMongoRepository(connection string, repoID string, collection string, isGlobal bool) MongoRepository
func (*MongoRepository) AddItemInArray ¶
func (m *MongoRepository) AddItemInArray(request RepoRequest, field string, value string) RepoResponse
func (*MongoRepository) Aggregate ¶
func (m *MongoRepository) Aggregate(request RepoRequest) RepoResponse
func (*MongoRepository) Count ¶
func (m *MongoRepository) Count(request RepoRequest) RepoResponse
func (*MongoRepository) CreateMany ¶
func (m *MongoRepository) CreateMany(dbModel RepositoryModel, list []interface{}) error
func (*MongoRepository) Delete ¶
func (m *MongoRepository) Delete(request RepoRequest) RepoResponse
func (*MongoRepository) DeleteAll ¶
func (m *MongoRepository) DeleteAll(dbModel RepositoryModel) error
func (*MongoRepository) DeleteDataBasesByCollections ¶
func (m *MongoRepository) DeleteDataBasesByCollections(list []utils.Dictionary, exceptions []string) error
func (*MongoRepository) DeleteDatabase ¶
func (m *MongoRepository) DeleteDatabase(connection string, database string) error
func (*MongoRepository) DeleteSoft ¶
func (m *MongoRepository) DeleteSoft(request RepoRequest) RepoResponse
func (*MongoRepository) Find ¶
func (m *MongoRepository) Find(request RepoRequest) RepoResponse
func (*MongoRepository) FindOne ¶
func (m *MongoRepository) FindOne(request RepoRequest) RepoResponse
func (*MongoRepository) GetCollection ¶
func (m *MongoRepository) GetCollection() (*mongo.Collection, error)
func (*MongoRepository) GetConnection ¶
func (m *MongoRepository) GetConnection() string
func (*MongoRepository) GetDataBase ¶
func (m *MongoRepository) GetDataBase() string
func (*MongoRepository) GetFilter ¶
func (m *MongoRepository) GetFilter(filterOptions FindOptions) (map[string]interface{}, error)
func (*MongoRepository) GetMongoClient ¶
func (m *MongoRepository) GetMongoClient()
func (*MongoRepository) GetOrder ¶
func (m *MongoRepository) GetOrder(filterOptions FindOptions) map[string]interface{}
func (*MongoRepository) GetRepoID ¶
func (m *MongoRepository) GetRepoID() string
func (*MongoRepository) GetSize ¶
func (m *MongoRepository) GetSize(dbModel RepositoryModel) error
func (*MongoRepository) GetType ¶
func (m *MongoRepository) GetType() RepoType
func (*MongoRepository) Move ¶
func (m *MongoRepository) Move(request RepoRequest) RepoResponse
func (*MongoRepository) RemoveField ¶
func (m *MongoRepository) RemoveField(request RepoRequest, field string) RepoResponse
func (*MongoRepository) RemoveItemInArray ¶
func (m *MongoRepository) RemoveItemInArray(request RepoRequest, field string, value string) RepoResponse
func (*MongoRepository) RepoBackup ¶
func (m *MongoRepository) RepoBackup(request RepoRequest, backupID string) RepoResponse
func (*MongoRepository) RepoRestore ¶
func (m *MongoRepository) RepoRestore(request RepoRequest, backupID string) RepoResponse
func (*MongoRepository) SetRepoID ¶
func (m *MongoRepository) SetRepoID(repoID string) error
func (*MongoRepository) SwitchItemInArray ¶
func (m *MongoRepository) SwitchItemInArray(request RepoRequest, field string, value string) RepoResponse
func (*MongoRepository) ToJSON ¶
func (m *MongoRepository) ToJSON() string
func (*MongoRepository) Update ¶
func (m *MongoRepository) Update(request RepoRequest) RepoResponse
func (*MongoRepository) UpdateField ¶
func (m *MongoRepository) UpdateField(request RepoRequest, field string, value interface{}) RepoResponse
func (*MongoRepository) UpdateMany ¶
func (m *MongoRepository) UpdateMany(request RepoRequest, values map[string]interface{}) RepoResponse
type Notifiable ¶
type Notifiable interface {
GetNotifications() *[]*Notification
}
Para poder modificar el array debe ser un puntero
type Notification ¶
type Notification struct {
Text string `json:"text" bson:"text,omitempty"`
Level NotifyLevel2 `json:"level" bson:"level,omitempty"`
Count int `json:"count" bson:"count,omitempty"`
Users []string `json:"users" bson:"users"`
Code NotifyCode `json:"code" bson:"code,omitempty"`
Source string `json:"source_id" bson:"source_id,omitempty"`
Viewed *time.Time `json:"viewed" bson:"viewed,omitempty"`
}
func DeleteNotification ¶
func DeleteNotification(notifications []*Notification, message string) []*Notification
func DeleteNotificationByCode ¶
func DeleteNotificationByCode(notifications []*Notification, code NotifyCode) []*Notification
func DeleteNotificationIfContains ¶
func DeleteNotificationIfContains(notifications []*Notification, message string) []*Notification
func (*Notification) CloneTo ¶
func (m *Notification) CloneTo(i Notifiable, users []string, source string) *[]*Notification
func (*Notification) ToJSON ¶
func (m *Notification) ToJSON() string
type NotificationService ¶
NotificationService defines the interface for sending notifications
type NotifyLevel2 ¶
const ( NotifyLevelInfo NotifyLevel2 = "info" NotifyLevelWarning NotifyLevel2 = "warning" NotifyLevelError NotifyLevel2 = "error" )
type Permission ¶
type Permission struct {
ID string `json:"id" bson:"id"`
PermissionType PermissionType `json:"permission_type" bson:"permission_type"`
Value string `json:"value" bson:"value"`
Label Label `json:"label" bson:"label"`
}
Tags are detailed tokens for know permission information
func (Permission) HasDomainRestriction ¶
func (m Permission) HasDomainRestriction() bool
type PermissionClass ¶
const (
PermissionClassFirm PermissionClass = "permission_class_firm"
)
type PermissionCloud ¶
type PermissionCloud struct {
Permissions []Permission `json:"permissions" bson:"permissions, omitempty"`
}
A system block is a block that is not created by a user... PermissionTypeTotal is assigned to system_user
func NewPermissionCloud ¶
func NewPermissionCloud(permissions ...Permission) *PermissionCloud
func (*PermissionCloud) AddPermission ¶
func (m *PermissionCloud) AddPermission(permission Permission, user User) error
func (*PermissionCloud) AddUser ¶
func (m *PermissionCloud) AddUser(user User, permissionType PermissionType) error
func (*PermissionCloud) GetPermission ¶
func (m *PermissionCloud) GetPermission(user *User) (Permission, error)
func (*PermissionCloud) HasDomainRestriction ¶
func (m *PermissionCloud) HasDomainRestriction() bool
func (*PermissionCloud) HasPermission ¶
func (m *PermissionCloud) HasPermission(token []string, permissionType PermissionType) bool
func (*PermissionCloud) HasPermission_v2 ¶
func (m *PermissionCloud) HasPermission_v2(user *User, permissionType PermissionType) bool
func (PermissionCloud) IsEmpty ¶
func (m PermissionCloud) IsEmpty() bool
func (*PermissionCloud) RemovePermission ¶
func (m *PermissionCloud) RemovePermission(id string, user User) error
type PermissionType ¶
type PermissionType int
const ( // Incremental permissions, each level includes the previous, best with iota for comparison PermissionTypeNone PermissionType = iota PermissionTypeNoAccess // read only PermissionTypeView // comment and sign PermissionTypeComment // feedback PermissionTypeFeedback // edit but not empty bin, not recover from bin and not change permissions PermissionTypeEdit // full access except system blocks PermissionTypeFull )
type RepoRequest ¶
type RepoRequest struct {
ID string
PageSize int64
SortBy []Sort
CurrentPage int64
User User
Model RepositoryModel
FindOptions FindOptions
List interface{}
RepoID string
Pipeline interface{}
TargetCollection string
}
func (*RepoRequest) ToJSON ¶
func (m *RepoRequest) ToJSON() string
type RepoResponse ¶
type RepoResponse struct {
Error error
Errors []error
TotalRows int64
TotalPages int64
PageSize int64
CurrentPage int64
List interface{}
}
func NewRepoResponse ¶
func NewRepoResponse() (*RepoResponse, error)
func (*RepoResponse) ToJSON ¶
func (m *RepoResponse) ToJSON() string
type Repository ¶
type Repository interface {
Aggregate(request RepoRequest) RepoResponse
Find(request RepoRequest) RepoResponse
Count(request RepoRequest) RepoResponse
FindOne(request RepoRequest) RepoResponse
Update(request RepoRequest) RepoResponse
UpdateMany(request RepoRequest, values map[string]interface{}) RepoResponse
UpdateField(request RepoRequest, field string, value interface{}) RepoResponse
SwitchItemInArray(request RepoRequest, field string, value string) RepoResponse
AddItemInArray(request RepoRequest, field string, value string) RepoResponse
RemoveItemInArray(request RepoRequest, field string, value string) RepoResponse
Move(request RepoRequest) RepoResponse
Delete(request RepoRequest) RepoResponse
DeleteSoft(request RepoRequest) RepoResponse
RemoveField(request RepoRequest, field string) RepoResponse
GetFilter(filterOptions FindOptions) (map[string]interface{}, error)
GetOrder(filterOptions FindOptions) map[string]interface{}
GetType() RepoType
GetRepoID() string
GetDataBase() string
GetConnection() string
SetRepoID(value string) error
RepoBackup(request RepoRequest, backupID string) RepoResponse
RepoRestore(request RepoRequest, backupID string) RepoResponse
DeleteDatabase(connection string, database string) error
}
func CloneRepository ¶
func CloneRepository(repo Repository, model RepositoryModel) (Repository, error)
func NewRepository ¶
func NewRepositoryFromModel ¶
func NewRepositoryFromModel(model RepositoryModel, connection string) (Repository, error)
type RepositoryModel ¶
type RepositoryModel interface {
GetID() (interface{}, error)
SetID(string) error
IsNew() bool
BecomeNew()
BecomeNewButKeepID()
GetCollection() (name string, isGlobal bool)
SetCreated(user User)
SetUpdated(user User)
SetDeleted(user User)
GetRepoType() RepoType
GetRepoID() string
SetRepoID(value string)
LabelFromStrings(strings ...string)
}
type RolePermission ¶
type RolePermission struct {
PermissionID string `json:"permission_id" bson:"permission_id"`
PermissionType PermissionType `json:"permission_type" bson:"permission_type"`
Role SpaceRole `json:"role" bson:"role"`
}
func (RolePermission) HasPermission ¶
func (m RolePermission) HasPermission(permissionID string) bool
type RolePermissions ¶
type RolePermissions []RolePermission
func (RolePermissions) AddPermission ¶
func (m RolePermissions) AddPermission(permission RolePermission) RolePermissions
func (RolePermissions) GetPermission ¶
func (m RolePermissions) GetPermission(permissionID string) (RolePermission, bool)
type SearchTerms ¶
type SearchTerms []string
func (SearchTerms) Add ¶
func (m SearchTerms) Add(term string) SearchTerms
type SourceType ¶
const ( SourceTypeEnumNone SourceType = "" SourceTypeImportedData SourceType = "imported_data" // Same ID as DomainID Cloned SourceTypeDomainClone SourceType = "domain_clone" )
type SpaceMember ¶
type SpaceMembers ¶
type SpaceMembers []SpaceMember
func (SpaceMembers) AddMember ¶
func (m SpaceMembers) AddMember(user User) (SpaceMembers, bool)
func (SpaceMembers) AddRoleToMembers ¶
func (m SpaceMembers) AddRoleToMembers(userID string, role SpaceRole) (SpaceMembers, bool)
func (SpaceMembers) GetMember ¶
func (m SpaceMembers) GetMember(userID string) (SpaceMember, bool)
func (SpaceMembers) RemoveMember ¶
func (m SpaceMembers) RemoveMember(userID string) (SpaceMembers, error)
type StationRepoResponse ¶
type StationRepoResponse struct {
Error error
Content WeatherData
}
type StationRepository ¶
type StationRepository interface {
GetData() StationRepoResponse
}
func NewStationRepository ¶
func NewStationRepository(request StationRequest) (StationRepository, error)
type StationRequest ¶
type StationRequest struct {
StationName string
DateRange *DateRange
StationType StationType
}
func (*StationRequest) ToJSON ¶
func (m *StationRequest) ToJSON() string
type StationSiarRepository ¶
type StationSiarRepository struct {
APIKey string
BaseURL string
StationName string
DateRange *DateRange
}
func NewStationSIARRepository ¶
func NewStationSIARRepository(request StationRequest) (StationSiarRepository, error)
func (*StationSiarRepository) GetData ¶
func (m *StationSiarRepository) GetData() StationRepoResponse
func (*StationSiarRepository) ToJSON ¶
func (m *StationSiarRepository) ToJSON() string
type StationType ¶
const ( StationNone StationType = "" StationSIAR StationType = "station_siar" StationWeitec StationType = "station_weitec" StationMockup StationType = "station_mockup" )
func (StationType) GetStationType ¶
func (m StationType) GetStationType(s string) StationType
type StationWeitecRepository ¶
type StationWeitecRepository struct {
APIKey string
BaseURL string
StationName string
DateRange *DateRange
}
func NewStationWeitecRepository ¶
func NewStationWeitecRepository(request StationRequest) (StationWeitecRepository, error)
func (*StationWeitecRepository) GetData ¶
func (m *StationWeitecRepository) GetData() StationRepoResponse
func (*StationWeitecRepository) ToJSON ¶
func (m *StationWeitecRepository) ToJSON() string
type Synchronizable ¶
type Synchronizable interface {
LastSync() *time.Time
Sync(model interface{}) error
GetExternalID() string
Delete() RepoResponse
}
type Tag ¶
type Tag struct {
Key string `json:"key" bson:"key"`
Value string `json:"value" bson:"value"`
Group string `json:"group,omitempty" bson:"group,omitempty"`
Check bool `json:"check,omitempty" bson:"check,omitempty"`
}
func NewTagByValue ¶
func (*Tag) HasSameKey ¶
type TagCloud ¶
type TagCloud struct {
TagKeys []string `json:"tag_keys" bson:"tag_keys"`
TagValues []string `json:"tag_values" bson:"tag_values"`
Tags Tags `json:"tags" bson:"tags"`
}
func NewTagCloud ¶
func NewTagCloud() *TagCloud
func (*TagCloud) AddTagCloud ¶
type TagRepo ¶
type TagRepo struct {
TagType TagType `json:"tag_type" bson:"tag_type"`
// System tags are not editable by users at the moment and has always the same key
System bool `json:"system" bson:"system"`
Tag `bson:",inline"`
}
Esta clase contiene todo tipo de configuraciones... tags, monedas, etc.
type TagRepoList ¶
type TagRepoList struct {
List []*TagRepo `bson:",inline"`
TagList []Tag
TagType TagType
Language Language
Touched bool
RepoID string
User User
}
Must be used instead of TagRepo
type Tags ¶
type Tags []Tag
func (*Tags) AddOrReplace ¶
AddOrReplace agrega un nuevo tag o reemplaza uno existente si ya existe uno con la misma clave
func (*Tags) Compare ¶
func (m *Tags) Compare(tagRepos *TagRepoList)
func (*Tags) HasTagByKey ¶
func (*Tags) RemoveDuplicates ¶
func (*Tags) ToArrayByValues ¶
type Trace ¶
type Trace struct {
BaseModel `bson:",inline"`
Message string `json:"message" bson:"message"`
Level string `json:"level" bson:"level"`
File string `json:"file" bson:"file"`
Line int `json:"line" bson:"line"`
}
func (*Trace) GetCollection ¶
func (*Trace) GetFindOptions ¶
func (m *Trace) GetFindOptions(request *BaseRequest) FindOptions
type TraceList ¶
type TraceList struct {
BaseResponse
}
type User ¶
type User struct {
// El external ID es el ID de auth0
BaseModel `bson:",inline"`
Nick string `json:"nick" bson:"nick"`
Username string `json:"username" bson:"username"`
ContactID string `json:"contact_id" bson:"contact_id"`
Email string `json:"email" bson:"email"`
Password string `json:"password" bson:"password"`
Licenses []string `json:"licenses" bson:"licenses"`
Connection string `json:"connection" bson:"connection"`
Session DateRange `json:"session" bson:"session"`
ExternalToken string `json:"external_token" bson:"external_token"`
Avatar string `json:"avatar" bson:"avatar"`
SysNotify []SysNotify `json:"sys_notify" bson:"sys_notify"`
Roles RolePermissions `json:"roles" bson:"-"`
RolePermission
SpaceID string `json:"space_id" bson:"-"`
ChangePassword bool `json:"change_password" bson:"-"`
}
func GetUserByID ¶
func (*User) CheckPassword ¶
func (m *User) CheckPassword(request *BaseRequest) (*User, error)
func (*User) CloseSession ¶
func (m *User) CloseSession(request *BaseRequest) BaseResponse
func (*User) Delete ¶
func (m *User) Delete(request *BaseRequest) BaseResponse
func (*User) EncryptPassword ¶
func (*User) Find ¶
func (m *User) Find(request *BaseRequest) BaseResponse
func (*User) FindOne ¶
func (m *User) FindOne(request *BaseRequest) BaseResponse
func (*User) FindOrCreate ¶
func (m *User) FindOrCreate(request *BaseRequest) BaseResponse
func (*User) GetCollection ¶
func (*User) GetFindOptions ¶
func (m *User) GetFindOptions(request *BaseRequest) *FindOptions
func (*User) GetFromMap ¶
func (*User) GetNotificationUsersIDs ¶
func (*User) GetRepoType ¶
func (*User) GetSystemUser ¶
func (*User) GetUserLog ¶
func (*User) HasSysNotify ¶ added in v1.7.0
func (*User) OpenSession ¶
func (m *User) OpenSession(request *BaseRequest) error
func (*User) Update ¶
func (m *User) Update(request *BaseRequest) BaseResponse
func (*User) UpdateRaw ¶
func (m *User) UpdateRaw(request *BaseRequest) BaseResponse
type UserLogs ¶
type UserLogs struct {
CreatedBy *UserLog `json:"created_by,omitempty" bson:"created_by,omitempty"`
UpdatedBy *UserLog `json:"updated_by,omitempty" bson:"updated_by,omitempty"`
DeletedBy *UserLog `json:"deleted_by,omitempty" bson:"deleted_by,omitempty"`
LastAccess *UserLog `json:"last_access,omitempty" bson:"last_access,omitempty"`
LockedBy *UserLog `json:"locked_by,omitempty" bson:"locked_by,omitempty"`
}
type WeatherData ¶
type WeatherData struct {
Year int `json:"Año"`
Week int `json:"Semana"`
AvgTemp float64 `json:"TempMedia"`
MaxTemp float64 `json:"TempMax"`
DateTimeMaxTemp string `json:"DiaHorMinTempMax"`
MinTemp float64 `json:"TempMin"`
DateTimeMinTemp string `json:"DiaHorMinTempMin"`
AvgHumidity float64 `json:"HumedadMedia"`
MaxHumidity float64 `json:"HumedadMax"`
DateTimeMaxHum string `json:"DiaHorMinHumMax"`
MinHumidity float64 `json:"HumedadMin"`
DateTimeMinHum string `json:"DiaHorMinHumMin"`
WindSpeed float64 `json:"VelViento"`
WindDirection float64 `json:"DirViento"`
MaxWindSpeed float64 `json:"VelVientoMax"`
DateTimeMaxSpeed string `json:"DiaHorMinVelMax"`
WindDirMaxSpeed float64 `json:"DirVientoVelMax"`
Radiation float64 `json:"Radiacion"`
Precipitation float64 `json:"Precipitacion"`
EtPMon float64 `json:"EtPMon"`
PePMon float64 `json:"PePMon"`
Station string `json:"Estacion"`
}
type WeatherDataResponse ¶
type WeatherDataResponse struct {
Datos []WeatherData `json:"Datos"`
}
type WeatherMetric ¶
type WeatherMetric struct {
TempHigh float64 `json:"tempHigh"`
TempLow float64 `json:"tempLow"`
TempAvg float64 `json:"tempAvg"`
WindspeedHigh float64 `json:"windspeedHigh"`
WindspeedAvg float64 `json:"windspeedAvg"`
HumidityHigh int `json:"humidityHigh"`
HumidityLow int `json:"humidityLow"`
HumidityAvg int `json:"humidityAvg"`
}
type WeatherObservation ¶
type WeatherObservation struct {
StationID string `json:"stationID"`
ObsTimeLocal string `json:"obsTimeLocal"`
WinddirAvg float64 `json:"winddirAvg"`
Metric WeatherMetric `json:"metric"`
}
type WeatherResponse ¶
type WeatherResponse struct {
Observations []WeatherObservation `json:"observations"`
}
Source Files
¶
- base.go
- base_request.go
- base_response.go
- date_range.go
- dictionary.go
- file_repository.go
- gcp_auth.go
- gcp_file_repository.go
- gcs_interfaces.go
- label.go
- language.go
- local_file_repository.go
- mockup_file_repository.go
- mockup_gcs_repository.go
- mockup_station_siar_repository.go
- mongo_repository.go
- notification.go
- permission.go
- repository.go
- station_repository.go
- station_siar_repository.go
- station_weitec_repository.go
- tag.go
- tag_repo.go
- trace.go
- user.go