models

package
v0.0.0-...-fe88686 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
	NsId int64  `json:"-"`
}

func (*Key) Clean

func (k *Key) Clean()

func (*Key) Delete

func (k *Key) Delete() error

func (*Key) FindById

func (k *Key) FindById(keyId int64) (*Key, error)

func (*Key) FindByName

func (k *Key) FindByName(keyName string) (*Key, error)

func (*Key) Store

func (k *Key) Store() (*Key, error)

type Mapping

type Mapping struct {
	Id          int64  `json:"id"`
	NamespaceId int64  `json:"namespace_id"`
	KeyId       int64  `json:"key_id"`
	ValExt      string `json:"val_ext"`
	ValInt      string `json:"val_int"`
	Payload     string `json:"payload"`
}

func (*Mapping) Delete

func (m *Mapping) Delete() error

func (*Mapping) FindById

func (m *Mapping) FindById(mapId int64) (*Mapping, error)

func (*Mapping) Store

func (m *Mapping) Store() (*Mapping, error)

type MappingRequest

type MappingRequest MappingsResponse // пока так удобнее

type Mappings

type Mappings []Mapping

func (*Mappings) CountRowsByKey

func (m *Mappings) CountRowsByKey(keyId int64) (count int64, err error)

func (*Mappings) CountRowsByNamespace

func (m *Mappings) CountRowsByNamespace(nsId int64) (count int64, err error)

func (*Mappings) GetByExtValue

func (m *Mappings) GetByExtValue(nsId int64, keyId int64, extVal string) (*Mappings, error)

func (*Mappings) GetByIntValue

func (m *Mappings) GetByIntValue(nsId int64, keyId int64, intVal string) (*Mappings, error)

func (*Mappings) ListMappings

func (m *Mappings) ListMappings(ns *Namespace, key *Key, intVal string, extVal string, related int) (*Mappings, error)

* + related

1 - только связанные
0 - только не связанные
2,3 - резерв на будущее (не связанные по внешнему коду, не связанные по внутреннему коду)
-1 - все

func (*Mappings) ListMappingsById

func (m *Mappings) ListMappingsById(nsId int64, keyId int64, intVal string) (*Mappings, error)

type MappingsResponse

type MappingsResponse struct {
	Mappings Mappings `json:"mappings"`
}

Структура для ответа связок

type Namespace

type Namespace struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

func (*Namespace) Clean

func (n *Namespace) Clean()

func (*Namespace) CreateKey

func (n *Namespace) CreateKey(keyName string) (*Key, error)

CreateKey создает ключ по имени в текущем namespace

func (*Namespace) Delete

func (n *Namespace) Delete() error

func (*Namespace) FindById

func (n *Namespace) FindById(nsId int64) (*Namespace, error)

func (*Namespace) FindByName

func (n *Namespace) FindByName(nsName string) (*Namespace, error)

func (*Namespace) Get

func (n *Namespace) Get() ([]Namespace, error)

func (*Namespace) GetKeys

func (n *Namespace) GetKeys() ([]Key, error)

GetKeys возвращает список ключей в текущем namespace

func (*Namespace) KeyExists

func (n *Namespace) KeyExists(keyName string) bool

func (*Namespace) Store

func (n *Namespace) Store() (*Namespace, error)

Jump to

Keyboard shortcuts

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