pocketbase

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Objects *Manager
	// contains filtered or unexported fields
}

Bucket

func (*Bucket) Count

func (bucket *Bucket) Count() uint

func (*Bucket) DB

func (bucket *Bucket) DB() DB

func (*Bucket) Delete

func (bucket *Bucket) Delete(idI any) Error

func (*Bucket) DeleteAll added in v0.11.0

func (bucket *Bucket) DeleteAll() Error

func (*Bucket) Get

func (bucket *Bucket) Get(id any) (Model, Error)

func (*Bucket) Manager added in v0.11.0

func (bucket *Bucket) Manager() ManagerI

func (*Bucket) Model

func (bucket *Bucket) Model() Model

func (*Bucket) Name

func (bucket *Bucket) Name() string

func (*Bucket) Save

func (bucket *Bucket) Save(model Model) Error

type DataBase added in v0.11.0

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

DB

func Open

func Open(address, identity, password string) *DataBase

func OpenWith added in v0.11.0

func OpenWith(pb *PocketBase, buckets map[string]*Bucket) *DataBase

func (*DataBase) Close added in v0.11.0

func (db *DataBase) Close() Error

func (*DataBase) ExistsTable added in v0.11.0

func (db *DataBase) ExistsTable(name string) bool

func (*DataBase) Table added in v0.11.0

func (db *DataBase) Table(name string, model Model) (Table, Error)

func (*DataBase) TableFromCache added in v0.12.1

func (db *DataBase) TableFromCache(name string) Table

type Form

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

Form структура формы для создания или обновления записи

func NewForm

func NewForm(app *PocketBase, record *Record) *Form

NewForm возвращает экземпляр *Form

func (*Form) AddFiles

func (form *Form) AddFiles(field string, path ...string)

Form.AddFiles добавляет пути файлов к форме

func (*Form) LoadData

func (form *Form) LoadData(data map[string]any)

Form.LoadData загружает в форму данные

func (*Form) Submit

func (form *Form) Submit() error

Form.Submit записывает изменения в pb

type Manager

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

Manager

func (*Manager) All

func (manager *Manager) All() []Model

func (*Manager) Bucket

func (manager *Manager) Bucket() *Bucket

func (*Manager) Copy

func (manager *Manager) Copy() ManagerI

func (*Manager) Count

func (manager *Manager) Count() uint

func (*Manager) Delete

func (manager *Manager) Delete(id any)

func (*Manager) Filter

func (manager *Manager) Filter(include Params, _ ...Params) ManagerI

func (*Manager) First

func (manager *Manager) First() Model

func (*Manager) Get

func (manager *Manager) Get(idI any) Model

func (*Manager) IsInstance

func (manager *Manager) IsInstance() bool

func (*Manager) Last

func (manager *Manager) Last() Model

func (*Manager) Table added in v0.11.0

func (manager *Manager) Table() Table

type PocketBase

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

Pocketbase структура с данными авторизации для pb

func New

func New(address, identity, password string) *PocketBase

New возвращает экземпляр *Pocketbase с адресом `address`, индификатором `identity` и паролем `password`

address in format - http(s)://127.0.0.1(:8090)

func NewLocal added in v0.11.0

func NewLocal(identity, password string, port ...string) *PocketBase

func (*PocketBase) Delete

func (pb *PocketBase) Delete(collectionNameOrId, id string) error

func (*PocketBase) Filter

func (pb *PocketBase) Filter(collectionNameOrId string, data map[string]any, page ...uint) ([]*Record, error)

PocketBase.Filter возвращает список записей из pb удовлетворяющим фильтру `data`

func (*PocketBase) GetFileAsSliceByte

func (pb *PocketBase) GetFileAsSliceByte(collentionNameOrId, recordId, fileName string) ([]byte, error)

PocketBase.GetFileAsSliceByte возвращает список байтов файла из pb

По id записи `recordId` в колекции `collentionNameOrId` и имени файла `fileName`

type Record

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

Record структура записи в pb

func NewRecord

func NewRecord(collectionNameOrId string, app *PocketBase) *Record

NewRecord возвращает экземпляр *Record

func (*Record) CollectionNameOrId

func (record *Record) CollectionNameOrId() string

Record.CollectionNameOrId возвращает имяИлиId колекции

func (*Record) Get

func (record *Record) Get(key string) any

Record.Get возвращает значение по ключу `key`

func (*Record) Set

func (record *Record) Set(key string, value any)

Record.Set устанавливает значение `value` по ключу `key`

Jump to

Keyboard shortcuts

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