Documentation
¶
Index ¶
- Constants
- Variables
- func Drivers() []string
- func Register(name string, driver Driver)
- type BaseResponse
- func (r *BaseResponse) GenerateID() *BaseResponse
- func (r *BaseResponse) Request() interface{}
- func (r *BaseResponse) SetError(err error) *BaseResponse
- func (r *BaseResponse) SetID(id string) *BaseResponse
- func (r *BaseResponse) Success() *BaseResponse
- func (r *BaseResponse) ToCmd() *ResponseCmd
- func (r *BaseResponse) ToLog(log *LogJSON) *ResponseLog
- func (r *BaseResponse) ToThread(thread Thread) *ResponseThread
- type Connector
- type DB
- func (d *DB) Driver() Driver
- func (d *DB) GetLog(id uuid.UUID) (ResponseLog, error)
- func (d *DB) GetThread(id uuid.UUID) (ResponseThread, error)
- func (d *DB) RemoveByTags(tags Tags) (ResponseCmd, error)
- func (d *DB) RemoveThread(id uuid.UUID) (ResponseCmd, error)
- func (d *DB) Send(log *Log) (ResponseCmd, error)
- func (d *DB) Truncate(ind string) (ResponseCmd, error)
- type Driver
- type ExtraData
- type Log
- func (l *Log) CreateChild(name string) (*Log, error)
- func (l *Log) Fail(err error) *Log
- func (l *Log) FinishTimeEnd() *Log
- func (l *Log) GetLevel() int
- func (l *Log) MarshalJSON() ([]byte, error)
- func (l *Log) ParentFromShadow(shadow *LogParentShadow) *Log
- func (l *Log) SetApplication(str string) *Log
- func (l *Log) SetDefaults() *Log
- func (l *Log) SetEnvironment(env string) *Log
- func (l *Log) SetName(name string) *Log
- func (l *Log) SetParent(parent *Log) error
- func (l *Log) SetParentID(id uuid.UUID) *Log
- func (l Log) String() string
- func (l *Log) Success() *Log
- func (l *Log) ThreadFinish() *Log
- func (l Log) ToJSON() []byte
- func (l Log) ToLogJSON() *LogJSON
- func (l Log) ToShadow() *LogParentShadow
- type LogJSON
- type LogParentShadow
- type Logable
- type Note
- type NoteGroup
- type NoteGroupList
- type NoteGroups
- func (n NoteGroups) Add(group, note string) NoteGroups
- func (n NoteGroups) AddGroup(group string, notes []string) NoteGroups
- func (n NoteGroups) AddNoteGroup(group *NoteGroup) NoteGroups
- func (n *NoteGroups) Clear() *NoteGroups
- func (n NoteGroups) Count() int
- func (n *NoteGroups) FromJSON(b []byte) error
- func (n NoteGroups) Get(groupName string) *NoteGroup
- func (n NoteGroups) Remove(groupName string) NoteGroups
- func (n NoteGroups) ToJSON() []byte
- func (n NoteGroups) ToJSONString() string
- type Notes
- type ResponseCmd
- type ResponseLog
- type ResponseThread
- type Responsible
- type Tags
- type Thread
Constants ¶
const ( EnvironmentDev = `dev` EnvironmentProd = `prod` EnvironmentTest = `test` )
Environments
Variables ¶
var ErrorParentFinish = errors.New(`the Parent does not have to be the finish point`)
ErrorParentFinish error
var ErrorParentThreadDiff = errors.New(`the Parent Thread is different from the Thread of own log`)
ErrorParentThreadDiff error
Functions ¶
Types ¶
type BaseResponse ¶
type BaseResponse struct { ID string Error error Result bool Time time.Time // contains filtered or unexported fields }
func NewResponse ¶
func NewResponse(request interface{}) *BaseResponse
func (*BaseResponse) GenerateID ¶
func (r *BaseResponse) GenerateID() *BaseResponse
func (*BaseResponse) Request ¶
func (r *BaseResponse) Request() interface{}
func (*BaseResponse) SetError ¶
func (r *BaseResponse) SetError(err error) *BaseResponse
func (*BaseResponse) SetID ¶
func (r *BaseResponse) SetID(id string) *BaseResponse
func (*BaseResponse) Success ¶
func (r *BaseResponse) Success() *BaseResponse
func (*BaseResponse) ToCmd ¶
func (r *BaseResponse) ToCmd() *ResponseCmd
func (*BaseResponse) ToLog ¶
func (r *BaseResponse) ToLog(log *LogJSON) *ResponseLog
func (*BaseResponse) ToThread ¶
func (r *BaseResponse) ToThread(thread Thread) *ResponseThread
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) RemoveByTags ¶
func (d *DB) RemoveByTags(tags Tags) (ResponseCmd, error)
func (*DB) RemoveThread ¶
func (d *DB) RemoveThread(id uuid.UUID) (ResponseCmd, error)
type Driver ¶
type Driver interface { Open(map[string]string) (interface{}, error) Send(log *Log) (ResponseCmd, error) RemoveThread(id uuid.UUID) (ResponseCmd, error) RemoveByTags(tags Tags) (ResponseCmd, error) GetLog(id uuid.UUID) (ResponseLog, error) GetThread(id uuid.UUID) (ResponseThread, error) Truncate(ind string) (ResponseCmd, error) }
type ExtraData ¶
type ExtraData map[string]interface{}
ExtraData is data tree
type Log ¶
type Log struct { ID uuid.UUID Thread uuid.UUID Name string Data ExtraData App string Notes NoteGroups Tags Tags Error error Environment string Result bool Finish bool Time time.Time TimeEnd *time.Time Parent *Log }
Log struct
func (*Log) CreateChild ¶
CreateChild make new log and attach it to current log as child
func (*Log) FinishTimeEnd ¶
FinishTimeEnd set finish time of the log
func (*Log) ParentFromShadow ¶
func (l *Log) ParentFromShadow(shadow *LogParentShadow) *Log
ParentFromShadow return Parent's ID from LogShadow
func (*Log) SetApplication ¶
SetApplication set application name of log
func (*Log) SetDefaults ¶
SetDefaults set values for Log by default
func (*Log) SetEnvironment ¶
SetEnvironment set environment name of log
func (*Log) SetParentID ¶
SetParentID set parent ID to log
func (Log) ToShadow ¶
func (l Log) ToShadow() *LogParentShadow
ToShadow create new shadow struct of log
type LogJSON ¶
type LogJSON struct { ID uuid.UUID `json:"id"` Thread uuid.UUID `json:"thread"` Name string `json:"name"` App string `json:"app"` Time int64 `json:"time"` TimeEnd *int64 `json:"timeEnd"` Result bool `json:"result"` Finish bool `json:"finish"` Environment string `json:"env"` Error *string `json:"error"` Data ExtraData `json:"data"` Notes NoteGroupList `json:"notes"` Tags []string `json:"tags"` Parent *string `json:"parent"` }
LogJSON struct
type LogParentShadow ¶
LogParentShadow struct
type Logable ¶
type Logable interface { Success() Logable Fail(err error) Logable SetParentID(id uuid.UUID) Logable SetParent(parent Logable) error CreateChild(name string) (Logable, error) ToJSON() []byte ToLogJSON() LogJSON }
Logable interface
type NoteGroupList ¶
type NoteGroupList []*NoteGroup
NoteGroupList is list of NoteGroup
func (*NoteGroupList) FromJSON ¶
func (n *NoteGroupList) FromJSON(b []byte) error
FromJSON fill NoteGroupList from json
type NoteGroups ¶
NoteGroups is list of NoteGroup
func (NoteGroups) Add ¶
func (n NoteGroups) Add(group, note string) NoteGroups
Add new note to exist group (or create new if absent) in NoteGroups
func (NoteGroups) AddGroup ¶
func (n NoteGroups) AddGroup(group string, notes []string) NoteGroups
AddGroup add notes list to exist group (or create new if absent) in NoteGroups
func (NoteGroups) AddNoteGroup ¶
func (n NoteGroups) AddNoteGroup(group *NoteGroup) NoteGroups
AddNoteGroup add group struct to list
func (*NoteGroups) FromJSON ¶
func (n *NoteGroups) FromJSON(b []byte) error
FromJSON fill NoteGroups from json. Previously clear list
func (NoteGroups) Get ¶
func (n NoteGroups) Get(groupName string) *NoteGroup
Get NoteGroup from NoteGroup list
func (NoteGroups) Remove ¶
func (n NoteGroups) Remove(groupName string) NoteGroups
Remove NoteGroup from list
func (NoteGroups) ToJSON ¶
func (n NoteGroups) ToJSON() []byte
ToJSON return json bytes of NoteGroups
func (NoteGroups) ToJSONString ¶
func (n NoteGroups) ToJSONString() string
ToJSONString return json string of NoteGroups
type ResponseCmd ¶
type ResponseCmd struct {
BaseResponse
}
type ResponseLog ¶
type ResponseLog struct { BaseResponse Log *LogJSON }
type ResponseThread ¶
type ResponseThread struct { BaseResponse Thread Thread }
type Responsible ¶
type Responsible interface {
Success() Responsible
}