model

package
v0.0.0-...-94071ed Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APP_SERVICE_NAME = "cases"
	NAMESPACE_NAME   = "webitel"
)
View Source
const (
	ScopeDictionary   = "dictionaries"
	ScopeCases        = "cases"
	ScopeCalls        = "calls"
	ScopeCaseComments = "case_comments"
)
View Source
const (
	DefaultSearchSize = 10
)

DeafaultSearchSize is a constant integer == 10.

Variables

View Source
var (
	CurrentVersion string = versions[0]
	BuildNumber    string
)
View Source
var LoginAttemptFields = struct {
	Id         string
	Success    string
	AuthType   string
	UserIp     string
	Date       string
	User       string
	UserName   string
	UserId     string
	UserAgent  string
	DomainId   string
	DomainName string
	Details    string
}{
	Id:         "id",
	Success:    "success",
	AuthType:   "auth_type",
	UserIp:     "user_ip",
	Date:       "date",
	User:       "user",
	UserId:     "user_id",
	UserName:   "user_name",
	UserAgent:  "user_agent",
	DomainId:   "domain_id",
	DomainName: "domain_name",
	Details:    "details",
}

Functions

func BuildNumberInt

func BuildNumberInt() int

func GetAutherOutOfContext

func GetAutherOutOfContext(ctx context.Context) auth.Auther

Types

type BrokerLogMessageRequiredFields

type BrokerLogMessageRequiredFields struct {
	UserIp string `json:"userIp,omitempty"`
	Action string `json:"action,omitempty"`
	UserId int    `json:"userId,omitempty"`
	Date   int64  `json:"date,omitempty"`
}

type BrokerLoginMessage

type BrokerLoginMessage struct {
	Login    *Login  `json:"login,omitempty"`
	Status   *Status `json:"status,omitempty"`
	AuthType string  `json:"type,omitempty"`
	Agent    string  `json:"agent,omitempty"`
	From     string  `json:"from,omitempty"`
	Date     int64   `json:"date,omitempty"`
	IsNew    bool    `json:"isNew,omitempty"`
}

func (*BrokerLoginMessage) ConvertToDatabaseModel

func (m *BrokerLoginMessage) ConvertToDatabaseModel() (*LoginAttempt, cerror.AppError)

type BrokerRecordLogMessage

type BrokerRecordLogMessage struct {
	Records                        []*LogEntity `json:"records,omitempty"`
	BrokerLogMessageRequiredFields `json:"requiredFields"`
}

type BytesJSON

type BytesJSON struct {
	Body []byte
}

func (*BytesJSON) GetBody

func (b *BytesJSON) GetBody() []byte

func (*BytesJSON) UnmarshalJSON

func (b *BytesJSON) UnmarshalJSON(input []byte) error

type CreateOptions

type CreateOptions struct {
	//Session         *session.Session
	context.Context // binding
	Time            time.Time
	// output
	Fields            []string
	DerivedSearchOpts map[string]*SearchOptions
	UnknownFields     []string
	// filters
	Ids []int64
	// ParentID is the attribute to represent parent object, that creation process connected to
	ParentID int64
	// ChildID is the attribute to represent child object, that creation process connect
	ChildID int64
	Auth    auth.Auther
}

func NewCreateOptions

func NewCreateOptions(ctx context.Context, creator Creator, objMetadata ObjectMetadatter) (*CreateOptions, error)

func (*CreateOptions) CurrentTime

func (rpc *CreateOptions) CurrentTime() time.Time

func (*CreateOptions) GetAuthOpts

func (s *CreateOptions) GetAuthOpts() auth.Auther

func (*CreateOptions) SetAuthOpts

func (s *CreateOptions) SetAuthOpts(a auth.Auther) *CreateOptions

type Creator

type Creator interface {
	GetFields() []string
}

type DeleteOptions

type DeleteOptions struct {
	Time time.Time
	context.Context
	//Session *session.Session
	IDs      []int64
	ID       int64
	ParentID int64
	Auth     auth.Auther
}

func NewDeleteOptions

func NewDeleteOptions(ctx context.Context, metadatter ObjectMetadatter) (*DeleteOptions, error)

NewDeleteOptions initializes a DeleteOptions instance with the current session, context, and current time.

func (*DeleteOptions) CurrentTime

func (rpc *DeleteOptions) CurrentTime() time.Time

CurrentTime sets and returns the current time if Time is zero.

func (*DeleteOptions) GetAuthOpts

