common

package
v0.0.0-...-7edcfce Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructPath

func ConstructPath(sections []string, separator string) string

func GetBool

func GetBool(w WithParameters, key string) (b bool)

GetBool returns the value associated with the key as a boolean.

func GetDuration

func GetDuration(w WithParameters, key string) (d time.Duration)

GetDuration returns the value associated with the key as a duration.

func GetFloat64

func GetFloat64(w WithParameters, key string) (f64 float64)

GetFloat64 returns the value associated with the key as a float64.

func GetInt

func GetInt(w WithParameters, key string) (i int)

GetInt returns the value associated with the key as an integer.

func GetInt64

func GetInt64(w WithParameters, key string) (i64 int64)

GetInt64 returns the value associated with the key as an integer.

func GetString

func GetString(w WithParameters, key string) (s string)

GetString returns the value associated with the key as a string.

func GetStringMap

func GetStringMap(w WithParameters, key string) (sm map[string]any)

GetStringMap returns the value associated with the key as a map of interfaces.

func GetStringMapString

func GetStringMapString(w WithParameters, key string) (sms map[string]string)

GetStringMapString returns the value associated with the key as a map of strings.

func GetStringMapStringSlice

func GetStringMapStringSlice(w WithParameters, key string) (smss map[string][]string)

GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings.

func GetStringSlice

func GetStringSlice(w WithParameters, key string) (ss []string)

GetStringSlice returns the value associated with the key as a slice of strings.

func GetTime

func GetTime(w WithParameters, key string) (t time.Time)

GetTime returns the value associated with the key as time.

func GetUint

func GetUint(w WithParameters, key string) (ui uint)

GetUint returns the value associated with the key as an unsigned integer.

func GetUint64

func GetUint64(w WithParameters, key string) (ui64 uint64)

GetUint64 returns the value associated with the key as an unsigned integer.

func HasParameter

func HasParameter(w WithParameters, key string) bool

HasParameter check if parameter with given key exists.

Types

type CreatedAt

type CreatedAt interface {
	InitCreatedAt()
	GetCreatedAt() time.Time
	SetCreatedAt(t time.Time)
}

type CreatedAtBase

type CreatedAtBase struct {
	CREATED_AT time.Time `gorm:"index;autoCreateTime:false" json:"created_at" display:"Created"`
}

func (*CreatedAtBase) GetCreatedAt

func (w *CreatedAtBase) GetCreatedAt() time.Time

func (*CreatedAtBase) InitCreatedAt

func (w *CreatedAtBase) InitCreatedAt()

func (*CreatedAtBase) SetCreatedAt

func (w *CreatedAtBase) SetCreatedAt(t time.Time)

type ID

type ID interface {
	WithID
	SetID(id string)
	GenerateID()
}

type IDBase

type IDBase struct {
	ID string `gorm:"primary_key" json:"id" display:"ID"`
}

func (*IDBase) GenerateID

func (o *IDBase) GenerateID()

func (*IDBase) GetID

func (o *IDBase) GetID() string

func (*IDBase) SetID

func (o *IDBase) SetID(id string)

type Object

type Object interface {
	ID
	CreatedAt
	UpdatedAt
	InitObject()
}

type ObjectBase

type ObjectBase struct {
	IDBase
	CreatedAtBase
	UpdatedAtBase
}

func (*ObjectBase) InitObject

func (o *ObjectBase) InitObject()

type ObjectWithMonth

type ObjectWithMonth interface {
	Object
	utils.MonthData
}

type ObjectWithMonthBase

type ObjectWithMonthBase struct {
	ObjectBase
	utils.MonthDataBase
}

func (*ObjectWithMonthBase) InitObject

func (o *ObjectWithMonthBase) InitObject()

type UpdatedAt

type UpdatedAt interface {
	SetUpDatedAt(time.Time)
	GetUpdatedAt() time.Time
}

type UpdatedAtBase

type UpdatedAtBase struct {
	UPDATED_AT time.Time `gorm:"index;autoUpdateTime:false" json:"updated_at" display:"Updated"`
}

func (*UpdatedAtBase) GetUpdatedAt

func (w *UpdatedAtBase) GetUpdatedAt() time.Time

func (*UpdatedAtBase) SetUpDatedAt

func (w *UpdatedAtBase) SetUpDatedAt(t time.Time)

type WithActive

type WithActive interface {
	IsActive() bool
	SetActive(value bool)
}

type WithActiveBase

type WithActiveBase struct {
	ACTIVE bool `gorm:"index" json:"active" default:"true" long:"active" description:"Active"`
}

func (*WithActiveBase) Init

func (d *WithActiveBase) Init(notActive ...bool)

func (*WithActiveBase) IsActive

func (d *WithActiveBase) IsActive() bool

func (*WithActiveBase) SetActive

func (d *WithActiveBase) SetActive(value bool)

type WithDescription

type WithDescription interface {
	Description() string
	SetDescription(value string)
}

