accountancy

package module
v0.0.0-...-cede02a Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 12 Imported by: 1

README

accountancy

Accountancy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(driverName string, connString string, show bool) (eng *xorm.Engine, err error)

Connect -

func ConnectRequestDB

func ConnectRequestDB(request string) (eng *xorm.Engine, err error)

ConnectRequestDB -

func Drop

func Drop(db DB, ent interface{}) (err error)

Drop -

func DropAll

func DropAll(db DB) (err error)

DropAll -

func ExportData

func ExportData(db DB, request string) (response string, err error)

ExportData -

func ExportMeta

func ExportMeta(db DB, request string) (response string, err error)

ExportMeta -

func ImportData

func ImportData(db DB, request string, meta *Meta) (response string, err error)

ImportData -

func ImportMeta

func ImportMeta(db DB, request string, meta *Meta) (response string, err error)

ImportMeta -

func InsertOrUpdateLink(db DB, objMap map[string]interface{}, meta *Meta) (response string, err error)

InsertOrUpdateLink -

func InsertOrUpdateObject

func InsertOrUpdateObject(db DB, objMap map[string]interface{}, meta *Meta) (response string, err error)

InsertOrUpdateObject -

func LinkObjectsInsertOrUpdate

func LinkObjectsInsertOrUpdate(db DB, relTraits *RelationTraits, objectFrom *Object, objectTo *Object, props map[string]interface{}) (affected int64, inserted bool, err error)

LinkObjectsInsertOrUpdate -

func Run

func Run(request string, meta *Meta, db DB) (response string, err error)

Run -

func RunBatch

func RunBatch(request string, meta *Meta, db DB) (response string, err error)

RunBatch -

func RunExport

func RunExport(service string, request string, meta *Meta, db DB) (response string, err error)

RunExport -

func RunImport

func RunImport(service string, request string, meta *Meta, db DB) (response string, err error)

RunImport -

func RunInsert

func RunInsert(service string, request string, meta *Meta, db DB) (response string, err error)

RunInsert -

func RunOne

func RunOne(request string, meta *Meta, db DB) (response string, err error)

RunOne -

func RunSelect

func RunSelect(service string, request string, meta *Meta, db DB) (response string, err error)

RunSelect -

func RunSystem

func RunSystem(service string, request string, meta *Meta, db DB) (response string, err error)

RunSystem -

func SelectObject

func SelectObject(db DB, objMap map[string]interface{}, meta *Meta) (response string, err error)

SelectObject -

func Sync

func Sync(db DB, ent interface{}) error

Sync -

func SyncAll

func SyncAll(db DB) (err error)

SyncAll -

func SystemUpload

func SystemUpload(db DB, request string) (response string, err error)

SystemUpload -

func TraitObjectInsertOrUpdate

func TraitObjectInsertOrUpdate(db DB, trait *Trait, object *Object, meta *Meta) (affected int64, inserted bool, err error)

TraitObjectInsertOrUpdate -

Types

type DB

type DB interface {
	Insert(beans ...interface{}) (affected int64, err error)
	Get(bean interface{}) (has bool, err error)
	Find(rowsSlicePtr interface{}, condiBean ...interface{}) error
	Update(bean interface{}, condiBean ...interface{}) (affected int64, err error)
	ID(id interface{}) *xorm.Session
	Where(query interface{}, args ...interface{}) *xorm.Session
	Sync2(beans ...interface{}) error
}

DB -

type Document

type Document struct {
	ID        int64
	Dt        time.Time              `xorm:"notnull index"`
	UUID      string                 `xorm:"varchar(36) notnull unique"`
	DocTypeID int64                  `xorm:"notnull index"`
	DebID     int64                  `xorm:"notnull index"`
	CredID    int64                  `xorm:"notnull index"`
	Props     map[string]interface{} `xorm:"jsonb"`
	Status    int                    `xorm:"notnull index"`
	Created   time.Time              `xorm:"created"`
	Updated   time.Time              `xorm:"updated"`
}

Document -

func ImportFromService

func ImportFromService(eng *xorm.Engine, ctx string) (docs []*Document, err error)

ImportFromService -

func NewDocument

func NewDocument(docTypeID int64, props map[string]interface{}) (doc *Document, err error)

NewDocument -

func (*Document) FillDocument

func (doc *Document) FillDocument(eng *xorm.Engine) (err error)

FillDocument -

func (*Document) Get

func (doc *Document) Get(eng *xorm.Engine) (has bool, err error)

Get -

func (*Document) Insert

func (doc *Document) Insert(eng *xorm.Engine) (affected int64, err error)

Insert -

func (*Document) Update

func (doc *Document) Update(eng *xorm.Engine) (affected int64, err error)

