pocketbase

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ManagerAll added in v0.13.0

func ManagerAll(manager ManagerI) []Model

func ManagerFilter added in v0.13.0

func ManagerFilter(manager ManagerI, include Params, _ ...Params) []Model

Types

type Collection added in v0.13.0

type Collection struct {
	Objects ManagerI
	// contains filtered or unexported fields
}

func (*Collection) Count added in v0.13.0

func (collection *Collection) Count() uint

func (*Collection) DB added in v0.13.0

func (collection *Collection) DB() DB

func (*Collection) Delete added in v0.13.0

func (collection *Collection) Delete(idI any) error

func (*Collection) DeleteAll added in v0.13.0

func (collection *Collection) DeleteAll() error

Pocketbase does not support DeleteAll All models will be deletting of one

func (*Collection) Get added in v0.13.0

func (collection *Collection) Get(idI any) (Model, error)

func (*Collection) Manager added in v0.13.0

func (collection *Collection) Manager() ManagerI

func (*Collection) Model added in v0.13.0

func (collection *Collection) Model() Model

func (*Collection) Name added in v0.13.0

func (collection *Collection) Name() string

func (*Collection) Save added in v0.13.0

func (collection *Collection) Save(model Model) error

func (*Collection) SetManager added in v0.13.0

func (collection *Collection) SetManager(newManager ManagerI)

type DataBase added in v0.11.0

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

func Open

func Open(address, identity, password string, isAdmin bool, updateCollections ...bool) *DataBase

func OpenWith added in v0.11.0

func OpenWith(pb *PocketBase) *DataBase

func (*DataBase) Close added in v0.11.0

func (db *DataBase) Close() error

func (*DataBase) CreateCollection added in v0.14.0

func (db *DataBase) CreateCollection(name string, model Model) error

func (*DataBase) DB added in v0.14.1

func (db *DataBase) DB() *PocketBase

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() (string, error)

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

type PocketBase

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

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

func New

func New(address, identity, password string, isAdmin bool, updateCollections ...bool) *PocketBase

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

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

func (*PocketBase) Address added in v0.14.0

func (app *PocketBase) Address() string

func (*PocketBase) CreateCollection added in v0.14.0

func (pb *PocketBase) CreateCollection(data map[string]any) error

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

func (*PocketBase) IsAdmin added in v0.15.0

func (app *PocketBase) IsAdmin() bool

func (*PocketBase) Local added in v0.14.0

func (app *PocketBase) Local() bool

func (*PocketBase) UpdateCollection added in v0.14.0

func (pb *PocketBase) UpdateCollection(data map[string]any) error

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