-- << Create
insert into cm ( clid
                    , code
                    , name
                    , is_active
                    , notes
                    , tmpl)
values ( @clid
       , @code
       , @name
       , @is_active
       , @notes
       , @tmpl)
returning id
-- Create >>

-- << Read
select clid
     , id
     , code
     , name
     , is_active
     , notes
     , tmpl

from cm
where id = $1
-- Read >>

-- << Update
update cm
set code      = @code
  , name     = @name
  , is_active = @is_active
  , notes     = @notes
  , tmpl      = @tmpl

where id = @id
-- Update >>

-- << Delete
delete
from cm
where id = $1
-- Delete >>

-- << List
select clid
     , id
     , code
     , name
     , is_active
     , notes
     , tmpl

from cm {{.Where}}
{{.OrderBy}}
{{.Rows}}
-- List >>