Update -

type File

type File struct {
	ID      int64
	UUID    string                 `xorm:"varchar(36) notnull unique"`
	Name    string                 `xorm:"varchar(1024) notnull unique"`
	Props   map[string]interface{} `xorm:"jsonb"`
	Content []byte                 `xorm:"bytea"`
	Status  int                    `xorm:"notnull index"`
	Created time.Time              `xorm:"created"`
	Updated time.Time              `xorm:"updated"`
}

File -

func NewFile

func NewFile(name string, props map[string]interface{}, content []byte) (file *File, err error)

NewFile -

func (*File) Get

func (file *File) Get(db DB) (has bool, err error)

Get -

func (*File) Insert

func (file *File) Insert(db DB) (affected int64, err error)

Insert -

func (*File) InsertOrUpdate

func (file *File) InsertOrUpdate(db DB, find *File) (affected int64, inserted bool, err error)

InsertOrUpdate -

func (*File) Update

func (file *File) Update(db DB) (affected int64, err error)

Update -

type Ledger

type Ledger struct {
	ID      int64
	Dt      time.Time              `xorm:"notnull index"`
	DocID   int64                  `xorm:"notnull index"`
	DebID   int64                  `xorm:"notnull index"`
	CredID  int64                  `xorm:"notnull index"`
	Amount  int64                  `xorm:"notnull"`
	Props   map[string]interface{} `xorm:"jsonb"`
	Status  int                    `xorm:"notnull index"`
	Created time.Time              `xorm:"created"`
}

Ledger -

func MakeLedgerEntries

func MakeLedgerEntries(eng *xorm.Engine, docID int64) (entries []*Ledger, err error)

MakeLedgerEntries -

type LinkObjects

type LinkObjects struct {
	ID               int64                  `json:"-"`
	RelationTraitsID int64                  `xorm:"notnull unique(relation_traits_link_objects)" json:"-"`
	RelationName     string                 `xorm:"-" json:"relation"`
	TraitFromName    string                 `xorm:"-" json:"trait-from"`
	ObjectFromID     int64                  `xorm:"notnull unique(relation_traits_link_objects)" json:"-"`
	ObjectFromName   string                 `xorm:"-" json:"object-from"`
	TraitToName      string                 `xorm:"-" json:"trait-to"`
	ObjectToID       int64                  `xorm:"notnull unique(relation_traits_link_objects)" json:"-"`
	ObjectToName     string                 `xorm:"-" json:"object-to"`
	Props            map[string]interface{} `xorm:"jsonb" json:"props"`
	Hash             string                 `xorm:"text" json:"hash"`
	Status           int                    `xorm:"notnull index" json:"-"`
	Created          time.Time              `xorm:"created" json:"-"`
	Updated          time.Time              `xorm:"updated" json:"-"`
}

LinkObjects -

func (*LinkObjects) Get

func (link *LinkObjects) Get(db DB) (has bool, err error)

Get -

func (*LinkObjects) Insert

func (link *LinkObjects) Insert(db DB) (affected int64, err error)

Insert -

func (*LinkObjects) InsertOrUpdate

func (link *LinkObjects) InsertOrUpdate(db DB, find *LinkObjects) (affected int64, inserted bool, err error)

InsertOrUpdate -

func (*LinkObjects) Update

func (link *LinkObjects) Update(db DB) (affected int64, err error)

Update -

type Meta

type Meta struct {
	TraitsByName    map[string]*Trait
	TraitsByID      map[int64]*Trait
	RelationsByName map[string]*Relation
	RelationsByID   map[int64]*Relation
	RelTraitsByName map[RelationTraitsKey]*RelationTraits
	RelTraitsByID   map[int64]*RelationTraits
	TypeDocsByName  map[string]*TypeDocument
	TypeDocsByID    map[int64]*TypeDocument
}

Meta -

func LoadMeta

func LoadMeta(db DB) (meta *Meta, err error)

LoadMeta -

func (*Meta) AddRelTraits

func (meta *Meta) AddRelTraits(relTraits *RelationTraits) (err error)

AddRelTraits -

func (*Meta) AddRelation

func (meta *Meta) AddRelation(relation *Relation)

AddRelation -

func (*Meta) AddTrait

func (meta *Meta) AddTrait(trait *Trait)

AddTrait -

func (*Meta) LoadRelTraits

func (meta *Meta) LoadRelTraits(db DB) (err error)

LoadRelTraits -

func (*Meta) LoadRelations

func (meta *Meta) LoadRelations(db DB) (err error)

LoadRelations -

func (*Meta) LoadTraits

func (meta *Meta) LoadTraits(db DB) (err error)

LoadTraits -

