model

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Index

Constants

View Source
const (
	SubTaskIndexLabelIsSubCollectionPrefix = "i1" // prefix-match of IsSubCollection
	SubTaskIndexLabelIsSubCollectionSuffix = "i2" // suffix-match of IsSubCollection
	SubTaskIndexLabelIsSubCollectionLike   = "i3" // like-match of IsSubCollection
	SubTaskIndexLabelIsSubCollectionEqual  = "i4" // perfect-match of IsSubCollection
)
View Source
const (
	TaskIndexLabelDescEqual          = "d4"  // perfect-match of Desc
	TaskIndexLabelDescLike           = "d3"  // like-match of Desc
	TaskIndexLabelDescPrefix         = "d1"  // prefix-match of Desc
	TaskIndexLabelDescSuffix         = "d2"  // suffix-match of Desc
	TaskIndexLabelDesc2Equal         = "d8"  // perfect-match of Desc2
	TaskIndexLabelDesc2Like          = "d7"  // like-match of Desc2
	TaskIndexLabelDesc2Prefix        = "d5"  // prefix-match of Desc2
	TaskIndexLabelDesc2Suffix        = "d6"  // suffix-match of Desc2
	TaskIndexLabelCreatedPrefix      = "c1"  // prefix-match of Created
	TaskIndexLabelCreatedSuffix      = "c2"  // suffix-match of Created
	TaskIndexLabelCreatedLike        = "c3"  // like-match of Created
	TaskIndexLabelCreatedEqual       = "c4"  // perfect-match of Created
	TaskIndexLabelReservedDatePrefix = "r1"  // prefix-match of ReservedDate
	TaskIndexLabelReservedDateSuffix = "r2"  // suffix-match of ReservedDate
	TaskIndexLabelReservedDateLike   = "r3"  // like-match of ReservedDate
	TaskIndexLabelReservedDateEqual  = "r4"  // perfect-match of ReservedDate
	TaskIndexLabelDonePrefix         = "d9"  // prefix-match of Done
	TaskIndexLabelDoneSuffix         = "do1" // suffix-match of Done
	TaskIndexLabelDoneLike           = "do2" // like-match of Done
	TaskIndexLabelDoneEqual          = "do3" // perfect-match of Done
	TaskIndexLabelDone2Prefix        = "do4" // prefix-match of Done2
	TaskIndexLabelDone2Suffix        = "do5" // suffix-match of Done2
	TaskIndexLabelDone2Like          = "do6" // like-match of Done2
	TaskIndexLabelDone2Equal         = "do7" // perfect-match of Done2
	TaskIndexLabelCountPrefix        = "c5"  // prefix-match of Count
	TaskIndexLabelCountSuffix        = "c6"  // suffix-match of Count
	TaskIndexLabelCountLike          = "c7"  // like-match of Count
	TaskIndexLabelCountEqual         = "c8"  // perfect-match of Count
	TaskIndexLabelCount64Prefix      = "c9"  // prefix-match of Count64
	TaskIndexLabelCount64Suffix      = "co1" // suffix-match of Count64
	TaskIndexLabelCount64Like        = "co2" // like-match of Count64
	TaskIndexLabelCount64Equal       = "co3" // perfect-match of Count64
	TaskIndexLabelNameListPrefix     = "n1"  // prefix-match of NameList
	TaskIndexLabelNameListSuffix     = "n2"  // suffix-match of NameList
	TaskIndexLabelNameListLike       = "n3"  // like-match of NameList
	TaskIndexLabelNameListEqual      = "n4"  // perfect-match of NameList
	TaskIndexLabelProportionPrefix   = "p1"  // prefix-match of Proportion
	TaskIndexLabelProportionSuffix   = "p2"  // suffix-match of Proportion
	TaskIndexLabelProportionLike     = "p3"  // like-match of Proportion
	TaskIndexLabelProportionEqual    = "p4"  // perfect-match of Proportion
	TaskIndexLabelGeoPrefix          = "g1"  // prefix-match of Geo
	TaskIndexLabelGeoSuffix          = "g2"  // suffix-match of Geo
	TaskIndexLabelGeoLike            = "g3"  // like-match of Geo
	TaskIndexLabelGeoEqual           = "g4"  // perfect-match of Geo
	TaskIndexLabelSubPrefix          = "s1"  // prefix-match of Sub
	TaskIndexLabelSubSuffix          = "s2"  // suffix-match of Sub
	TaskIndexLabelSubLike            = "s3"  // like-match of Sub
	TaskIndexLabelSubEqual           = "s4"  // perfect-match of Sub
	TaskIndexLabelFlagPrefix         = "f1"  // prefix-match of Flag
	TaskIndexLabelFlagSuffix         = "f2"  // suffix-match of Flag
	TaskIndexLabelFlagLike           = "f3"  // like-match of Flag
	TaskIndexLabelFlagEqual          = "f4"  // perfect-match of Flag
)