type WithDescriptionBase

type WithDescriptionBase struct {
	DESCRIPTION string `json:"description,omitempty" gorm:"column:description" long:"description" description:"Additional description"`
}

func (*WithDescriptionBase) Description

func (d *WithDescriptionBase) Description() string

func (*WithDescriptionBase) SetDescription

func (d *WithDescriptionBase) SetDescription(value string)

type WithID

type WithID interface {
	GetID() string
}

type WithIDStub

type WithIDStub struct {
}

func (*WithIDStub) GetID

func (w *WithIDStub) GetID() string

type WithLongName

type WithLongName interface {
	LongName() string
	SetLongName(name string)
}

type WithLongNameBase

type WithLongNameBase struct {
	LONG_NAME string `json:"long_name,omitempty"`
}

func (*WithLongNameBase) LongName

func (t *WithLongNameBase) LongName() string

func (*WithLongNameBase) SetLongName

func (t *WithLongNameBase) SetLongName(value string)

type WithName

type WithName interface {
	Name() string
	SetName(name string)
}

type WithNameAndPath

type WithNameAndPath interface {
	WithName
	WithPath
}

type WithNameAndPathBase

type WithNameAndPathBase struct {
	WithNameBase
	WithPathBase
}

Base type for types having name and path.

func (*WithNameAndPathBase) Init

func (e *WithNameAndPathBase) Init(path string, name string, separator ...string)

type WithNameAndPathParentBase

type WithNameAndPathParentBase struct {
	WithNameBase
	WithPathParentBase
}

Base type for types having name and path and children.

func (*WithNameAndPathParentBase) Init

func (e *WithNameAndPathParentBase) Init(path string, name string, separator ...string)

type WithNameBase

type WithNameBase = WithNameBaseConfig

type WithNameBaseConfig

type WithNameBaseConfig struct {
	NAME string `gorm:"index" json:"name,omitempty"`
}

func (*WithNameBaseConfig) Init

func (e *WithNameBaseConfig) Init(name string)

func (*WithNameBaseConfig) Name

func (w *WithNameBaseConfig) Name() string

func (*WithNameBaseConfig) SetName

func (w *WithNameBaseConfig) SetName(name string)

type WithParameters

type WithParameters interface {
	GetParameter(key string) (any, bool)
	SetParameter(key string, value interface{})
}

Base interface for types with parameters.

type WithPath

type WithPath interface {
	Path() string
	FullPath() string
	Paths() []string
	Sections() []string
	Separator() string

	SetParent(parent WithPath)
}

Interface for type having name and path.

type WithPathBase

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

Base type for types having name and path.

func (*WithPathBase) FullPath

func (w *WithPathBase) FullPath() string

func (*WithPathBase) Init

func (w *WithPathBase) Init(path string, separator ...string)

func (*WithPathBase) Path

func (w *WithPathBase) Path() string

func (*WithPathBase) Paths

func (w *WithPathBase) Paths() []string

func (*WithPathBase) Sections

func (w *WithPathBase) Sections() []string

func (*WithPathBase) Separator

func (w *WithPathBase) Separator() string

func (*WithPathBase) SetParent

func (w *WithPathBase) SetParent(parent WithPath)

type WithPathParent

type WithPathParent interface {
	WithPath
	AddChild(child WithPath)
}

type WithPathParentBase

type WithPathParentBase struct {
	WithPathBase
}

Base type for types having name and path and children.

func (*WithPathParentBase) AddChild

func (w *WithPathParentBase) AddChild(child WithPath)

type WithRefId

type WithRefId interface {
	RefId() string
	SetRefId(value string)
}

type WithRefIdBase

type WithRefIdBase struct {
	REFID string `gorm:"index" json:"refid"`
}

func (*WithRefIdBase) RefId

func (t *WithRefIdBase) RefId() string

func (*WithRefIdBase) SetRefId

func (t *WithRefIdBase) SetRefId(value string)

type WithType

type WithType interface {
	TypeName() string
	SetTypeName(value string)
}

type WithTypeBase

type WithTypeBase struct {
	TYPE_NAME string `gorm:"index;column:type_name" json:"type_name" validate:"required" vmessage:"Type can not be empty"`
}

func (*WithTypeBase) SetTypeName

func (t *WithTypeBase) SetTypeName(value string)

func (*WithTypeBase) TypeName

func (t *WithTypeBase) TypeName() string

type WithUniqueName

type WithUniqueName interface {
	WithName
}

type WithUniqueNameBase

type WithUniqueNameBase struct {
	NAME string `gorm:"uniqueIndex" json:"name" validate:"required" vmessage:"Name can not be empty" long:"name" description:"Unique name"`
}

func (*WithUniqueNameBase) Name

func (w *WithUniqueNameBase) Name() string

func (*WithUniqueNameBase) SetName

func (w *WithUniqueNameBase) SetName(name string)

Jump to

Keyboard shortcuts

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