type Object

type Object struct {
	ID      int64                  `json:"-"`
	UUID    string                 `xorm:"varchar(36) notnull unique" json:"uuid"`
	Name    string                 `xorm:"varchar(1024) notnull unique" json:"name"`
	Props   map[string]interface{} `xorm:"jsonb" json:"props"`
	Hash    string                 `xorm:"text" json:"hash"`
	Status  int                    `xorm:"notnull index" json:"status"`
	Created time.Time              `xorm:"created" json:"-"`
	Updated time.Time              `xorm:"updated" json:"-"`
}

Object -

func NewObject

func NewObject(name string, props map[string]interface{}) (object *Object, err error)

NewObject -

func (*Object) AddTrait

func (object *Object) AddTrait(eng *xorm.Engine, trait *Trait, meta *Meta) (affected int64, err error)

AddTrait -

func (*Object) Get

func (object *Object) Get(db DB) (has bool, err error)

Get -

func (*Object) Insert

func (object *Object) Insert(db DB) (affected int64, err error)

Insert -

func (*Object) InsertOrUpdate

func (object *Object) InsertOrUpdate(db DB, find *Object) (affected int64, inserted bool, err error)

InsertOrUpdate -

func (*Object) Update

func (object *Object) Update(db DB) (affected int64, err error)

Update -

type Relation

type Relation struct {
	ID      int64                  `json:"-"`
	UUID    string                 `xorm:"varchar(36) notnull unique" json:"uuid"`
	Name    string                 `xorm:"varchar(1024) notnull unique" json:"name"`
	Props   map[string]interface{} `xorm:"jsonb" json:"props"`
	Status  int                    `xorm:"notnull index" json:"-"`
	Created time.Time              `xorm:"created" json:"-"`
	Updated time.Time              `xorm:"updated" json:"-"`
}

Relation -

func NewRelation

func NewRelation(name string, props map[string]interface{}, lib string) (relation *Relation, err error)

NewRelation -

func (*Relation) AddRelationTraits

func (relation *Relation) AddRelationTraits(db DB, traitFrom *Trait, traitTo *Trait, props map[string]interface{}, lib string) (affected int64, inserted bool, err error)

AddRelationTraits -

func (*Relation) Get

func (relation *Relation) Get(db DB) (has bool, err error)

Get -

func (*Relation) Insert

func (relation *Relation) Insert(db DB) (affected int64, err error)

Insert -

func (*Relation) InsertOrUpdate

func (relation *Relation) InsertOrUpdate(db DB, find *Relation) (affected int64, inserted bool, err error)

InsertOrUpdate -

func (*Relation) Update

func (relation *Relation) Update(db DB) (affected int64, err error)

Update -

type RelationTraits

type RelationTraits struct {
	ID            int64                  `json:"-"`
	RelationID    int64                  `xorm:"notnull unique(relation_traits)" json:"-"`
	RelationName  string                 `xorm:"-" json:"relation"`
	TraitFromID   int64                  `xorm:"notnull unique(relation_traits)" json:"-"`
	TraitFromName string                 `xorm:"-" json:"trait-from"`
	TraitToID     int64                  `xorm:"notnull unique(relation_traits)" json:"-"`
	TraitToName   string                 `xorm:"-" json:"trait-to"`
	Props         map[string]interface{} `xorm:"jsonb" json:"props"`
	Lib           string                 `xorm:"text"  json:"lib"`
	LibContent    string                 `xorm:"-" json:"-"`
	Status        int                    `xorm:"notnull index" json:"-"`
	Created       time.Time              `xorm:"created" json:"-"`
	Updated       time.Time              `xorm:"updated" json:"-"`
}

RelationTraits -

func (*RelationTraits) AddLinkObjects

func (relTraits *RelationTraits) AddLinkObjects(db DB, objectFrom *Object, objectTo *Object, props map[string]interface{}) (affected int64, inserted bool, err error)

AddLinkObjects -

type RelationTraitsKey

type RelationTraitsKey struct {
	RelationName  string
	TraitFromName string
	TraitToName   string
}

RelationTraitsKey -

type Service

type Service struct {
	ID      int64
	UUID    string                 `xorm:"varchar(36) notnull unique"`
	Name    string                 `xorm:"varchar(1024) notnull unique"`
	Props   map[string]interface{} `xorm:"jsonb"`
	Lib     string                 `xorm:"text"`
	Status  int                    `xorm:"notnull index"`
	Created time.Time              `xorm:"created"`
	Updated time.Time              `xorm:"updated"`
}

Service -

func NewService

func NewService(name string, props map[string]interface{}, lib string) (service *Service, err error)

NewService -

func (*Service) Get

