[#794] fixed comment typos
This commit is contained in:
parent
6385c5e646
commit
9cbb2e750e
|
@ -125,7 +125,7 @@ type BaseApp struct {
|
||||||
// NewBaseApp creates and returns a new BaseApp instance
|
// NewBaseApp creates and returns a new BaseApp instance
|
||||||
// configured with the provided arguments.
|
// configured with the provided arguments.
|
||||||
//
|
//
|
||||||
// To initialize the app, you need to call `app.Bootsrap()`.
|
// To initialize the app, you need to call `app.Bootstrap()`.
|
||||||
func NewBaseApp(dataDir string, encryptionEnv string, isDebug bool) *BaseApp {
|
func NewBaseApp(dataDir string, encryptionEnv string, isDebug bool) *BaseApp {
|
||||||
app := &BaseApp{
|
app := &BaseApp{
|
||||||
dataDir: dataDir,
|
dataDir: dataDir,
|
||||||
|
|
|
@ -76,7 +76,7 @@ func (dao *Dao) FindCollectionsWithUserFields() ([]*models.Collection, error) {
|
||||||
// relation schema fields referencing the provided collection.
|
// relation schema fields referencing the provided collection.
|
||||||
//
|
//
|
||||||
// If the provided collection has reference to itself then it will be
|
// If the provided collection has reference to itself then it will be
|
||||||
// also included in the result. To exlude it, pass the collection id
|
// also included in the result. To exclude it, pass the collection id
|
||||||
// as the excludeId argument.
|
// as the excludeId argument.
|
||||||
func (dao *Dao) FindCollectionReferences(collection *models.Collection, excludeId string) (map[*models.Collection][]*schema.SchemaField, error) {
|
func (dao *Dao) FindCollectionReferences(collection *models.Collection, excludeId string) (map[*models.Collection][]*schema.SchemaField, error) {
|
||||||
collections := []*models.Collection{}
|
collections := []*models.Collection{}
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (dao *Dao) LoadProfile(user *models.User) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadProfiles loads the profile records associated to the provied users list.
|
// LoadProfiles loads the profile records associated to the provided users list.
|
||||||
func (dao *Dao) LoadProfiles(users []*models.User) error {
|
func (dao *Dao) LoadProfiles(users []*models.User) error {
|
||||||
collection, err := dao.FindCollectionByNameOrId(models.ProfileCollectionName)
|
collection, err := dao.FindCollectionByNameOrId(models.ProfileCollectionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -241,7 +241,7 @@ func TestAdminUpsertSubmit(t *testing.T) {
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// update succcess - new email
|
// update success - new email
|
||||||
"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c",
|
"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c",
|
||||||
`{
|
`{
|
||||||
"email": "test_update@example.com"
|
"email": "test_update@example.com"
|
||||||
|
@ -249,7 +249,7 @@ func TestAdminUpsertSubmit(t *testing.T) {
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// update succcess - new password
|
// update success - new password
|
||||||
"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c",
|
"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c",
|
||||||
`{
|
`{
|
||||||
"password": "1234567890",
|
"password": "1234567890",
|
||||||
|
|
|
@ -133,7 +133,7 @@ func (f SchemaField) Validate() error {
|
||||||
// init field options (if not already)
|
// init field options (if not already)
|
||||||
f.InitOptions()
|
f.InitOptions()
|
||||||
|
|
||||||
// add commonly used filter literals to the exlude names list
|
// add commonly used filter literals to the exclude names list
|
||||||
excludeNames := ReservedFieldNames()
|
excludeNames := ReservedFieldNames()
|
||||||
excludeNames = append(excludeNames, "null", "true", "false")
|
excludeNames = append(excludeNames, "null", "true", "false")
|
||||||
|
|
||||||
|
|
|
@ -13,16 +13,17 @@ import (
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FilterData is a filter expession string following the `fexpr` package grammar.
|
// FilterData is a filter expression string following the `fexpr` package grammar.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
|
//
|
||||||
// var filter FilterData = "id = null || (name = 'test' && status = true)"
|
// var filter FilterData = "id = null || (name = 'test' && status = true)"
|
||||||
// resolver := search.NewSimpleFieldResolver("id", "name", "status")
|
// resolver := search.NewSimpleFieldResolver("id", "name", "status")
|
||||||
// expr, err := filter.BuildExpr(resolver)
|
// expr, err := filter.BuildExpr(resolver)
|
||||||
type FilterData string
|
type FilterData string
|
||||||
|
|
||||||
// parsedFilterData holds a cache with previously parsed filter data expressions
|
// parsedFilterData holds a cache with previously parsed filter data expressions
|
||||||
// (initialized with some prealocated empty data map)
|
// (initialized with some preallocated empty data map)
|
||||||
var parsedFilterData = store.New(make(map[string][]fexpr.ExprGroup, 50))
|
var parsedFilterData = store.New(make(map[string][]fexpr.ExprGroup, 50))
|
||||||
|
|
||||||
// BuildExpr parses the current filter data and returns a new db WHERE expression.
|
// BuildExpr parses the current filter data and returns a new db WHERE expression.
|
||||||
|
|
|
@ -46,6 +46,7 @@ type Provider struct {
|
||||||
// NewProvider creates and returns a new search provider.
|
// NewProvider creates and returns a new search provider.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
|
//
|
||||||
// baseQuery := db.Select("*").From("user")
|
// baseQuery := db.Select("*").From("user")
|
||||||
// fieldResolver := search.NewSimpleFieldResolver("id", "name")
|
// fieldResolver := search.NewSimpleFieldResolver("id", "name")
|
||||||
// models := []*YourDataStruct{}
|
// models := []*YourDataStruct{}
|
||||||
|
@ -241,7 +242,7 @@ func (s *Provider) Exec(items any) (*Result, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseAndExec is a short conventient method to trigger both
|
// ParseAndExec is a short convenient method to trigger both
|
||||||
// `Parse()` and `Exec()` in a single call.
|
// `Parse()` and `Exec()` in a single call.
|
||||||
func (s *Provider) ParseAndExec(urlQuery string, modelsSlice any) (*Result, error) {
|
func (s *Provider) ParseAndExec(urlQuery string, modelsSlice any) (*Result, error) {
|
||||||
if err := s.Parse(urlQuery); err != nil {
|
if err := s.Parse(urlQuery); err != nil {
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (c *DefaultClient) Unsubscribe(subs ...string) {
|
||||||
delete(c.subscriptions, s)
|
delete(c.subscriptions, s)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// unsubsribe all
|
// unsubscribe all
|
||||||
for s := range c.subscriptions {
|
for s := range c.subscriptions {
|
||||||
delete(c.subscriptions, s)
|
delete(c.subscriptions, s)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (d DateTime) IsZero() bool {
|
||||||
return d.Time().IsZero()
|
return d.Time().IsZero()
|
||||||
}
|
}
|
||||||
|
|
||||||
// String serializes the current DateTime instance into a formated
|
// String serializes the current DateTime instance into a formatted
|
||||||
// UTC date string.
|
// UTC date string.
|
||||||
//
|
//
|
||||||
// The zero value is serialized to an empty string.
|
// The zero value is serialized to an empty string.
|
||||||
|
|
|
@ -13,7 +13,7 @@ type JsonArray []any
|
||||||
func (m JsonArray) MarshalJSON() ([]byte, error) {
|
func (m JsonArray) MarshalJSON() ([]byte, error) {
|
||||||
type alias JsonArray // prevent recursion
|
type alias JsonArray // prevent recursion
|
||||||
|
|
||||||
// inialize an empty map to ensure that `[]` is returned as json
|
// initialize an empty map to ensure that `[]` is returned as json
|
||||||
if m == nil {
|
if m == nil {
|
||||||
m = JsonArray{}
|
m = JsonArray{}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ type JsonMap map[string]any
|
||||||
func (m JsonMap) MarshalJSON() ([]byte, error) {
|
func (m JsonMap) MarshalJSON() ([]byte, error) {
|
||||||
type alias JsonMap // prevent recursion
|
type alias JsonMap // prevent recursion
|
||||||
|
|
||||||
// inialize an empty map to ensure that `{}` is returned as json
|
// initialize an empty map to ensure that `{}` is returned as json
|
||||||
if m == nil {
|
if m == nil {
|
||||||
m = JsonMap{}
|
m = JsonMap{}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue