github.com/nais/knorten@v0.0.0-20240104110906-55926958e361/pkg/database/queries/global_values.sql (about)

     1  -- name: GlobalValueInsert :exec
     2  INSERT INTO chart_global_values (
     3      "key",
     4      "value",
     5      "chart_type",
     6      "encrypted"
     7  ) VALUES (
     8      @key,
     9      @value,
    10      @chart_type,
    11      @encrypted
    12  );
    13  
    14  -- name: GlobalValuesGet :many
    15  SELECT DISTINCT ON ("key") *
    16  FROM chart_global_values
    17  WHERE chart_type = @chart_type
    18  ORDER BY "key", "created" DESC;
    19  
    20  -- name: GlobalValueGet :one
    21  SELECT DISTINCT ON ("key") *
    22  FROM chart_global_values
    23  WHERE chart_type = @chart_type AND "key" = @key
    24  ORDER BY "key", "created" DESC;
    25  
    26  -- name: GlobalValueDelete :exec
    27  DELETE
    28  FROM chart_global_values
    29  WHERE key = @key
    30    AND chart_type = @chart_type;