func (service *Service) Get(eng *xorm.Engine) (has bool, err error)

Get -

func (*Service) Insert

func (service *Service) Insert(eng *xorm.Engine) (affected int64, err error)

Insert -

func (*Service) Update

func (service *Service) Update(eng *xorm.Engine) (affected int64, err error)

Update -

type Trait

type Trait struct {
	ID         int64                  `json:"-"`
	UUID       string                 `xorm:"varchar(36) notnull unique" json:"uuid"`
	Name       string                 `xorm:"varchar(1024) notnull unique" json:"name"`
	Props      map[string]interface{} `xorm:"jsonb" json:"props"`
	Lib        string                 `xorm:"text" json:"lib"`
	LibContent string                 `xorm:"-" json:"-"`
	Status     int                    `xorm:"notnull index" json:"-"`
	Created    time.Time              `xorm:"created" json:"-"`
	Updated    time.Time              `xorm:"updated" json:"-"`
}

Trait -

func NewTrait

func NewTrait(name string, props map[string]interface{}, lib string) (trait *Trait, err error)

NewTrait -

func (*Trait) AddObject

func (trait *Trait) AddObject(db DB, object *Object, meta *Meta) (affected int64, inserted bool, err error)

AddObject -

func (*Trait) AddRelationFrom

func (trait *Trait) AddRelationFrom(db DB, relation *Relation, traitFrom *Trait, props map[string]interface{}, lib string) (affected int64, err error)

AddRelationFrom -

func (*Trait) AddRelationTo

func (trait *Trait) AddRelationTo(db DB, relation *Relation, traitTo *Trait, props map[string]interface{}, lib string) (affected int64, err error)

AddRelationTo -

func (*Trait) Get

func (trait *Trait) Get(db DB) (has bool, err error)

Get -

func (*Trait) Insert

func (trait *Trait) Insert(db DB) (affected int64, err error)

Insert -

func (*Trait) InsertOrUpdate

func (trait *Trait) InsertOrUpdate(db DB, find *Trait) (affected int64, inserted bool, err error)

InsertOrUpdate -

func (*Trait) Update

func (trait *Trait) Update(db DB) (affected int64, err error)

Update -

func (*Trait) UpdateObjectProps

func (trait *Trait) UpdateObjectProps(db DB, object *Object, props map[string]interface{}) (affected int64, err error)

UpdateObjectProps -

type TraitObject

type TraitObject struct {
	ID         int64                  `json:"-"`
	TraitID    int64                  `xorm:"notnull unique(trait_object)" json:"-"`
	TraitName  string                 `xorm:"-" json:"trait-name"`
	ObjectID   int64                  `xorm:"notnull unique(trait_object)" json:"-"`
	ObjectName string                 `xorm:"-" json:"object-name"`
	Props      map[string]interface{} `xorm:"jsonb" json:"props"`
	Hash       string                 `xorm:"text" json:"hash"`
	Status     int                    `xorm:"notnull index" json:"-"`
	Created    time.Time              `xorm:"created" json:"-"`
	Updated    time.Time              `xorm:"updated" json:"-"`
}

TraitObject -

type TypeDocument

type TypeDocument struct {
	ID            int64
	UUID          string                 `xorm:"varchar(36) notnull unique"`
	Name          string                 `xorm:"varchar(1024) notnull unique"`
	DebTraitID    int64                  `xorm:"notnull index"`
	DebTraitName  string                 `xorm:"-" json:"deb-trait"`
	CredTraitID   int64                  `xorm:"notnull index"`
	CredTraitName string                 `xorm:"-" json:"cred-trait"`
	Props         map[string]interface{} `xorm:"jsonb"`
	Lib           string                 `xorm:"text"`
	Status        int                    `xorm:"notnull index"`
	Created       time.Time              `xorm:"created"`
	Updated       time.Time              `xorm:"updated"`
}

TypeDocument -

func NewTypeDocument

func NewTypeDocument(name string, debTraitID int64, credTraitID int64, props map[string]interface{}, lib string) (typedoc *TypeDocument, err error)

NewTypeDocument -

func (*TypeDocument) Get

func (typedoc *TypeDocument) Get(db DB) (has bool, err error)

Get -

func (*TypeDocument) Insert

func (typedoc *TypeDocument) Insert(db DB) (affected int64, err error)

Insert -

func (*TypeDocument) InsertOrUpdate

func (typedoc *TypeDocument) InsertOrUpdate(db DB, find *TypeDocument) (affected int64, inserted bool, err error)

InsertOrUpdate -

func (*TypeDocument) Update

func (typedoc *TypeDocument) Update(db DB) (affected int64, err error)

Update -

Jump to

Keyboard shortcuts

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