Variables

View Source
var (
	ErrAlreadyExists        = xerrors.New("already exists")
	ErrAlreadyDeleted       = xerrors.New("already been deleted")
	ErrNotFound             = xerrors.New("not found")
	ErrLogicallyDeletedData = xerrors.New("logically deleted data")
	ErrUniqueConstraint     = xerrors.New("unique constraint error")
	ErrNotAvailableCG       = xerrors.New("not available in collection groups")
	ErrVersionConflict      = xerrors.New("version conflict")
)

Functions

func IsSlice added in v1.1.4

func IsSlice(v interface{}) bool

IsSlice - slice judgment

func SetLastThreeToZero added in v1.1.4

func SetLastThreeToZero(t time.Time) time.Time

SetLastThreeToZero - set the last three digits to zero

Types

type Cursor added in v1.1.4

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

Cursor - query cursor

type DeleteMode added in v1.1.4

type DeleteMode int

DeleteMode - delete mode

const (
	DeleteModeSoft DeleteMode = iota + 1 // logical delete mode
	DeleteModeHard                       // physical delete mode
)

type DeleteOption added in v1.1.4

type DeleteOption struct {
	Mode DeleteMode
}

DeleteOption - option to delete logically or physically default: physical deletion use `DeleteModeSoft` or `DeleteModeHard

type Filter added in v1.1.4

type Filter struct {
	FilterTypes []FilterType
	Value       interface{}
}

Filter - filters of extra indexer

type FilterType added in v1.1.4

type FilterType = int

FilterType - extra indexes filters type

const (
	FilterTypeAdd FilterType = 1 << iota
	FilterTypeAddPrefix
	FilterTypeAddSuffix
	FilterTypeAddBiunigrams
	FilterTypeAddSomething
)

type Flag

type Flag bool

type GetOption added in v1.1.4

type GetOption struct {
	IncludeSoftDeleted bool
}

GetOption - option to include logical deletion data

type MultiError added in v1.1.4

type MultiError interface {
	GetIndex() int
	GetError() error
	Error() string
}

MultiError - multi error interface

func NewMultiError added in v1.1.4

func NewMultiError(index int, err error) MultiError

NewMultiError - constructor

type MultiErrors added in v1.1.4

type MultiErrors []MultiError

MultiErrors - multi errors

func NewMultiErrors added in v1.1.4

func NewMultiErrors() MultiErrors

NewMultiErrors - constructor

func (MultiErrors) Error added in v1.1.4

func (errs MultiErrors) Error() string

Error - multi errors string

type OpType added in v1.1.4

type OpType = string

OpType - operator type

const (
	OpTypeEqual              OpType = "=="
	OpTypeNotEqual           OpType = "!="
	OpTypeLessThan           OpType = "<"
	OpTypeLessThanOrEqual    OpType = "<="
	OpTypeGreaterThan        OpType = ">"
	OpTypeGreaterThanOrEqual OpType = ">="
	OpTypeIn                 OpType = "in"
	OpTypeNotIn              OpType = "not-in"
	OpTypeArrayContains      OpType = "array-contains"
	OpTypeArrayContainsAny   OpType = "array-contains-any"
)

type Query added in v1.1.4

type Query struct {
	Operator OpType
	Value    interface{}
}

Query - query

func (*Query) IsSlice added in v1.1.4

func (q *Query) IsSlice() bool

IsSlice - slice judgment

type QueryBuilder added in v1.1.4

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

QueryBuilder - query builder

func NewQueryBuilder added in v1.1.4

func NewQueryBuilder(collection *firestore.CollectionRef) *QueryBuilder

NewQueryBuilder - constructor

func (*QueryBuilder) ArrayContains added in v1.1.4

func (qb *QueryBuilder) ArrayContains(path string, value interface{}) *QueryBuilder

ArrayContains - array filter ( `array-contains` )

func (*QueryBuilder) ArrayContainsAny added in v1.1.4

func (qb *QueryBuilder) ArrayContainsAny(path string, value interface{}) *QueryBuilder

ArrayContainsAny - array filter ( `array-contains-any` )

func (*QueryBuilder) Asc added in v1.1.4

func (qb *QueryBuilder) Asc(path string) *QueryBuilder

Asc - order

func (*QueryBuilder) Check added in v1.1.4

func (qb *QueryBuilder) Check() error

Check - condition check

func (*QueryBuilder) Desc added in v1.1.4

func (qb *QueryBuilder) Desc(path string) *QueryBuilder

Desc - order

func (*QueryBuilder) EndAt added in v1.1.4

func (qb *QueryBuilder) EndAt(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

EndAt - end at

func (*QueryBuilder) EndBefore added in v1.1.4

func (qb *QueryBuilder) EndBefore(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

EndBefore - end before

func (*QueryBuilder) Equal added in v1.1.4

func (qb *QueryBuilder) Equal(path string, value interface{}) *QueryBuilder

Equal - equality filter ( `==` )

func (*QueryBuilder) GreaterThan added in v1.1.4

func (qb *QueryBuilder) GreaterThan(path string, value interface{}) *QueryBuilder

GreaterThan - range filter ( `>` )

func (*QueryBuilder) GreaterThanOrEqual added in v1.1.4

func (qb *QueryBuilder) GreaterThanOrEqual(path string, value interface{}) *QueryBuilder

GreaterThanOrEqual - range filter ( `>=` )

func (*QueryBuilder) In added in v1.1.4

func (qb *QueryBuilder) In(path string, value interface{}) *QueryBuilder

In - array filter ( `in` )

func (*QueryBuilder) LessThan added in v1.1.4

func (qb *QueryBuilder) LessThan(path string, value interface{}) *QueryBuilder

LessThan - range filter ( `<` )

func (*QueryBuilder) LessThanOrEqual added in v1.1.4

func (qb *QueryBuilder) LessThanOrEqual(path string, value interface{}) *QueryBuilder

LessThanOrEqual - range filter ( `<=` )

func (*QueryBuilder) Limit added in v1.1.4

func (qb *QueryBuilder) Limit(limit int) *QueryBuilder

Limit - limit

func (*QueryBuilder) NotEqual added in v1.1.4

func (qb *QueryBuilder) NotEqual(path string, value interface{}) *QueryBuilder

NotEqual - inequality filter ( `!=` )

func (*QueryBuilder) NotIn added in v1.1.4

func (qb *QueryBuilder) NotIn(path string, value interface{}) *QueryBuilder

NotIn - array filter ( `not-in` )

func (*QueryBuilder) Query added in v1.1.4

func (qb *QueryBuilder) Query() *firestore.Query

Query - return firestore.Query

func (*QueryBuilder) StartAfter added in v1.1.4

func (qb *QueryBuilder) StartAfter(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

StartAfter - start after

func (*QueryBuilder) StartAt added in v1.1.4

func (qb *QueryBuilder) StartAt(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

StartAt - start at

type QueryChainer added in v1.1.4

type QueryChainer struct {
	QueryGroup       []*Query
	OrderByDirection firestore.Direction
	Filter           Filter
	// contains filtered or unexported fields
}

QueryChainer - query chainer

func NewQueryChainer added in v1.1.4

func NewQueryChainer() *QueryChainer

NewQueryChainer - constructor

func (*QueryChainer) ArrayContains added in v1.1.4

func (qc *QueryChainer) ArrayContains(v interface{}) *QueryChainer

ArrayContains - `array-contains`

func (*QueryChainer) ArrayContainsAny added in v1.1.4

func (qc *QueryChainer) ArrayContainsAny(v interface{}) *QueryChainer

ArrayContainsAny - `array-contains-any`

func (*QueryChainer) Asc added in v1.1.4

func (qc *QueryChainer) Asc() *QueryChainer

Asc - `Asc`

func (*QueryChainer) BuildCursorQuery added in v1.1.4

func (qc *QueryChainer) BuildCursorQuery(q firestore.Query) firestore.Query

BuildCursor - build query for cursor

func (*QueryChainer) Desc added in v1.1.4

func (qc *QueryChainer) Desc() *QueryChainer

Desc - `Desc`

func (*QueryChainer) EndAt added in v1.1.4

func (qc *QueryChainer) EndAt(v ...interface{}) *QueryChainer

EndAt - end at

func (*QueryChainer) EndBefore added in v1.1.4

func (qc *QueryChainer) EndBefore(v ...interface{}) *QueryChainer

EndBefore - end before

func (*QueryChainer) Equal added in v1.1.4

func (qc *QueryChainer) Equal(v interface{}) *QueryChainer

Equal - `==`

func (*QueryChainer) Error added in v1.1.4

func (qc *QueryChainer) Error() error

Error - error

func (*QueryChainer) Filters added in v1.1.4

func (qc *QueryChainer) Filters(v interface{}, filterTypes ...FilterType) *QueryChainer

Filters - using `xim`

func (*QueryChainer) GreaterThan added in v1.1.4

func (qc *QueryChainer) GreaterThan(v interface{}) *QueryChainer

GreaterThan - `>`

func (*QueryChainer) GreaterThanOrEqual added in v1.1.4

func (qc *QueryChainer) GreaterThanOrEqual(v interface{}) *QueryChainer

GreaterThanOrEqual - `>=`

func (*QueryChainer) In added in v1.1.4

func (qc *QueryChainer) In(v interface{}) *QueryChainer

In - `in`

func (*QueryChainer) LessThan added in v1.1.4

func (qc *QueryChainer) LessThan(v interface{}) *QueryChainer

LessThan - `<`

func (*QueryChainer) LessThanOrEqual added in v1.1.4

func (qc *QueryChainer) LessThanOrEqual(v interface{}) *QueryChainer

LessThanOrEqual - `<=`

func (*QueryChainer) NotEqual added in v1.1.4

func (qc *QueryChainer) NotEqual(v interface{}) *QueryChainer

NotEqual - `!=`

func (*QueryChainer) NotIn added in v1.1.4

func (qc *QueryChainer) NotIn(v interface{}) *QueryChainer

NotIn - `not-in`

func (*QueryChainer) StartAfter added in v1.1.4

func (qc *QueryChainer) StartAfter(v ...interface{}) *QueryChainer

StartAt - start after

func (*QueryChainer) StartAt added in v1.1.4

func (qc *QueryChainer) StartAt(v ...interface{}) *QueryChainer

StartAt - start at

type RollbackFunc added in v1.1.4

type RollbackFunc func(context.Context) error

RollbackFunc - rollback function

type SubTask

type SubTask struct {
	ID              string `firestore:"-" firestore_key:"auto"`
	IsSubCollection bool   ``
}

type SubTaskRepository added in v1.1.4

type SubTaskRepository interface {
	// Single
	Get(ctx context.Context, id string, opts ...GetOption) (*SubTask, error)
	GetWithDoc(ctx context.Context, doc *firestore.DocumentRef, opts ...GetOption) (*SubTask, error)
	Insert(ctx context.Context, subject *SubTask) (_ string, err error)
	Update(ctx context.Context, subject *SubTask) (err error)
	StrictUpdate(ctx context.Context, id string, param *SubTaskUpdateParam, opts ...firestore.Precondition) error
	Delete(ctx context.Context, subject *SubTask, opts ...DeleteOption) (err error)
	DeleteByID(ctx context.Context, id string, opts ...DeleteOption) (err error)
	// Multiple
	GetMulti(ctx context.Context, ids []string, opts ...GetOption) ([]*SubTask, error)
	InsertMulti(ctx context.Context, subjects []*SubTask) (_ []string, er error)
	UpdateMulti(ctx context.Context, subjects []*SubTask) (er error)
	DeleteMulti(ctx context.Context, subjects []*SubTask, opts ...DeleteOption) (er error)
	DeleteMultiByIDs(ctx context.Context, ids []string, opts ...DeleteOption) (er error)
	// Single(Transaction)
	GetWithTx(tx *firestore.Transaction, id string, opts ...GetOption) (*SubTask, error)
	GetWithDocWithTx(tx *firestore.Transaction, doc *firestore.DocumentRef, opts ...GetOption) (*SubTask, error)
	InsertWithTx(ctx context.Context, tx *firestore.Transaction, subject *SubTask) (_ string, err error)
	UpdateWithTx(ctx context.Context, tx *firestore.Transaction, subject *SubTask) (err error)
	StrictUpdateWithTx(tx *firestore.Transaction, id string, param *SubTaskUpdateParam, opts ...firestore.Precondition) error
	DeleteWithTx(ctx context.Context, tx *firestore.Transaction, subject *SubTask, opts ...DeleteOption) (err error)
	DeleteByIDWithTx(ctx context.Context, tx *firestore.Transaction, id string, opts ...DeleteOption) (err error)
	// Multiple(Transaction)
	GetMultiWithTx(tx *firestore.Transaction, ids []string, opts ...GetOption) ([]*SubTask, error)
	InsertMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*SubTask) (_ []string, er error)
	UpdateMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*SubTask) (er error)
	DeleteMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*SubTask, opts ...DeleteOption) (er error)
	DeleteMultiByIDsWithTx(ctx context.Context, tx *firestore.Transaction, ids []string, opts ...DeleteOption) (er error)
	// Search
	Search(ctx context.Context, param *SubTaskSearchParam, q *firestore.Query) ([]*SubTask, error)
	SearchWithTx(tx *firestore.Transaction, param *SubTaskSearchParam, q *firestore.Query) ([]*SubTask, error)
	// misc
	GetCollection() *firestore.CollectionRef
	GetCollectionName() string
	GetDocRef(id string) *firestore.DocumentRef
	RunInTransaction() func(ctx context.Context, f func(context.Context, *firestore.Transaction) error, opts ...firestore.TransactionOption) (err error)
	SetParentDoc(doc *firestore.DocumentRef)
	Free()
}

SubTaskRepository - Repository of SubTask

func NewSubTaskCollectionGroupRepository added in v1.1.4

func NewSubTaskCollectionGroupRepository(firestoreClient *firestore.Client) SubTaskRepository

NewSubTaskCollectionGroupRepository - constructor

func NewSubTaskRepository added in v1.1.4

func NewSubTaskRepository(firestoreClient *firestore.Client, parentDocument *firestore.DocumentRef, middleware ...SubTaskRepositoryMiddleware) SubTaskRepository

NewSubTaskRepository - constructor

type SubTaskRepositoryMiddleware added in v1.1.4

type SubTaskRepositoryMiddleware interface {
	BeforeInsert(ctx context.Context, subject *SubTask) (bool, error)
	BeforeUpdate(ctx context.Context, old, subject *SubTask) (bool, error)
	BeforeDelete(ctx context.Context, subject *SubTask, opts ...DeleteOption) (bool, error)
	BeforeDeleteByID(ctx context.Context, ids []string, opts ...DeleteOption) (bool, error)
}

SubTaskRepositoryMiddleware - middleware of SubTaskRepository

type SubTaskSearchParam added in v1.1.4

type SubTaskSearchParam struct {
	IsSubCollection *QueryChainer

	CursorLimit int
}

SubTaskSearchParam - params for search

type SubTaskUpdateParam added in v1.1.4

type SubTaskUpdateParam struct {
	IsSubCollection interface{}
}

SubTaskUpdateParam - params for strict updates

type Task

type Task struct {
	Identity     string                 `firestore:"-" firestore_key:""`
	Desc         string                 `firestore:"description" unique:""`
	Desc2        string                 `firestore:"desc2"`
	Created      time.Time              `firestore:"created"`
	ReservedDate *time.Time             `firestore:"reservedDate"`
	Done         bool                   `firestore:"done"`
	Done2        bool                   `firestore:"done2"`
	Count        int                    `firestore:"count"`
	Count64      int64                  `firestore:"count64"`
	NameList     []string               `firestore:"nameList"`
	Proportion   float64                `firestore:"proportion"`
	Geo          *latlng.LatLng         `firestore:"geo"`
	Sub          *firestore.DocumentRef `firestore:"sub"`
	Flag         Flag                   `firestore:"flag"`
}

Task ID自動生成なし

type TaskRepository added in v1.1.4

type TaskRepository interface {
	// Single
	Get(ctx context.Context, identity string, opts ...GetOption) (*Task, error)
	GetWithDoc(ctx context.Context, doc *firestore.DocumentRef, opts ...GetOption) (*Task, error)
	Insert(ctx context.Context, subject *Task) (_ string, err error)
	Update(ctx context.Context, subject *Task) (err error)
	StrictUpdate(ctx context.Context, id string, param *TaskUpdateParam, opts ...firestore.Precondition) error
	Delete(ctx context.Context, subject *Task, opts ...DeleteOption) (err error)
	DeleteByIdentity(ctx context.Context, identity string, opts ...DeleteOption) (err error)
	// Multiple
	GetMulti(ctx context.Context, identities []string, opts ...GetOption) ([]*Task, error)
	InsertMulti(ctx context.Context, subjects []*Task) (_ []string, er error)
	UpdateMulti(ctx context.Context, subjects []*Task) (er error)
	DeleteMulti(ctx context.Context, subjects []*Task, opts ...DeleteOption) (er error)
	DeleteMultiByIdentities(ctx context.Context, identities []string, opts ...DeleteOption) (er error)
	// Single(Transaction)
	GetWithTx(tx *firestore.Transaction, identity string, opts ...GetOption) (*Task, error)
	GetWithDocWithTx(tx *firestore.Transaction, doc *firestore.DocumentRef, opts ...GetOption) (*Task, error)
	InsertWithTx(ctx context.Context, tx *firestore.Transaction, subject *Task) (_ string, err error)
	UpdateWithTx(ctx context.Context, tx *firestore.Transaction, subject *Task) (err error)
	StrictUpdateWithTx(tx *firestore.Transaction, id string, param *TaskUpdateParam, opts ...firestore.Precondition) error
	DeleteWithTx(ctx context.Context, tx *firestore.Transaction, subject *Task, opts ...DeleteOption) (err error)
	DeleteByIdentityWithTx(ctx context.Context, tx *firestore.Transaction, identity string, opts ...DeleteOption) (err error)
	// Multiple(Transaction)
	GetMultiWithTx(tx *firestore.Transaction, identities []string, opts ...GetOption) ([]*Task, error)
	InsertMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Task) (_ []string, er error)
	UpdateMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Task) (er error)
	DeleteMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Task, opts ...DeleteOption) (er error)
	DeleteMultiByIdentitiesWithTx(ctx context.Context, tx *firestore.Transaction, identities []string, opts ...DeleteOption) (er error)
	// Search
	Search(ctx context.Context, param *TaskSearchParam, q *firestore.Query) ([]*Task, error)
	SearchWithTx(tx *firestore.Transaction, param *TaskSearchParam, q *firestore.Query) ([]*Task, error)
	// misc
	GetCollection() *firestore.CollectionRef
	GetCollectionName() string
	GetDocRef(identity string) *firestore.DocumentRef
	RunInTransaction() func(ctx context.Context, f func(context.Context, *firestore.Transaction) error, opts ...firestore.TransactionOption) (err error)
	// get by unique field
	GetByDesc(ctx context.Context, description string) (*Task, error)
	GetByDescWithTx(tx *firestore.Transaction, description string) (*Task, error)
}

TaskRepository - Repository of Task

func NewTaskRepository added in v1.1.4

func NewTaskRepository(firestoreClient *firestore.Client, middleware ...TaskRepositoryMiddleware) TaskRepository

NewTaskRepository - constructor

type TaskRepositoryMiddleware added in v1.1.4

type TaskRepositoryMiddleware interface {
	BeforeInsert(ctx context.Context, subject *Task) (bool, error)
	BeforeUpdate(ctx context.Context, old, subject *Task) (bool, error)
	BeforeDelete(ctx context.Context, subject *Task, opts ...DeleteOption) (bool, error)
	BeforeDeleteByIdentity(ctx context.Context, identities []string, opts ...DeleteOption) (bool, error)
}

TaskRepositoryMiddleware - middleware of TaskRepository

type TaskSearchParam added in v1.1.4

type TaskSearchParam struct {
	Desc         *QueryChainer
	Desc2        *QueryChainer
	Created      *QueryChainer
	ReservedDate *QueryChainer
	Done         *QueryChainer
	Done2        *QueryChainer
	Count        *QueryChainer
	Count64      *QueryChainer
	NameList     *QueryChainer
	Proportion   *QueryChainer
	Geo          *QueryChainer
	Sub          *QueryChainer
	Flag         *QueryChainer

	CursorLimit int
}

TaskSearchParam - params for search

type TaskUpdateParam added in v1.1.4

type TaskUpdateParam struct {
	Desc2        interface{}
	Created      interface{}
	ReservedDate interface{}
	Done         interface{}
	Done2        interface{}
	Count        interface{}
	Count64      interface{}
	NameList     interface{}
	Proportion   interface{}
	Geo          interface{}
	Sub          interface{}
	Flag         interface{}
}

TaskUpdateParam - params for strict updates

type Unique added in v1.1.4

type Unique struct {
	ID         string `firestore:"-"`
	Collection string
	Data       string
	Value      string
}

Unique - Collections for unique constraints

type UniqueMiddlewareKey added in v1.1.4

type UniqueMiddlewareKey struct{}

type UniqueRepositoryMiddleware added in v1.1.4

type UniqueRepositoryMiddleware interface {
	WrapError(ctx context.Context, err error, uniques []*Unique) error
}

UniqueRepositoryMiddleware - middleware

Notes

Bugs

  • there may be potential bugs

  • there may be potential bugs

Directories

Path Synopsis
mock
mock_sub_task_gen
Package mock_model is a generated GoMock package.
Package mock_model is a generated GoMock package.
mock_task_gen
Package mock_model is a generated GoMock package.
Package mock_model is a generated GoMock package.

Jump to

Keyboard shortcuts

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