---
title: "Fungsi-fungsi basisdata khusus PostgreSQL"
version: 6.1
locale: id
source: https://docs.djangoproject.com/id/6.1/ref/contrib/postgres/functions/
canonical: https://djangodocs.dev/id/6.1/ref/contrib/postgres/functions/
---
# Fungsi-fungsi basisdata khusus PostgreSQL

Semua dari fungsi-fungsi ini tersedia dari modul `django.contrib.postgres.functions`.

## `RandomUUID`

#### `class RandomUUID`

Mengembalikan sebuah versi 4 UUD.

Usage example:

```pycon
>>> from django.contrib.postgres.functions import RandomUUID
>>> Article.objects.update(uuid=RandomUUID())
```

> **Use django.db.models.functions.UUID4 instead.**
>
> [`django.db.models.functions.UUID4`](/id/6.1/ref/models/database-functions/#django.db.models.functions.UUID4) is a cross-database version of
> this function. `RandomUUID` may be deprecated in the future.

## `TransactionNow`

#### `class TransactionNow`

Mengembalikan tanggal dan waktu pada peladen basisdata yang transaksi saat ini dimulai. Jika anda tidak dalam transaksi itu akan mengembalikan tanggal dan waktu dari pernyataan saat ini. Ini adalah melengkapi pada [`django.db.models.functions.Now`](/id/6.1/ref/models/database-functions/#django.db.models.functions.Now), yang mengembalikan tanggal dan waktu dari pernyataan saat ini.

Note that only the outermost call to [`atomic()`](/id/6.1/topics/db/transactions/#django.db.transaction.atomic)
sets up a transaction and thus sets the time that `TransactionNow()` will
return; nested calls create savepoints which do not affect the transaction
time.

Usage example:

```pycon
>>> from django.contrib.postgres.functions import TransactionNow
>>> Article.objects.filter(published__lte=TransactionNow())
<QuerySet [<Article: How to Django>]>
```