func (s *DeleteOptions) GetAuthOpts() auth.Auther

func (*DeleteOptions) SetAuthOpts

func (s *DeleteOptions) SetAuthOpts(a auth.Auther) *DeleteOptions

type Domain

type Domain struct {
	Name string `json:"name,omitempty"`
	Id   int64  `json:"id,omitempty"`
}

type Field

type Field struct {
	Name    string
	Default bool
}

type Fielder

type Fielder interface {
	GetFields() []string
}

type Lister

type Lister interface {
	Fielder
	Pager
	Searcher
	Sorter
}

type LogEntity

type LogEntity struct {
	NewState BytesJSON `json:"newState,omitempty"`
	Id       int64     `json:"id,omitempty"`
}

type Login

type Login struct {
	Id        *guid.UUID        `json:"id,omitempty"`
	Context   map[string]string `json:"context,omitempty"`
	Domain    *Domain           `json:"domain,omitempty"`
	User      *User             `json:"user,omitempty"`
	CreatedAt int64             `json:"created_at,omitempty"`
	ExpiresAt int64             `json:"expires_at,omitempty"`
	MaxAge    int64             `json:"max_age,omitempty"`
}

type LoginAttempt

type LoginAttempt struct {
	Date       time.Time
	UserId     *NullInt
	DomainId   *NullInt
	Details    *NullString
	AuthType   string
	UserIp     string
	UserName   string
	UserAgent  string
	DomainName string
	Id         int64
	Success    bool
}

type NullInt

type NullInt int64

func NewNullInt

func NewNullInt(i any) (*NullInt, error)

func (*NullInt) Int

func (t *NullInt) Int() int

IsZero value (?)

func (*NullInt) Int32

func (t *NullInt) Int32() int32

IsZero value (?)

func (*NullInt) Int64

func (t *NullInt) Int64() int64

IsZero value (?)

func (*NullInt) IsZero

func (t *NullInt) IsZero() bool

IsZero value (?)

func (*NullInt) Scan

func (t *NullInt) Scan(v interface{}) error

func (NullInt) Value

func (t NullInt) Value() (driver.Value, error)

- database/sql.Valuer

type NullString

type NullString string

func NewNullString

func NewNullString(i string) *NullString

func (*NullString) IsZero

func (t *NullString) IsZero() bool

IsZero value (?)

func (*NullString) Scan

func (t *NullString) Scan(v interface{}) error

Scan native value decoder function

func (*NullString) String

func (t *NullString) String() (v string)

Time native value (!)

func (NullString) Value

func (t NullString) Value() (driver.Value, error)

- database/sql.Valuer

type NullTime

type NullTime time.Time

func NewNullTime

func NewNullTime(i time.Time) *NullTime

func (*NullTime) IsZero

func (t *NullTime) IsZero() bool

IsZero value (?)

func (*NullTime) Scan

func (t *NullTime) Scan(v interface{}) error

Scan native value decoder function

func (*NullTime) String

func (t *NullTime) String() string

IsZero value (?)

func (*NullTime) Time

func (t *NullTime) Time() (stamp time.Time)

Time native value (!)

func (*NullTime) ToMilliseconds

func (t *NullTime) ToMilliseconds() int64

func (NullTime) Value

func (t NullTime) Value() (driver.Value, error)

- database/sql.Valuer

type ObjectMetadata

type ObjectMetadata struct {
	// contains filtered or unexported fields
}

func (*ObjectMetadata) GetAllFields

func (o *ObjectMetadata) GetAllFields() []string

func (*ObjectMetadata) GetAllScopeNames

func (o *ObjectMetadata) GetAllScopeNames() []string

func (*ObjectMetadata) GetChildScopeNames

func (o *ObjectMetadata) GetChildScopeNames() []string

func (*ObjectMetadata) GetDefaultFields

func (o *ObjectMetadata) GetDefaultFields() []string

func (*ObjectMetadata) GetMainScopeName

func (o *ObjectMetadata) GetMainScopeName() string

func (*ObjectMetadata) GetParentScopeName

func (o *ObjectMetadata) GetParentScopeName() string

func (*ObjectMetadata) SetAllFieldsToTrue

func (*ObjectMetadata) SetAllFieldsToTrue(o ObjectMetadata) *ObjectMetadata

SetAllFieldsToTrue implements ObjectMetadatter.

type ObjectMetadatter

