errs

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: MIT Imports: 7 Imported by: 5

README

Пакет расширения ошибок

Использование

'''go

import "git.leolab.info/lib/errs"

const ( ErrMyError errs.ErrCode = "ErrMyError" )

func init(){ ds:=gorm.Open(sqlite.Open("errs.sqlite3"),nil) errs.InitDS(ds) }

..

err := errs.RaiseError(ErrMyError,"My own error")

errs.UpError(err)

'''

Documentation

Overview

Запись в базу данных

Index

Constants

This section is empty.

Variables

View Source
var Silent = false
View Source
var StrFmt = "%date% %time% [%code%] %error% at %file%:%line% %func%"

Functions

This section is empty.

Types

type Err

type Err struct {
	Code ErrCode
	Msg  string

	Prev *Err
	// contains filtered or unexported fields
}

func Error

func Error(e error) *Err

func InitDS

func InitDS(ds *gorm.DB) *Err

func RaiseError

func RaiseError(eCode ErrCode, msg string) *Err

func UpError

func UpError(err *Err) *Err

func (*Err) Error

func (e *Err) Error() string

type ErrCode

type ErrCode string
const (
	ErrError   ErrCode = "ErrError"
	ErrNoError ErrCode = "ErrNoError"
	ErrDSError ErrCode = "ErrDSError"
)

type ErrRec

type ErrRec struct {
	ID      int64 `gorm:"primaryKey;autoIncrement:true"`
	Time    time.Time
	Code    ErrCode
	Msg     string
	SrcLine string
	SrcFunc string
	Prev    int64
}

type ErrRecs

type ErrRecs struct {
	Total int64
	Items []*ErrRec
}

func DSList

func DSList(from, count int) *ErrRecs

Jump to

Keyboard shortcuts

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