add command impl
This commit is contained in:
parent
f438be5771
commit
290f5ce85b
@ -32,7 +32,7 @@ func (c *CommandImpl) Delete(key string, platform string, binding string) error
|
|||||||
sq.Eq{"key": key},
|
sq.Eq{"key": key},
|
||||||
sq.Eq{"platform": platform},
|
sq.Eq{"platform": platform},
|
||||||
sq.Eq{"binding": binding},
|
sq.Eq{"binding": binding},
|
||||||
})
|
}).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -44,22 +44,100 @@ func (c *CommandImpl) Delete(key string, platform string, binding string) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetByKey -
|
||||||
func (c *CommandImpl) GetByKey(key string) ([]pubmodel.Command, error) {
|
func (c *CommandImpl) GetByKey(key string) ([]pubmodel.Command, error) {
|
||||||
panic("not implemented")
|
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
|
||||||
|
From(`"public"."command"`).Where(sq.Eq{"key": key}).ToSql()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
query = x.Rebind(query)
|
||||||
|
|
||||||
|
list := make([]pubmodel.Command, 0)
|
||||||
|
err = x.Select(&list, query, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetByKeyPlatform -
|
||||||
func (c *CommandImpl) GetByKeyPlatform(key string, platform string) ([]pubmodel.Command, error) {
|
func (c *CommandImpl) GetByKeyPlatform(key string, platform string) ([]pubmodel.Command, error) {
|
||||||
panic("not implemented")
|
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
|
||||||
|
From(`"public"."command"`).Where(sq.And{
|
||||||
|
sq.Eq{"key": key},
|
||||||
|
sq.Eq{"platform": platform},
|
||||||
|
}).ToSql()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
query = x.Rebind(query)
|
||||||
|
list := make([]pubmodel.Command, 0)
|
||||||
|
err = x.Select(&list, query, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetByKeyPlatformBinding -
|
||||||
func (c *CommandImpl) GetByKeyPlatformBinding(key string, platform string, binding string) ([]pubmodel.Command, error) {
|
func (c *CommandImpl) GetByKeyPlatformBinding(key string, platform string, binding string) ([]pubmodel.Command, error) {
|
||||||
panic("not implemented")
|
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
|
||||||
|
From(`"public"."command"`).Where(sq.And{
|
||||||
|
sq.Eq{"key": key},
|
||||||
|
sq.Eq{"platform": platform},
|
||||||
|
sq.Eq{"binding": binding},
|
||||||
|
}).ToSql()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
query = x.Rebind(query)
|
||||||
|
list := make([]pubmodel.Command, 0)
|
||||||
|
err = x.Select(&list, query, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetByPlatformBinding -
|
||||||
func (c *CommandImpl) GetByPlatformBinding(platform string, binding string) ([]pubmodel.Command, error) {
|
func (c *CommandImpl) GetByPlatformBinding(platform string, binding string) ([]pubmodel.Command, error) {
|
||||||
panic("not implemented")
|
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
|
||||||
|
From(`"public"."command"`).Where(sq.And{
|
||||||
|
sq.Eq{"platform": platform},
|
||||||
|
sq.Eq{"binding": binding},
|
||||||
|
}).ToSql()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
query = x.Rebind(query)
|
||||||
|
list := make([]pubmodel.Command, 0)
|
||||||
|
err = x.Select(&list, query, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetByKeyBinding -
|
||||||
func (c *CommandImpl) GetByKeyBinding(key string, binding string) ([]pubmodel.Command, error) {
|
func (c *CommandImpl) GetByKeyBinding(key string, binding string) ([]pubmodel.Command, error) {
|
||||||
panic("not implemented")
|
query, args, err := sq.Select("key", "platform", "binding", "require_manage", "require_init", "value", "ctime", "mtime").
|
||||||
|
From(`"public"."command"`).Where(sq.And{
|
||||||
|
sq.Eq{"key": key},
|
||||||
|
sq.Eq{"binding": binding},
|
||||||
|
}).ToSql()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
query = x.Rebind(query)
|
||||||
|
list := make([]pubmodel.Command, 0)
|
||||||
|
err = x.Select(&list, query, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return list, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user