type ObjectMetadatter interface {
	GetDefaultFields() []string
	GetAllFields() []string
	GetMainScopeName() string
	GetParentScopeName() string
	GetChildScopeNames() []string
	GetAllScopeNames() []string
	SetAllFieldsToTrue(o ObjectMetadata) *ObjectMetadata
}

func NewObjectMetadata

func NewObjectMetadata(mainScope string, parentScope string, fields []*Field, childMetadata ...ObjectMetadatter) ObjectMetadatter

type Pager

type Pager interface {
	GetPage() int32
	GetSize() int32
}

type RabbitMessage

type RabbitMessage struct {
	UserIp   string `json:"userIp,omitempty"`
	Action   string `json:"action,omitempty"`
	Schema   string
	NewState []byte `json:"newState,omitempty"`
	UserId   int    `json:"userId,omitempty"`
	Date     int64  `json:"date,omitempty"`
	RecordId int64  `json:"recordId,omitempty"`
}

type SearchOptions

type SearchOptions struct {
	Time time.Time
	context.Context
	//Session *session.Session
	// filters
	Filter   map[string]any
	Search   string
	IDs      []int64
	ParentId int64
	// output
	Fields            []string
	UnknownFields     []string
	DerivedSearchOpts map[string]*SearchOptions
	// paging
	Page int
	Size int
	Sort string
	// filtering by single id
	ID int64
	// Auth opts
	Auth auth.Auther
}

func NewLocateOptions

func NewLocateOptions(ctx context.Context, locator Fielder, objMetadata ObjectMetadatter) (*SearchOptions, error)

func NewSearchOptions

func NewSearchOptions(ctx context.Context, searcher Lister, objMetadata ObjectMetadatter) (*SearchOptions, error)

func (*SearchOptions) CurrentTime

func (s *SearchOptions) CurrentTime() time.Time

func (*SearchOptions) GetAuthOpts

func (s *SearchOptions) GetAuthOpts() auth.Auther

func (*SearchOptions) GetPage

func (s *SearchOptions) GetPage() int

func (*SearchOptions) GetSize

func (s *SearchOptions) GetSize() int

func (*SearchOptions) GetSort

func (s *SearchOptions) GetSort() string

func (*SearchOptions) SearchDerivedOptionByField

func (s *SearchOptions) SearchDerivedOptionByField(field string) *SearchOptions

func (*SearchOptions) SetAuthOpts

func (s *SearchOptions) SetAuthOpts(a auth.Auther) *SearchOptions

type Searcher

type Searcher interface {
	GetQ() string
}

type Sorter

type Sorter interface {
	GetSort() string
}

type Status

type Status struct {
	Id     string `json:"id,omitempty"`
	Status string `json:"status,omitempty"`
	Detail string `json:"detail,omitempty"`
	Code   int    `json:"code,omitempty"`
}

type TimelineCounter

type TimelineCounter struct {
	Count     int64
	EventType int64
	DateFrom  int64
	DateTo    int64
}

type UpdateOptions

type UpdateOptions struct {
	Time time.Time
	context.Context
	// Session *session.Session
	// output
	Fields            []string
	UnknownFields     []string
	DerivedSearchOpts map[string]*SearchOptions
	// update
	Mask []string
	// filters
	ParentID int64
	IDs      []int64
	Etags    []*etag.Tid
	// ID      int64
	Auth auth.Auther
}

UpdateOptions defines options for updating an entity with fields, mask, filter, and pagination

func NewUpdateOptions

func NewUpdateOptions(ctx context.Context, req Updator, objMetadata ObjectMetadatter) (*UpdateOptions, error)

NewUpdateOptions initializes UpdateOptions with values from a context and an Updator-compliant struct

func (*UpdateOptions) CurrentTime

func (opts *UpdateOptions) CurrentTime() time.Time

CurrentTime ensures Time is set to the current time if not already set, and returns it

func (*UpdateOptions) GetAuthOpts

func (s *UpdateOptions) GetAuthOpts() auth.Auther

func (*UpdateOptions) SetAuthOpts

func (s *UpdateOptions) SetAuthOpts(a auth.Auther) *UpdateOptions

type Updator

type Updator interface {
	GetFields() []string
	GetXJsonMask() []string
}

type User

type User struct {
	Name      string `json:"name,omitempty"`
	Email     string `json:"email,omitempty"`
	Username  string `json:"username,omitempty"`
	Extension string `json:"extension,omitempty"`
	Id        int    `json:"id,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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