Documentation
¶
Index ¶
- type Service
- func (svc *Service) BulkCreate(ctx context.Context, objs []*serviceapi.Obj) (objKeys []serviceapi.ObjKey, err error)
- func (svc *Service) BulkDelete(ctx context.Context, objKeys []serviceapi.ObjKey) (deletedKeys []serviceapi.ObjKey, err error)
- func (svc *Service) BulkLoad(ctx context.Context, objKeys []serviceapi.ObjKey) (objs []*serviceapi.Obj, err error)
- func (svc *Service) BulkRevise(ctx context.Context, objs []*serviceapi.Obj) (revisedKeys []serviceapi.ObjKey, err error)
- func (svc *Service) BulkStore(ctx context.Context, objs []*serviceapi.Obj) (storedKeys []serviceapi.ObjKey, err error)
- func (svc *Service) Count(ctx context.Context, query serviceapi.Query) (count int, err error)
- func (svc *Service) Create(ctx context.Context, obj *serviceapi.Obj) (objKey serviceapi.ObjKey, err error)
- func (svc *Service) Delete(ctx context.Context, objKey serviceapi.ObjKey) (deleted bool, err error)
- func (svc *Service) Deployment() string
- func (svc *Service) List(ctx context.Context, query serviceapi.Query) (objs []*serviceapi.Obj, totalCount int, err error)
- func (svc *Service) Load(ctx context.Context, objKey serviceapi.ObjKey) (obj *serviceapi.Obj, found bool, err error)
- func (svc *Service) Lookup(ctx context.Context, query serviceapi.Query) (obj *serviceapi.Obj, found bool, err error)
- func (svc *Service) MustDelete(ctx context.Context, objKey serviceapi.ObjKey) (err error)
- func (svc *Service) MustLoad(ctx context.Context, objKey serviceapi.ObjKey) (obj *serviceapi.Obj, err error)
- func (svc *Service) MustLookup(ctx context.Context, query serviceapi.Query) (obj *serviceapi.Obj, err error)
- func (svc *Service) MustRevise(ctx context.Context, obj *serviceapi.Obj) (err error)
- func (svc *Service) MustStore(ctx context.Context, obj *serviceapi.Obj) (err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Parallel(args ...any) error
- func (svc *Service) Plane() string
- func (svc *Service) Purge(ctx context.Context, query serviceapi.Query) (deletedKeys []serviceapi.ObjKey, err error)
- func (svc *Service) ResFS() fs.FS
- func (svc *Service) Revise(ctx context.Context, obj *serviceapi.Obj) (revised bool, err error)
- func (svc *Service) SQLDataSourceName() (dsn string)
- func (svc *Service) SetSQLDataSourceName(dsn string)
- func (svc *Service) Store(ctx context.Context, obj *serviceapi.Obj) (stored bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService() *Service
func (*Service) BulkCreate ¶
func (svc *Service) BulkCreate(ctx context.Context, objs []*serviceapi.Obj) (objKeys []serviceapi.ObjKey, err error)
BulkCreate creates multiple objects, returning their keys.
func (*Service) BulkDelete ¶
func (svc *Service) BulkDelete(ctx context.Context, objKeys []serviceapi.ObjKey) (deletedKeys []serviceapi.ObjKey, err error)
BulkDelete deletes the objects matching the keys, returning the keys of the deleted objects.
func (*Service) BulkLoad ¶
func (svc *Service) BulkLoad(ctx context.Context, objKeys []serviceapi.ObjKey) (objs []*serviceapi.Obj, err error)
BulkLoad returns the objects matching the keys.
func (*Service) BulkRevise ¶
func (svc *Service) BulkRevise(ctx context.Context, objs []*serviceapi.Obj) (revisedKeys []serviceapi.ObjKey, err error)
BulkRevise updates multiple objects, returning the number of rows affected. Only rows with matching revisions are updated.
func (*Service) BulkStore ¶
func (svc *Service) BulkStore(ctx context.Context, objs []*serviceapi.Obj) (storedKeys []serviceapi.ObjKey, err error)
BulkStore updates multiple objects, returning the keys of the stored objects.
func (*Service) Count ¶
Count returns the number of objects matching the query, disregarding pagination.
func (*Service) Create ¶
func (svc *Service) Create(ctx context.Context, obj *serviceapi.Obj) (objKey serviceapi.ObjKey, err error)
Create creates a new object, returning its key.
func (*Service) Deployment ¶
func (*Service) List ¶
func (svc *Service) List(ctx context.Context, query serviceapi.Query) (objs []*serviceapi.Obj, totalCount int, err error)
List returns the objects matching the query, and the total count of matches regardless of the limit.
func (*Service) Load ¶
func (svc *Service) Load(ctx context.Context, objKey serviceapi.ObjKey) (obj *serviceapi.Obj, found bool, err error)
Load returns the object associated with the key.
func (*Service) Lookup ¶
func (svc *Service) Lookup(ctx context.Context, query serviceapi.Query) (obj *serviceapi.Obj, found bool, err error)
Lookup returns the single object matching the query. It errors if more than one object matches the query.
func (*Service) MustDelete ¶
MustDelete deletes the object.
func (*Service) MustLoad ¶
func (svc *Service) MustLoad(ctx context.Context, objKey serviceapi.ObjKey) (obj *serviceapi.Obj, err error)
MustLoad returns the object associated with the key. It errors if the object is not found.
func (*Service) MustLookup ¶
func (svc *Service) MustLookup(ctx context.Context, query serviceapi.Query) (obj *serviceapi.Obj, err error)
MustLookup returns the single object matching the query. It errors unless exactly one object matches the query.
func (*Service) MustRevise ¶
MustRevise updates the object only if the revision matches.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) Purge ¶
func (svc *Service) Purge(ctx context.Context, query serviceapi.Query) (deletedKeys []serviceapi.ObjKey, err error)
Purge deletes all objects matching the query, returning the keys of the deleted objects.